|
1 | 1 | 'use strict';
|
2 |
| -const tsConfigurations = [ |
3 |
| - 'eslint:recommended', |
4 |
| - 'plugin:@typescript-eslint/recommended', |
5 |
| - 'plugin:@typescript-eslint/recommended-requiring-type-checking', |
6 |
| -]; |
7 | 2 |
|
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'); |
35 | 5 |
|
36 | 6 | 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, |
43 | 13 | },
|
44 |
| - env: { node: true, es6: true }, |
45 | 14 | overrides: [
|
46 | 15 | {
|
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, |
51 | 26 | },
|
52 | 27 | {
|
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, |
60 | 29 | },
|
61 | 30 | ],
|
62 | 31 | settings: {
|
63 |
| - react: { |
64 |
| - version: 'detect', |
65 |
| - }, |
| 32 | + ...shared.settings, |
| 33 | + }, |
| 34 | + parserOptions: { |
| 35 | + tsconfigRootDir: __dirname, |
| 36 | + project: ['./tsconfig-lint.json'], |
66 | 37 | },
|
67 | 38 | };
|
0 commit comments