|
| 1 | +/* eslint-env node */ |
| 2 | +/** @type {import('eslint').Linter.Config} */ |
1 | 3 | module.exports = {
|
2 |
| - "env": { |
3 |
| - "browser": true, |
4 |
| - "es6": true, |
5 |
| - "webextensions": true |
| 4 | + parser: "@typescript-eslint/parser", |
| 5 | + env: { |
| 6 | + browser: true, |
| 7 | + commonjs: true, |
| 8 | + es2017: true, |
| 9 | + }, |
| 10 | + extends: [ |
| 11 | + "eslint:recommended", |
| 12 | + "plugin:@typescript-eslint/eslint-recommended", |
| 13 | + "prettier" |
| 14 | + ], |
| 15 | + plugins: ["@typescript-eslint"], |
| 16 | + parserOptions: { |
| 17 | + project: ["./tsconfig.eslint.json"], |
| 18 | + tsconfigRootDir: __dirname, |
| 19 | + }, |
| 20 | + root: true, |
| 21 | + rules: { |
| 22 | + /* start stylistic rules */ |
| 23 | + "@typescript-eslint/adjacent-overload-signatures": "error", |
| 24 | + "@typescript-eslint/array-type": "error", |
| 25 | + "@typescript-eslint/consistent-type-imports": [ |
| 26 | + "error", |
| 27 | + { |
| 28 | + fixStyle: "inline-type-imports", |
| 29 | + }, |
| 30 | + ], |
| 31 | + "@typescript-eslint/consistent-type-exports": "error", |
| 32 | + "@typescript-eslint/prefer-readonly": "warn", |
| 33 | + "@typescript-eslint/class-literal-property-style": ["warn", "getters"], |
| 34 | + "@typescript-eslint/consistent-generic-constructors": "error", |
| 35 | + "@typescript-eslint/consistent-type-assertions": "error", |
| 36 | + "@typescript-eslint/no-confusing-non-null-assertion": "warn", |
| 37 | + "@typescript-eslint/no-inferrable-types": "warn", |
| 38 | + "@typescript-eslint/non-nullable-type-assertion-style": "warn", |
| 39 | + "@typescript-eslint/prefer-for-of": "warn", |
| 40 | + // "@typescript-eslint/prefer-nullish-coalescing": "warn", |
| 41 | + "@typescript-eslint/prefer-optional-chain": "warn", |
| 42 | + "@typescript-eslint/prefer-string-starts-ends-with": "error", |
| 43 | + "@typescript-eslint/no-meaningless-void-operator": "error", |
| 44 | + "@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn", |
| 45 | + "@typescript-eslint/no-unnecessary-condition": "warn", |
| 46 | + "@typescript-eslint/no-unnecessary-qualifier": "warn", |
| 47 | + "@typescript-eslint/no-unnecessary-type-arguments": "warn", |
| 48 | + "@typescript-eslint/prefer-reduce-type-parameter": "warn", |
| 49 | + "@typescript-eslint/promise-function-async": "warn", |
| 50 | + /* end stylistic rules */ |
| 51 | + |
| 52 | + /* start recommended rules */ |
| 53 | + "no-restricted-globals": [2, "event", "error"], |
| 54 | + "@typescript-eslint/no-base-to-string": "warn", |
| 55 | + "@typescript-eslint/no-duplicate-enum-values": "error", |
| 56 | + "@typescript-eslint/no-duplicate-type-constituents": "warn", |
| 57 | + "@typescript-eslint/no-explicit-any": "error", |
| 58 | + "@typescript-eslint/no-extra-non-null-assertion": "error", |
| 59 | + "@typescript-eslint/no-floating-promises": "warn", |
| 60 | + "@typescript-eslint/no-for-in-array": "warn", |
| 61 | + "no-unused-vars": "off", |
| 62 | + "@typescript-eslint/no-unused-vars": [ |
| 63 | + "error", |
| 64 | + { |
| 65 | + argsIgnorePattern: "^_", |
| 66 | + varsIgnorePattern: "^_", |
| 67 | + destructuredArrayIgnorePattern: "^_", |
| 68 | + caughtErrorsIgnorePattern: "^_", |
| 69 | + }, |
| 70 | + ], |
| 71 | + "no-implied-eval": "off", |
| 72 | + "@typescript-eslint/no-implied-eval": "error", |
| 73 | + "no-loss-of-precision": "off", |
| 74 | + "@typescript-eslint/no-loss-of-precision": "warn", |
| 75 | + "@typescript-eslint/no-misused-new": "error", |
| 76 | + "@typescript-eslint/no-misused-promises": [ |
| 77 | + "error", |
| 78 | + { checksVoidReturn: false }, |
| 79 | + ], |
| 80 | + "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error", |
| 81 | + "@typescript-eslint/no-non-null-asserted-optional-chain": "warn", |
| 82 | + "@typescript-eslint/no-redundant-type-constituents": "warn", |
| 83 | + "@typescript-eslint/no-this-alias": "warn", |
| 84 | + "@typescript-eslint/no-unnecessary-type-assertion": "warn", |
| 85 | + "@typescript-eslint/no-unnecessary-type-constraint": "warn", |
| 86 | + /* TODO eventually turn all these on */ |
| 87 | + "@typescript-eslint/no-unsafe-argument": "warn", |
| 88 | + // "@typescript-eslint/no-unsafe-assignment": "warn", |
| 89 | + // "@typescript-eslint/no-unsafe-call": "warn", |
| 90 | + "@typescript-eslint/no-unsafe-declaration-merging": "warn", |
| 91 | + "@typescript-eslint/no-unsafe-enum-comparison": "warn", |
| 92 | + // "@typescript-eslint/no-unsafe-member-access": "warn", |
| 93 | + "@typescript-eslint/no-unsafe-return": "warn", |
| 94 | + "@typescript-eslint/prefer-as-const": "warn", |
| 95 | + "require-await": "off", |
| 96 | + // "@typescript-eslint/require-await": "warn", |
| 97 | + "@typescript-eslint/restrict-template-expressions": "warn", |
| 98 | + "@typescript-eslint/unbound-method": "off", |
| 99 | + "@typescript-eslint/method-signature-style": "error", |
| 100 | + "@typescript-eslint/await-thenable": "error", |
| 101 | + }, |
| 102 | + reportUnusedDisableDirectives: true, |
| 103 | + ignorePatterns: ["__generated__", "__mocks__", "dist", "static"], |
| 104 | + overrides: [ |
| 105 | + { |
| 106 | + extends: ["plugin:@typescript-eslint/disable-type-checked"], |
| 107 | + files: ["webpack.*.js", ".*.cjs"], |
| 108 | + rules: { |
| 109 | + "@typescript-eslint/no-var-requires": "off", |
| 110 | + }, |
6 | 111 | },
|
7 |
| - "extends": "eslint:recommended", |
8 |
| - "parserOptions": { |
9 |
| - "ecmaVersion": 2018, |
10 |
| - "sourceType": "module" |
11 |
| - }, |
12 |
| - "rules": { |
13 |
| - "no-restricted-globals": [ |
14 |
| - 2, |
15 |
| - "event", "error" |
16 |
| - ], |
17 |
| - "indent": [ |
18 |
| - "error", |
19 |
| - 2 |
20 |
| - ], |
21 |
| - "linebreak-style": [ |
22 |
| - "error", |
23 |
| - "unix" |
24 |
| - ], |
25 |
| - "quotes": [ |
26 |
| - "error", |
27 |
| - "double" |
28 |
| - ], |
29 |
| - "semi": [ |
30 |
| - "error", |
31 |
| - "always" |
32 |
| - ] |
33 |
| - } |
| 112 | + ], |
34 | 113 | };
|
0 commit comments