|
| 1 | +import jest from 'eslint-plugin-jest'; |
| 2 | +import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
| 3 | +import globals from 'globals'; |
| 4 | +import tsParser from '@typescript-eslint/parser'; |
| 5 | +import stylisticTypescript from '@stylistic/eslint-plugin-ts'; |
| 6 | +import github from 'eslint-plugin-github'; |
| 7 | + |
| 8 | +export default [ |
| 9 | + { |
| 10 | + ignores: ['dist/', 'lib/', 'node_modules/', 'jest.config.js'], |
| 11 | + files: ['**/*.ts'] |
| 12 | + }, |
| 13 | + ...github.getFlatConfigs().typescript, |
| 14 | + { |
| 15 | + plugins: { |
| 16 | + jest, |
| 17 | + '@typescript-eslint': typescriptEslint, |
| 18 | + '@typescript-eslint-stylistic': stylisticTypescript |
| 19 | + }, |
| 20 | + |
| 21 | + languageOptions: { |
| 22 | + globals: { |
| 23 | + ...globals.node, |
| 24 | + ...jest.environments.globals.globals, |
| 25 | + BufferEncoding: 'readonly' |
| 26 | + }, |
| 27 | + |
| 28 | + parser: tsParser, |
| 29 | + ecmaVersion: 9, |
| 30 | + sourceType: 'module', |
| 31 | + |
| 32 | + parserOptions: { |
| 33 | + project: './tsconfig.eslint.json' |
| 34 | + } |
| 35 | + }, |
| 36 | + |
| 37 | + rules: { |
| 38 | + 'i18n-text/no-en': 'off', |
| 39 | + 'eslint-comments/no-use': 'off', |
| 40 | + 'import/no-namespace': 'off', |
| 41 | + 'no-unused-vars': 'off', |
| 42 | + 'no-shadow': 'off', |
| 43 | + '@typescript-eslint/no-unused-vars': 'error', |
| 44 | + '@typescript-eslint/no-shadow': 'error', |
| 45 | + |
| 46 | + '@typescript-eslint/explicit-member-accessibility': [ |
| 47 | + 'error', |
| 48 | + { |
| 49 | + accessibility: 'no-public' |
| 50 | + } |
| 51 | + ], |
| 52 | + |
| 53 | + '@typescript-eslint/no-require-imports': 'error', |
| 54 | + '@typescript-eslint/array-type': 'error', |
| 55 | + '@typescript-eslint/await-thenable': 'error', |
| 56 | + '@typescript-eslint/ban-ts-comment': 'error', |
| 57 | + camelcase: 'off', |
| 58 | + '@typescript-eslint/consistent-type-assertions': 'error', |
| 59 | + |
| 60 | + '@typescript-eslint/explicit-function-return-type': [ |
| 61 | + 'error', |
| 62 | + { |
| 63 | + allowExpressions: true |
| 64 | + } |
| 65 | + ], |
| 66 | + |
| 67 | + '@typescript-eslint-stylistic/func-call-spacing': ['error', 'never'], |
| 68 | + '@typescript-eslint/no-array-constructor': 'error', |
| 69 | + '@typescript-eslint/no-empty-interface': 'error', |
| 70 | + '@typescript-eslint/no-explicit-any': 'error', |
| 71 | + '@typescript-eslint/no-extraneous-class': 'error', |
| 72 | + '@typescript-eslint/no-for-in-array': 'error', |
| 73 | + '@typescript-eslint/no-inferrable-types': 'error', |
| 74 | + '@typescript-eslint/no-misused-new': 'error', |
| 75 | + '@typescript-eslint/no-namespace': 'error', |
| 76 | + '@typescript-eslint/no-non-null-assertion': 'warn', |
| 77 | + '@typescript-eslint/no-unnecessary-qualifier': 'error', |
| 78 | + '@typescript-eslint/no-unnecessary-type-assertion': 'error', |
| 79 | + '@typescript-eslint/no-useless-constructor': 'error', |
| 80 | + '@typescript-eslint/no-var-requires': 'error', |
| 81 | + '@typescript-eslint/prefer-for-of': 'warn', |
| 82 | + '@typescript-eslint/prefer-function-type': 'warn', |
| 83 | + '@typescript-eslint/prefer-includes': 'error', |
| 84 | + '@typescript-eslint/prefer-string-starts-ends-with': 'error', |
| 85 | + '@typescript-eslint/promise-function-async': 'error', |
| 86 | + '@typescript-eslint/require-array-sort-compare': 'error', |
| 87 | + '@typescript-eslint/restrict-plus-operands': 'error', |
| 88 | + semi: 'error', |
| 89 | + '@typescript-eslint-stylistic/semi': ['error', 'always'], |
| 90 | + '@typescript-eslint-stylistic/type-annotation-spacing': 'error', |
| 91 | + '@typescript-eslint/unbound-method': 'error', |
| 92 | + '@typescript-eslint/return-await': ['error', 'always'], |
| 93 | + 'sort-imports': 'error', |
| 94 | + 'sort-keys': 'error', |
| 95 | + 'no-restricted-imports': ['error', 'fs'], |
| 96 | + 'no-return-await': 'off' |
| 97 | + } |
| 98 | + } |
| 99 | +]; |
0 commit comments