pokemon-showdown-client/test/parse
Guangcong Luo 884dfee923 Fix issues identified by LGTM
Out of 12 issues found:

3 bugs:

- duplicate property - caught a bug in Gen 1 Light Screen
- duplicate property - caught a bug in Gen 1 Reflect
- unused variable - caught a bug in type animations

7 harmless but good for code quality:

- unused variable - harmless but good for code quality
- unused variable - harmless but good for code quality
- unused variable - harmless but good for code quality
- unused variable - harmless but good for code quality
- duplicate case - harmless but important for code quality
- unused variable - harmless but good for code quality
- unused variable - harmless but important for code quality

2 not-bugs that had to be worked around:

- unused variable - used for an `eval` trick, had to use a workaround
- unused variable - used for readable destructuring

I think on balance, LGTM does more good than bad. Catching bugs early
is worth some amount of hassle.

(Also like half these problems are problems tslint could catch if I
actually bothered to set it up...)
2018-11-15 18:52:36 -06:00

31 lines
754 B
JavaScript
Executable File

#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
process.chdir(path.resolve(__dirname, '..'));
window = global;
{
let exports = global;
eval('' + fs.readFileSync(`js/battle-dex.js`));
eval('' + fs.readFileSync(`js/battle-dex-data.js`));
eval('' + fs.readFileSync(`js/battle.js`));
eval('' + fs.readFileSync(`data/text.js`));
eval('' + fs.readFileSync(`js/battle-text-parser.js`));
}
const parser = new BattleTextParser();
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
rl.on('line', line => {
const {args, kwArgs} = Battle.lineParse(line);
process.stdout.write(parser.parseLine(args, kwArgs) || '');
});