|
1 | 1 | module.exports = { |
| 2 | + root: true, |
2 | 3 | env: { |
3 | 4 | es6: true, |
4 | 5 | node: true, |
5 | 6 | browser: true, |
6 | | - jest: true, |
7 | 7 | }, |
8 | 8 | globals: { |
9 | 9 | Atomics: 'readonly', |
10 | 10 | SharedArrayBuffer: 'readonly', |
11 | 11 | }, |
12 | | - settings: { |
13 | | - 'import/parsers': { |
14 | | - '@babel/eslint-parser': ['.js'], |
15 | | - '@typescript-eslint/parser': ['.ts'], |
16 | | - }, |
17 | | - 'import/resolver': { |
18 | | - node: true, |
19 | | - 'eslint-import-resolver-typescript': true, |
20 | | - }, |
21 | | - }, |
22 | | - parser: '@babel/eslint-parser', |
23 | | - parserOptions: { |
24 | | - sourceType: 'module', |
25 | | - babelOptions: { |
26 | | - // configuration for @babel/eslint-parser |
27 | | - configFile: './babel.config.js', |
28 | | - }, |
29 | | - // configuration for @typescript-eslint |
30 | | - project: 'tsconfig.json', |
| 12 | + parser: '@typescript-eslint/parser', |
| 13 | + plugins: ['@typescript-eslint', 'prettier'], |
| 14 | + extends: [ |
| 15 | + 'eslint:recommended', |
| 16 | + 'plugin:@typescript-eslint/eslint-recommended', |
| 17 | + 'plugin:@typescript-eslint/recommended', |
| 18 | + 'prettier', |
| 19 | + 'plugin:prettier/recommended', |
| 20 | + ], |
| 21 | + rules: { |
| 22 | + 'prettier/prettier': 'error', |
| 23 | + // too many tests to fix, disable for now |
| 24 | + '@typescript-eslint/ban-types': 'off', |
| 25 | + // customize argument ignore pattern |
| 26 | + 'no-unused-vars': 'off', |
| 27 | + '@typescript-eslint/no-unused-vars': ['error', {argsIgnorePattern: '^_'}], |
31 | 28 | }, |
32 | 29 | overrides: [ |
33 | | - // linting setup for JS files. |
34 | 30 | { |
35 | | - files: '**/*.js', |
36 | | - parser: '@babel/eslint-parser', |
37 | | - plugins: ['@babel', 'flowtype', 'prettier', 'import'], |
38 | | - extends: ['airbnb-base', 'plugin:flowtype/recommended', 'prettier', 'plugin:prettier/recommended'], |
| 31 | + files: ['**/__tests__/**/*.ts', '**/*.test.ts', '**/*.spec.ts'], |
| 32 | + env: { |
| 33 | + jest: true, |
| 34 | + 'jest/globals': true, |
| 35 | + }, |
| 36 | + plugins: ['jest'], |
| 37 | + extends: ['plugin:jest/recommended'], |
39 | 38 | rules: { |
40 | | - 'prettier/prettier': ['error', {endOfLine: 'auto'}], |
41 | | - 'no-underscore-dangle': 'off', |
42 | | - camelcase: 'off', |
43 | | - 'no-param-reassign': ['error', {props: false}], |
44 | | - 'import/extensions': [0, 'never', {ts: 'never'}], |
45 | | - 'import/named': 'off', |
46 | | - 'import/namespace': 'off', |
47 | | - 'import/default': 'off', |
48 | | - 'import/no-named-as-default-member': 'off', |
49 | | - 'import/no-named-as-default': 'off', |
50 | | - 'max-classes-per-file': 'off', |
51 | | - 'prefer-object-spread': 'off', |
| 39 | + // Test-specific rules |
| 40 | + 'no-empty-function': 'off', |
| 41 | + 'no-unused-expressions': 'off', |
| 42 | + // jest specific |
| 43 | + 'jest/no-conditional-expect': 'off', |
| 44 | + // Any other rule adjustments for test files |
| 45 | + '@typescript-eslint/no-empty-function': 'off', |
| 46 | + '@typescript-eslint/no-explicit-any': 'off', |
| 47 | + '@typescript-eslint/no-unsafe-call': 'off', |
| 48 | + '@typescript-eslint/no-unsafe-member-access': 'off', |
| 49 | + '@typescript-eslint/no-unsafe-assignment': 'off', |
52 | 50 | }, |
53 | 51 | }, |
54 | | - // linting setup for TS files. |
55 | 52 | { |
56 | | - files: '**/*.ts', |
57 | | - plugins: ['@babel', 'prettier', 'import', '@typescript-eslint'], |
58 | | - extends: [ |
59 | | - 'airbnb-typescript/base', |
60 | | - 'plugin:@typescript-eslint/eslint-recommended', |
61 | | - 'plugin:@typescript-eslint/recommended', |
62 | | - 'plugin:@typescript-eslint/recommended-requiring-type-checking', |
63 | | - 'prettier', |
64 | | - 'plugin:prettier/recommended', |
65 | | - ], |
| 53 | + files: ['src/**/*.ts'], |
66 | 54 | rules: { |
67 | | - 'prettier/prettier': ['error', {endOfLine: 'auto'}], |
68 | | - 'no-underscore-dangle': 'off', |
69 | | - camelcase: 'off', |
70 | | - 'no-param-reassign': ['error', {props: false}], |
71 | | - 'import/extensions': [0, 'never', {ts: 'never'}], |
72 | | - 'import/named': 'off', |
73 | | - 'import/namespace': 'off', |
74 | | - 'import/default': 'off', |
75 | | - 'import/no-named-as-default-member': 'off', |
76 | | - 'import/no-named-as-default': 'off', |
77 | | - 'max-classes-per-file': 'off', |
78 | | - // TS specific |
79 | | - '@typescript-eslint/explicit-function-return-type': 'off', |
80 | | - '@typescript-eslint/prefer-regexp-exec': 'off', |
81 | | - '@typescript-eslint/array-type': [ |
82 | | - 'error', |
83 | | - { |
84 | | - default: 'array', |
85 | | - readonly: 'array', |
86 | | - }, |
87 | | - ], |
| 55 | + // Source file specific rules |
88 | 56 | }, |
89 | 57 | }, |
90 | 58 | ], |
|
0 commit comments