Skip to content

Commit deb8619

Browse files
authored
use shared eslint config (#123)
1 parent 56dbebb commit deb8619

File tree

7 files changed

+12657
-9427
lines changed

7 files changed

+12657
-9427
lines changed

.depcheckrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
ignores:
2+
- '@mongodb-js/eslint-config-devtools'
23
- '@mongodb-js/prettier-config-compass'
34
- '@mongodb-js/tsconfig-compass'
5+
- '@typescript-eslint/eslint-plugin'
6+
- '@typescript-eslint/parser'
7+
- 'eslint-plugin-mocha'
48
- '@types/chai'
59
- '@types/node'
610
- '@types/sinon-chai'
711
- 'sinon'
812
- 'node-fetch'
913
- 'rimraf'
1014
- 'process-on-spawn'
15+
1116
ignore-patterns:
1217
- 'dist'
18+
- .eslintrc.js

.eslintrc.js

Lines changed: 24 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,38 @@
11
'use strict';
2-
const tsConfigurations = [
3-
'eslint:recommended',
4-
'plugin:@typescript-eslint/recommended',
5-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
6-
];
72

8-
const tsRules = {
9-
'@typescript-eslint/no-unused-vars': 'error',
10-
'@typescript-eslint/no-unsafe-assignment': 'off',
11-
'@typescript-eslint/no-unsafe-call': 'off',
12-
'@typescript-eslint/no-unsafe-member-access': 'off',
13-
'@typescript-eslint/no-unsafe-return': 'off',
14-
'@typescript-eslint/consistent-type-imports': [
15-
'error',
16-
{ prefer: 'type-imports' },
17-
],
18-
// Newly converted plugins use `any` quite a lot, we can't enable the rule,
19-
// but we can warn so we can eventually address this
20-
'@typescript-eslint/no-unsafe-argument': 'warn',
21-
'no-console': 'warn',
22-
};
23-
24-
const testConfigurations = ['plugin:mocha/recommended'];
25-
26-
const testRules = {
27-
'mocha/no-exclusive-tests': 'error',
28-
'mocha/no-hooks-for-single-case': 'off',
29-
'mocha/no-setup-in-describe': 'off',
30-
'@typescript-eslint/no-explicit-any': 'off',
31-
'@typescript-eslint/no-empty-function': 'off',
32-
'@typescript-eslint/no-unsafe-argument': 'off',
33-
'@typescript-eslint/restrict-template-expressions': 'off',
34-
};
3+
const shared = require('@mongodb-js/eslint-config-devtools');
4+
const common = require('@mongodb-js/eslint-config-devtools/common');
355

366
module.exports = {
37-
plugins: ['@typescript-eslint', 'mocha'],
38-
root: true,
39-
parserOptions: {
40-
tsconfigRootDir: __dirname,
41-
project: ['./tsconfig-lint.json'],
42-
ecmaVersion: 'latest',
7+
plugins: [...shared.plugins],
8+
rules: {
9+
...shared.rules,
10+
},
11+
env: {
12+
...shared.env,
4313
},
44-
env: { node: true, es6: true },
4514
overrides: [
4615
{
47-
files: ['**/*.ts'],
48-
parser: '@typescript-eslint/parser',
49-
extends: [...tsConfigurations, 'prettier'],
50-
rules: { ...tsRules },
16+
...common.jsOverrides,
17+
},
18+
{
19+
...common.jsxOverrides,
20+
},
21+
{
22+
...common.tsOverrides,
23+
},
24+
{
25+
...common.tsxOverrides,
5126
},
5227
{
53-
files: ['**/*.spec.ts', '**/*.test.ts'],
54-
env: { mocha: true },
55-
extends: [...testConfigurations],
56-
rules: {
57-
...testRules,
58-
'@mongodb-js/compass/unique-mongodb-log-id': 'off',
59-
},
28+
...common.testOverrides,
6029
},
6130
],
6231
settings: {
63-
react: {
64-
version: 'detect',
65-
},
32+
...shared.settings,
33+
},
34+
parserOptions: {
35+
tsconfigRootDir: __dirname,
36+
project: ['./tsconfig-lint.json'],
6637
},
6738
};

0 commit comments

Comments
 (0)