Skip to content

Commit ab8dc28

Browse files
authored
Revert "Fix eslint in vscode (#1099)" (#1105)
This reverts commit c437255. This fixes Windows CI: [2021/09/13 10:44:59.161] > npm run lint [2021/09/13 10:44:59.161] > @mongosh/[email protected] lint C:\data\mci\abacfdf08bad6c5c588fc6f7d2007707\src\packages\errors [2021/09/13 10:44:59.161] > eslint --report-unused-disable-directives "./{src,test}/**/*.{js,ts,tsx}" [2021/09/13 10:44:59.161] C:\data\mci\abacfdf08bad6c5c588fc6f7d2007707\src\packages\errors\src\common-errors.ts [2021/09/13 10:44:59.161] 0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. [2021/09/13 10:44:59.161] The file does not match your project config: C:\data\mci\abacfdf08bad6c5c588fc6f7d2007707\src\packages\errors\src\common-errors.ts. [2021/09/13 10:44:59.161] The file must be included in at least one of the projects provided [2021/09/13 10:44:59.161] C:\data\mci\abacfdf08bad6c5c588fc6f7d2007707\src\packages\errors\src\index.spec.ts [2021/09/13 10:44:59.161] 0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. [2021/09/13 10:44:59.161] The file does not match your project config: C:\data\mci\abacfdf08bad6c5c588fc6f7d2007707\src\packages\errors\src\index.spec.ts. [2021/09/13 10:44:59.161] The file must be included in at least one of the projects provided [2021/09/13 10:44:59.161] C:\data\mci\abacfdf08bad6c5c588fc6f7d2007707\src\packages\errors\src\index.ts [2021/09/13 10:44:59.161] 0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. [2021/09/13 10:44:59.161] The file does not match your project config: C:\data\mci\abacfdf08bad6c5c588fc6f7d2007707\src\packages\errors\src\index.ts. [2021/09/13 10:44:59.161] The file must be included in at least one of the projects provided [2021/09/13 10:44:59.161] ✖ 3 problems (3 errors, 0 warnings) [2021/09/13 10:44:59.161] lerna ERR! npm run check stderr: [2021/09/13 10:44:59.161] npm ERR! code ELIFECYCLE [2021/09/13 10:44:59.161] npm ERR! errno 1 [2021/09/13 10:44:59.161] npm ERR! @mongosh/[email protected] lint: `eslint --report-unused-disable-directives "./{src,test}/**/*.{js,ts,tsx}"`
1 parent 4d56d07 commit ab8dc28

File tree

18 files changed

+57
-180
lines changed

18 files changed

+57
-180
lines changed

config/eslintrc.base.js

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,49 @@
1-
const jsRules = {
2-
'object-curly-spacing': [2, 'always'],
3-
'no-empty-function': 0,
4-
'valid-jsdoc': 0,
5-
'react/sort-comp': 0, // does not seem work as expected with typescript
6-
'mocha/no-skipped-tests': 1,
7-
'mocha/no-exclusive-tests': 2,
8-
'semi': [2, 'always'],
9-
'no-console': [1, { allow: ['warn', 'error', 'info'] }],
10-
'no-shadow': 0,
11-
'no-use-before-define': 0,
12-
'no-cond-assign': [2, 'except-parens']
13-
}
1+
const typescriptEslintEslintPlugin = require('@typescript-eslint/eslint-plugin');
142

15-
const tsRules = {
16-
'@typescript-eslint/no-empty-function': 0,
17-
'@typescript-eslint/no-use-before-define': 0,
18-
'@typescript-eslint/no-explicit-any': 0,
19-
'@typescript-eslint/no-var-requires': 0, // seems necessary to import less files
20-
'@typescript-eslint/no-unused-vars': 2,
21-
'@typescript-eslint/no-floating-promises': 2,
22-
'@typescript-eslint/await-thenable': 2,
23-
'@typescript-eslint/require-await': 2,
24-
'@typescript-eslint/explicit-module-boundary-types': 0,
25-
'@typescript-eslint/ban-types': 0,
26-
'semi': 0,
27-
'@typescript-eslint/semi': [2, 'always']
28-
};
3+
// ovrerrides do not work with extends
4+
const ruleOverridesForJs = Object.keys(typescriptEslintEslintPlugin.rules).reduce(
5+
(overrides, rule) => ({ ...overrides, [`@typescript-eslint/${rule}`]: 0 }), {}
6+
);
297

308
module.exports = {
319
plugins: ['mocha'],
32-
overrides: [{
33-
files: ['**/*.js', '**/*.jsx'],
34-
extends: [
35-
'eslint-config-mongodb-js/react'
36-
],
37-
rules: {
38-
...jsRules
39-
}
10+
parser: '@typescript-eslint/parser',
11+
parserOptions: {
12+
project: './tsconfig.lint.json'
13+
},
14+
extends: [
15+
'eslint-config-mongodb-js/react',
16+
'plugin:@typescript-eslint/recommended'
17+
],
18+
rules: {
19+
'object-curly-spacing': [2, 'always'],
20+
'no-empty-function': 0,
21+
'valid-jsdoc': 0,
22+
'react/sort-comp': 0, // does not seem work as expected with typescript
23+
'@typescript-eslint/no-empty-function': 0,
24+
'@typescript-eslint/no-use-before-define': 0,
25+
'@typescript-eslint/no-explicit-any': 0,
26+
'@typescript-eslint/no-var-requires': 0, // seems necessary to import less files
27+
'@typescript-eslint/no-unused-vars': 2,
28+
'@typescript-eslint/no-floating-promises': 2,
29+
'@typescript-eslint/await-thenable': 2,
30+
'@typescript-eslint/require-await': 2,
31+
'@typescript-eslint/explicit-module-boundary-types': 0,
32+
'@typescript-eslint/ban-types': 0,
33+
'mocha/no-skipped-tests': 1,
34+
'mocha/no-exclusive-tests': 2,
35+
'semi': 0,
36+
'@typescript-eslint/semi': [2, 'always'],
37+
'no-console': [1, { allow: ['warn', 'error', 'info'] }],
38+
'no-shadow': 0,
39+
'no-use-before-define': 0,
40+
'no-cond-assign': [2, 'except-parens']
4041
},
41-
{
42-
files: ['**/*.ts', '**/*.tsx'],
43-
parser: '@typescript-eslint/parser',
44-
extends: [
45-
'eslint-config-mongodb-js/react',
46-
'plugin:@typescript-eslint/recommended'
47-
],
42+
overrides: [{
43+
files: ['**/*.js'],
4844
rules: {
49-
...jsRules,
50-
...tsRules
45+
...ruleOverridesForJs,
46+
semi: [2, 'always']
5147
}
5248
}]
5349
};
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
module.exports = {
2-
...require('../../config/eslintrc.base'),
3-
root: true,
4-
parserOptions: {
5-
tsconfigRootDir: __dirname,
6-
project: './tsconfig.lint.json'
7-
}
8-
};
1+
module.exports = require('../../config/eslintrc.base');

packages/autocomplete/.eslintrc.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
module.exports = {
2-
...require('../../config/eslintrc.base'),
3-
root: true,
4-
parserOptions: {
5-
tsconfigRootDir: __dirname,
6-
project: './tsconfig.lint.json'
7-
}
8-
};
1+
module.exports = require('../../config/eslintrc.base');

packages/browser-repl/.eslintrc.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
module.exports = {
2-
...require('../../config/eslintrc.base'),
3-
root: true,
4-
parserOptions: {
5-
tsconfigRootDir: __dirname,
6-
project: './tsconfig.lint.json'
7-
}
8-
};
1+
module.exports = require('../../config/eslintrc.base');
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
module.exports = {
2-
...require('../../config/eslintrc.base'),
3-
root: true,
4-
parserOptions: {
5-
tsconfigRootDir: __dirname,
6-
project: './tsconfig.lint.json'
7-
}
8-
};
1+
module.exports = require('../../config/eslintrc.base');
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
module.exports = {
2-
...require('../../config/eslintrc.base'),
3-
root: true,
4-
parserOptions: {
5-
tsconfigRootDir: __dirname,
6-
project: './tsconfig.lint.json'
7-
}
8-
};
1+
module.exports = require('../../config/eslintrc.base');

packages/build/.eslintrc.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
module.exports = {
2-
...require('../../config/eslintrc.base'),
3-
root: true,
4-
parserOptions: {
5-
tsconfigRootDir: __dirname,
6-
project: './tsconfig.lint.json'
7-
}
8-
};
1+
module.exports = require('../../config/eslintrc.base');

packages/cli-repl/.eslintrc.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
module.exports = {
2-
...require('../../config/eslintrc.base'),
3-
root: true,
4-
parserOptions: {
5-
tsconfigRootDir: __dirname,
6-
project: './tsconfig.lint.json'
7-
}
8-
};
1+
module.exports = require('../../config/eslintrc.base');

packages/errors/.eslintrc.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
module.exports = {
2-
...require('../../config/eslintrc.base'),
3-
root: true,
4-
parserOptions: {
5-
tsconfigRootDir: __dirname,
6-
project: './tsconfig.lint.json'
7-
}
8-
};
1+
module.exports = require('../../config/eslintrc.base');

packages/history/.eslintrc.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
module.exports = {
2-
...require('../../config/eslintrc.base'),
3-
root: true,
4-
parserOptions: {
5-
tsconfigRootDir: __dirname,
6-
project: './tsconfig.lint.json'
7-
}
8-
};
1+
module.exports = require('../../config/eslintrc.base');

0 commit comments

Comments
 (0)