[CORL-678] Transition to eslint (#2634)

* chore: setup eslint

* chore: tslint checks with types & check for import order

* chore: complete eslint transition

* fix: tests

* fix: linting after rebase, faster lint for lint-staged

* chore: remove line

* fix: lint rules

* feat: add a11y linter and fix errors

* fix: tests
This commit is contained in:
Vinh
2019-10-15 22:56:38 +00:00
committed by Wyatt Johnson
parent b0e0ba6633
commit 3bfcc509d2
569 changed files with 2592 additions and 1925 deletions
+3 -3
View File
@@ -21,8 +21,8 @@ export default class CommandExecutor implements Executor {
private args?: ReadonlyArray<string>;
private spawnMultiple: boolean;
private runOnInit: boolean;
private isRunning: boolean = false;
private shouldRespawn: boolean = false;
private isRunning = false;
private shouldRespawn = false;
private spawnProcessDebounced?: (() => void) & Cancelable;
constructor(cmd: string, opts: CommandExecutorOptions = {}) {
@@ -67,7 +67,7 @@ export default class CommandExecutor implements Executor {
child.on("close", (code: number) => {
this.isRunning = false;
if (code !== 0 && code !== null) {
// tslint:disable-next-line: no-console
// eslint-disable-next-line no-console
console.log(chalk.red(`Command exited with ${code}`));
}
if (this.shouldRespawn) {
+4 -4
View File
@@ -17,8 +17,8 @@ export default class LongRunningExecutor implements Executor {
private cmd: string;
private args?: ReadonlyArray<string>;
private process: ChildProcess | null = null;
private isRunning: boolean = false;
private shouldRestart: boolean = false;
private isRunning = false;
private shouldRestart = false;
private restartDebounced: (() => void) & Cancelable;
constructor(cmd: string, opts: LongRunningExecutorOptions = {}) {
@@ -37,11 +37,11 @@ export default class LongRunningExecutor implements Executor {
shell: !this.args,
});
this.process!.on("exit", (code: number) => {
this.process.on("exit", (code: number) => {
this.isRunning = false;
if (code !== 0 && code !== null) {
// tslint:disable-next-line: no-console
// eslint-disable-next-line no-console
console.log(chalk.red(`Command exited with ${code}`));
return;
}
+2 -2
View File
@@ -18,7 +18,7 @@ function canUseWatchman(): boolean {
try {
execSync("watchman --version", { stdio: ["ignore"] });
return true;
// tslint:disable-next-line:no-empty
// eslint-disable-next-line no-empty
} catch (e) {}
return false;
}
@@ -34,7 +34,7 @@ export default class SaneWatcher implements Watcher {
// Autodetect watchman.
if (this.watchman === undefined && canUseWatchman()) {
this.watchman = true;
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.log(chalk.grey(`Watchman detected`));
}
}
+2 -2
View File
@@ -14,7 +14,7 @@ async function run(
throw new Error("Config file not specified");
}
// tslint:disable-next-line:no-var-requires
// eslint-disable-next-line @typescript-eslint/no-var-requires
let config: any = require(path.resolve(configFile));
if (config.__esModule) {
config = config.default;
@@ -31,7 +31,7 @@ const cmd = program
.parse(process.argv);
run(cmd.args, cmd.opts()).catch(err => {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.error(err);
process.exit(1);
});
+4 -4
View File
@@ -21,7 +21,7 @@ async function beginWatch(
await executor.onInit();
}
for await (const filePath of watcher.watch(rootDir, paths, { ignore })) {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.log(chalk.cyanBright(`Execute "${key}"`));
executor.execute(filePath);
}
@@ -72,7 +72,7 @@ function filterOnly(
}
return pickBy(watchers, (value, key) => {
if (resolved.indexOf(key) === -1) {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.log(chalk.grey(`Disabled watcher "${key}"`));
return false;
}
@@ -98,11 +98,11 @@ export default async function watch(config: Config, options: Options = {}) {
}
for (const key of Object.keys(watchersConfigs)) {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.log(chalk.cyanBright(`Start watcher "${key}"`));
const watcherConfig = watchersConfigs[key];
beginWatch(watcher, key, watcherConfig, rootDir).catch(err => {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.error(err);
process.exit(1);
});