|
1 | 1 | // eslint-disable-next-line no-undef
|
| 2 | +const illegalGlobals = ['localStorage', 'name'] |
| 3 | +const testGlobals = ['describe', 'it', 'context'] |
| 4 | + |
2 | 5 | module.exports = {
|
3 | 6 | env: {
|
4 | 7 | browser: true,
|
5 | 8 | es2020: true,
|
6 | 9 | },
|
7 | 10 | extends: [
|
8 |
| - "eslint:recommended", |
9 |
| - "plugin:@typescript-eslint/recommended", |
10 |
| - "prettier", |
| 11 | + 'eslint:recommended', |
| 12 | + 'plugin:@typescript-eslint/recommended', |
| 13 | + 'prettier', |
| 14 | + ], |
| 15 | + overrides: [ |
| 16 | + { |
| 17 | + files: ['*.test.*'], |
| 18 | + rules: { |
| 19 | + 'no-restricted-globals': ['warn', ...illegalGlobals], |
| 20 | + }, |
| 21 | + }, |
11 | 22 | ],
|
12 |
| - parser: "@typescript-eslint/parser", |
| 23 | + parser: '@typescript-eslint/parser', |
13 | 24 | parserOptions: {
|
14 | 25 | ecmaVersion: 11,
|
15 |
| - sourceType: "module", |
16 |
| - project: "./tsconfig.json", |
| 26 | + sourceType: 'module', |
| 27 | + project: './tsconfig.json', |
17 | 28 | },
|
18 |
| - plugins: ["@typescript-eslint", "only-warn"], |
| 29 | + plugins: ['@typescript-eslint', 'only-warn'], |
19 | 30 | rules: {
|
20 |
| - "no-restricted-globals": ["warn", "localStorage"], |
21 |
| - "no-restricted-properties": [ |
22 |
| - "warn", |
| 31 | + 'no-restricted-globals': ['warn', ...illegalGlobals, ...testGlobals], |
| 32 | + 'no-restricted-properties': [ |
| 33 | + 'warn', |
23 | 34 | {
|
24 |
| - object: "window", |
25 |
| - property: "localStorage", |
| 35 | + object: 'window', |
| 36 | + property: 'localStorage', |
26 | 37 | },
|
27 | 38 | ],
|
28 |
| - "no-console": ["warn", { allow: ["warn", "error"] }], |
| 39 | + 'no-console': ['warn', { allow: ['warn', 'error', 'info'] }], |
29 | 40 |
|
30 |
| - "@typescript-eslint/no-extra-semi": "off", |
31 |
| - "@typescript-eslint/no-var-requires": "off", |
32 |
| - "@typescript-eslint/no-floating-promises": "warn", |
33 |
| - "@typescript-eslint/no-misused-promises": "warn", |
34 |
| - "@typescript-eslint/no-unused-vars": "off", |
35 |
| - "@typescript-eslint/explicit-module-boundary-types": "off", |
36 |
| - "@typescript-eslint/no-explicit-any": "off", |
37 |
| - "@typescript-eslint/no-empty-function": "off", |
38 |
| - "@typescript-eslint/no-non-null-assertion": "off", |
| 41 | + '@typescript-eslint/no-extra-semi': 'off', |
| 42 | + '@typescript-eslint/no-var-requires': 'off', |
| 43 | + '@typescript-eslint/no-floating-promises': 'warn', |
| 44 | + '@typescript-eslint/no-misused-promises': [ |
| 45 | + 'warn', |
| 46 | + { |
| 47 | + checksVoidReturn: false, |
| 48 | + }, |
| 49 | + ], |
| 50 | + '@typescript-eslint/no-unused-vars': 'off', |
| 51 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 52 | + '@typescript-eslint/no-explicit-any': 'off', |
| 53 | + '@typescript-eslint/no-empty-function': 'off', |
| 54 | + '@typescript-eslint/no-non-null-assertion': 'off', |
39 | 55 | },
|
40 |
| -}; |
| 56 | +} |
0 commit comments