|
1 |
| -module.exports = { |
2 |
| - parser: '@typescript-eslint/parser', |
3 |
| - env: { |
4 |
| - browser: true, |
5 |
| - node: true, |
6 |
| - commonjs: true, |
7 |
| - es6: true, |
| 1 | +// Importing necessary ESLint plugins |
| 2 | +import typescriptEslint from 'typescript-eslint'; |
| 3 | +import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests'; |
| 4 | +import headerPlugin from 'eslint-plugin-header'; |
| 5 | +import jsdocPlugin from 'eslint-plugin-jsdoc'; |
| 6 | +import preferArrowPlugin from 'eslint-plugin-prefer-arrow'; |
| 7 | +import importPlugin from 'eslint-plugin-import'; |
| 8 | +import noNullPlugin from 'eslint-plugin-no-null'; |
| 9 | +import localRulesPlugin from 'eslint-plugin-local-rules'; |
| 10 | +import globals from 'globals'; |
| 11 | +import eslintConfigPrettier from 'eslint-config-prettier'; |
| 12 | +import pluginJs from '@eslint/js'; |
| 13 | + |
| 14 | +const commonConfig = { |
| 15 | + plugins: { |
| 16 | + '@typescript-eslint': typescriptEslint.plugin, |
| 17 | + 'no-only-tests': noOnlyTestsPlugin, |
| 18 | + header: headerPlugin, |
| 19 | + jsdoc: jsdocPlugin, |
| 20 | + 'prefer-arrow': preferArrowPlugin, |
| 21 | + import: importPlugin, |
| 22 | + 'no-null': noNullPlugin, |
| 23 | + 'local-rules': localRulesPlugin, |
8 | 24 | },
|
9 |
| - globals: { |
10 |
| - $: false, |
11 |
| - chrome: false, |
12 |
| - OpenPGP: false, |
13 |
| - }, |
14 |
| - extends: ['eslint:recommended', 'plugin:@typescript-eslint/strict', 'plugin:@typescript-eslint/stylistic', 'prettier'], |
15 |
| - ignorePatterns: ['.eslintrc.js'], |
16 |
| - parserOptions: { |
17 |
| - project: 'tsconfig.json', |
| 25 | + languageOptions: { |
| 26 | + parser: typescriptEslint.parser, |
18 | 27 | sourceType: 'module',
|
| 28 | + ecmaVersion: 'latest', |
| 29 | + globals: { |
| 30 | + ...globals.browser, |
| 31 | + ...globals.node, |
| 32 | + ...globals.commonjs, |
| 33 | + ...globals.es6, |
| 34 | + $: false, |
| 35 | + chrome: false, |
| 36 | + OpenPGP: false, |
| 37 | + }, |
19 | 38 | },
|
20 |
| - plugins: [ |
21 |
| - 'no-only-tests', |
22 |
| - 'header', |
23 |
| - 'eslint-plugin-jsdoc', |
24 |
| - 'eslint-plugin-prefer-arrow', |
25 |
| - 'eslint-plugin-import', |
26 |
| - 'eslint-plugin-no-null', |
27 |
| - 'eslint-plugin-local-rules', |
28 |
| - '@typescript-eslint', |
29 |
| - ], |
30 |
| - root: true, |
31 | 39 | rules: {
|
32 | 40 | '@typescript-eslint/consistent-indexed-object-style': 'off',
|
33 | 41 | '@typescript-eslint/consistent-type-assertions': 'error',
|
@@ -84,6 +92,14 @@ module.exports = {
|
84 | 92 | '@typescript-eslint/no-parameter-properties': 'off',
|
85 | 93 | '@typescript-eslint/no-shadow': 'off',
|
86 | 94 | '@typescript-eslint/no-unsafe-return': 'error',
|
| 95 | + '@typescript-eslint/prefer-nullish-coalescing': 'off', |
| 96 | + '@typescript-eslint/no-unnecessary-condition': 'off', |
| 97 | + '@typescript-eslint/restrict-template-expressions': 'off', |
| 98 | + '@typescript-eslint/restrict-plus-operands': 'off', |
| 99 | + '@typescript-eslint/require-await': 'off', |
| 100 | + '@typescript-eslint/no-confusing-void-expression': 'off', |
| 101 | + '@typescript-eslint/no-misused-promises': 'off', |
| 102 | + '@typescript-eslint/no-redundant-type-constituents': 'off', |
87 | 103 | '@typescript-eslint/no-unused-vars': ['error'],
|
88 | 104 | '@typescript-eslint/no-unused-expressions': 'error',
|
89 | 105 | '@typescript-eslint/no-use-before-define': 'off',
|
@@ -156,13 +172,60 @@ module.exports = {
|
156 | 172 | ],
|
157 | 173 | 'local-rules/standard-loops': 'error',
|
158 | 174 | },
|
159 |
| - overrides: [ |
160 |
| - { |
161 |
| - files: './test/**/*.ts', |
162 |
| - rules: { |
163 |
| - '@typescript-eslint/no-unused-expressions': 'off', |
164 |
| - '@typescript-eslint/no-non-null-assertion': 'off', |
| 175 | +}; |
| 176 | + |
| 177 | +export default [ |
| 178 | + { |
| 179 | + ignores: ['extension/types/**', 'extension/js/common/core/types/**', 'test/source/core/types/**', 'build/**', 'extension/lib/**', 'eslint.config.js'], |
| 180 | + }, |
| 181 | + pluginJs.configs.recommended, |
| 182 | + ...typescriptEslint.configs.strictTypeChecked, |
| 183 | + ...typescriptEslint.configs.stylisticTypeChecked, |
| 184 | + eslintConfigPrettier, |
| 185 | + { |
| 186 | + ...commonConfig, |
| 187 | + files: ['extension/**/*.ts'], |
| 188 | + languageOptions: { |
| 189 | + ...commonConfig.languageOptions, |
| 190 | + parserOptions: { |
| 191 | + project: './tsconfig.json', |
165 | 192 | },
|
166 | 193 | },
|
167 |
| - ], |
168 |
| -}; |
| 194 | + }, |
| 195 | + { |
| 196 | + ...commonConfig, |
| 197 | + files: ['tooling/**/*.ts'], |
| 198 | + languageOptions: { |
| 199 | + ...commonConfig.languageOptions, |
| 200 | + parserOptions: { |
| 201 | + project: './conf/tsconfig.tooling.json', |
| 202 | + }, |
| 203 | + }, |
| 204 | + }, |
| 205 | + { |
| 206 | + ...commonConfig, |
| 207 | + files: ['test/**/*.ts'], |
| 208 | + languageOptions: { |
| 209 | + ...commonConfig.languageOptions, |
| 210 | + parserOptions: { |
| 211 | + project: './conf/tsconfig.test.eslint.json', |
| 212 | + }, |
| 213 | + }, |
| 214 | + rules: { |
| 215 | + ...commonConfig.rules, |
| 216 | + '@typescript-eslint/no-unused-expressions': 'off', |
| 217 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 218 | + '@typescript-eslint/no-unsafe-assignment': 'off', |
| 219 | + '@typescript-eslint/no-unsafe-call': 'off', |
| 220 | + '@typescript-eslint/no-unsafe-member-access': 'off', |
| 221 | + }, |
| 222 | + }, |
| 223 | + ...typescriptEslint.config({ |
| 224 | + files: ['extension/js/content_scripts/webmail/**/*.ts'], |
| 225 | + languageOptions: { |
| 226 | + parserOptions: { |
| 227 | + project: './conf/tsconfig.content_scripts.json', |
| 228 | + }, |
| 229 | + }, |
| 230 | + }), |
| 231 | +]; |
0 commit comments