|
| 1 | +import * as eslint from '@eslint/js'; |
| 2 | +import tseslint from '@typescript-eslint/eslint-plugin'; |
| 3 | +import tsParser from '@typescript-eslint/parser'; |
| 4 | +import noOnlyTests from 'eslint-plugin-no-only-tests'; |
| 5 | +import prettier from 'eslint-config-prettier'; |
| 6 | + |
| 7 | +export default [ |
| 8 | + { |
| 9 | + languageOptions: { |
| 10 | + parser: tsParser, |
| 11 | + parserOptions: { |
| 12 | + ecmaVersion: 'latest', |
| 13 | + sourceType: 'module', |
| 14 | + }, |
| 15 | + globals: { |
| 16 | + ...eslint.configs.node.globals, |
| 17 | + mocha: true, |
| 18 | + }, |
| 19 | + }, |
| 20 | + plugins: { |
| 21 | + '@typescript-eslint': tseslint, |
| 22 | + 'no-only-tests': noOnlyTests, |
| 23 | + }, |
| 24 | + settings: { |
| 25 | + 'import/resolver': { |
| 26 | + node: { |
| 27 | + extensions: ['.js', '.ts'], |
| 28 | + }, |
| 29 | + }, |
| 30 | + }, |
| 31 | + rules: { |
| 32 | + ...eslint.configs.recommended.rules, |
| 33 | + ...prettier.rules, |
| 34 | + '@typescript-eslint/ban-ts-comment': [ |
| 35 | + 'error', |
| 36 | + { |
| 37 | + 'ts-ignore': 'allow-with-description', |
| 38 | + }, |
| 39 | + ], |
| 40 | + '@typescript-eslint/explicit-module-boundary-types': 'error', |
| 41 | + 'no-bitwise': 'off', |
| 42 | + 'no-dupe-class-members': 'off', |
| 43 | + '@typescript-eslint/no-dupe-class-members': 'error', |
| 44 | + 'no-empty-function': 'off', |
| 45 | + '@typescript-eslint/no-empty-function': ['error'], |
| 46 | + '@typescript-eslint/no-empty-interface': 'off', |
| 47 | + '@typescript-eslint/no-explicit-any': 'error', |
| 48 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 49 | + 'no-unused-vars': 'off', |
| 50 | + '@typescript-eslint/no-unused-vars': [ |
| 51 | + 'error', |
| 52 | + { |
| 53 | + args: 'after-used', |
| 54 | + argsIgnorePattern: '^_', |
| 55 | + }, |
| 56 | + ], |
| 57 | + 'no-use-before-define': 'off', |
| 58 | + '@typescript-eslint/no-use-before-define': [ |
| 59 | + 'error', |
| 60 | + { |
| 61 | + functions: false, |
| 62 | + }, |
| 63 | + ], |
| 64 | + 'no-useless-constructor': 'off', |
| 65 | + '@typescript-eslint/no-useless-constructor': 'error', |
| 66 | + '@typescript-eslint/no-var-requires': 'off', |
| 67 | + 'class-methods-use-this': ['error', { exceptMethods: ['dispose'] }], |
| 68 | + 'func-names': 'off', |
| 69 | + 'import/extensions': 'off', |
| 70 | + 'import/namespace': 'off', |
| 71 | + 'import/no-extraneous-dependencies': 'off', |
| 72 | + 'import/no-unresolved': [ |
| 73 | + 'error', |
| 74 | + { |
| 75 | + ignore: ['monaco-editor', 'vscode'], |
| 76 | + }, |
| 77 | + ], |
| 78 | + 'import/prefer-default-export': 'off', |
| 79 | + 'linebreak-style': 'off', |
| 80 | + 'no-await-in-loop': 'off', |
| 81 | + 'no-console': 'off', |
| 82 | + 'no-control-regex': 'off', |
| 83 | + 'no-extend-native': 'off', |
| 84 | + 'no-multi-str': 'off', |
| 85 | + 'no-shadow': 'off', |
| 86 | + 'no-param-reassign': 'off', |
| 87 | + 'no-prototype-builtins': 'off', |
| 88 | + 'no-restricted-syntax': [ |
| 89 | + 'error', |
| 90 | + { |
| 91 | + selector: 'ForInStatement', |
| 92 | + message: |
| 93 | + 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.', |
| 94 | + }, |
| 95 | + { |
| 96 | + selector: 'LabeledStatement', |
| 97 | + message: |
| 98 | + 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.', |
| 99 | + }, |
| 100 | + { |
| 101 | + selector: 'WithStatement', |
| 102 | + message: |
| 103 | + '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.', |
| 104 | + }, |
| 105 | + ], |
| 106 | + 'no-template-curly-in-string': 'off', |
| 107 | + 'no-underscore-dangle': 'off', |
| 108 | + 'no-useless-escape': 'off', |
| 109 | + 'no-void': [ |
| 110 | + 'error', |
| 111 | + { |
| 112 | + allowAsStatement: true, |
| 113 | + }, |
| 114 | + ], |
| 115 | + 'operator-assignment': 'off', |
| 116 | + strict: 'off', |
| 117 | + 'no-only-tests/no-only-tests': ['error', { block: ['test', 'suite'], focus: ['only'] }], |
| 118 | + }, |
| 119 | + }, |
| 120 | +]; |
0 commit comments