Skip to content

Commit bb28daf

Browse files
committed
lint: Add proper linting for react
1 parent db6aadb commit bb28daf

File tree

13 files changed

+214
-45
lines changed

13 files changed

+214
-45
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 151 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configs/typescript-config/common.tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@
2727
"../../test",
2828
"../../**/view"
2929
]
30-
}
30+
}

extensions/ql-vscode/.eslintrc.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ module.exports = {
33
parserOptions: {
44
ecmaVersion: 2018,
55
sourceType: 'module',
6-
ecmaFeatures: {
7-
modules: true,
8-
},
96
project: ['tsconfig.json', './src/**/tsconfig.json'],
107
},
118
plugins: ['@typescript-eslint'],
@@ -33,6 +30,7 @@ module.exports = {
3330
"SwitchCase": 1,
3431
"FunctionDeclaration": { "body": 1, "parameters": 1 }
3532
}],
36-
"@typescript-eslint/no-throw-literal": "error"
33+
"@typescript-eslint/no-throw-literal": "error",
34+
"no-useless-escape": 0
3735
},
3836
};

extensions/ql-vscode/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@
389389
"update-vscode": "node ./node_modules/vscode/bin/install",
390390
"postinstall": "node ./node_modules/vscode/bin/install",
391391
"format": "tsfmt -r",
392-
"lint": "eslint . --ext .ts,.tsx"
392+
"lint": "eslint src test --ext .ts,.tsx"
393393
},
394394
"dependencies": {
395395
"child-process-promise": "^2.2.1",
@@ -465,6 +465,7 @@
465465
"sinon-chai": "~3.5.0",
466466
"@types/sinon-chai": "~3.2.3",
467467
"proxyquire": "~2.1.3",
468-
"@types/proxyquire": "~1.3.28"
468+
"@types/proxyquire": "~1.3.28",
469+
"eslint-plugin-react": "~7.19.0"
469470
}
470471
}

extensions/ql-vscode/src/databases.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -430,21 +430,23 @@ class DatabaseItemImpl implements DatabaseItem {
430430
*/
431431
function eventFired<T>(event: vscode.Event<T>, timeoutMs = 1000): Promise<T | undefined> {
432432
return new Promise((res, _rej) => {
433-
let timeout: NodeJS.Timeout | undefined;
434-
let disposable: vscode.Disposable | undefined;
435-
function dispose() {
436-
if (timeout !== undefined) clearTimeout(timeout);
437-
if (disposable !== undefined) disposable.dispose();
438-
}
439-
disposable = event(e => {
440-
res(e);
441-
dispose();
442-
});
443-
timeout = setTimeout(() => {
433+
const timeout = setTimeout(() => {
444434
logger.log(`Waiting for event ${event} timed out after ${timeoutMs}ms`);
445435
res(undefined);
446436
dispose();
447437
}, timeoutMs);
438+
const disposable = event(e => {
439+
res(e);
440+
dispose();
441+
});
442+
function dispose() {
443+
if (timeout !== undefined) {
444+
clearTimeout(timeout);
445+
}
446+
if (disposable !== undefined) {
447+
disposable.dispose();
448+
}
449+
}
448450
});
449451
}
450452

extensions/ql-vscode/src/qltest-discovery.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class QLTestDirectory extends QLTestNode {
6464
private createChildDirectory(name: string): QLTestDirectory {
6565
const existingChild = this._children.find((child) => child.name === name);
6666
if (existingChild !== undefined) {
67-
return <QLTestDirectory>existingChild;
67+
return existingChild as QLTestDirectory;
6868
}
6969
else {
7070
const newChild = new QLTestDirectory(path.join(this.path, name), name);
@@ -87,6 +87,7 @@ export class QLTestFile extends QLTestNode {
8787
}
8888

8989
public finish(): void {
90+
/**/
9091
}
9192
}
9293

0 commit comments

Comments
 (0)