|
1 | | -{ |
2 | | - "root": true, |
3 | | - "extends": [ |
| 1 | +"use strict"; |
| 2 | + |
| 3 | +module.exports = { |
| 4 | + root: true, |
| 5 | + extends: [ |
4 | 6 | "eslint:recommended", |
5 | 7 | // https://github.com/typescript-eslint/typescript-eslint/blob/v6/packages/eslint-plugin/src/configs/recommended.ts |
6 | 8 | "plugin:@typescript-eslint/recommended", |
7 | 9 | "plugin:react/recommended", |
8 | 10 | "plugin:react-hooks/recommended", |
9 | 11 | "prettier" |
10 | 12 | ], |
11 | | - "parser": "@typescript-eslint/parser", |
12 | | - "parserOptions": { |
13 | | - "requireConfigFile": false, |
14 | | - "ecmaVersion": 2019, |
15 | | - "ecmaFeatures": { |
16 | | - "jsx": true, |
17 | | - "modules": true, |
18 | | - "legacyDecorators": true |
| 13 | + parser: "@typescript-eslint/parser", |
| 14 | + parserOptions: { |
| 15 | + requireConfigFile: false, |
| 16 | + ecmaVersion: 2019, |
| 17 | + ecmaFeatures: { |
| 18 | + jsx: true, |
| 19 | + modules: true, |
| 20 | + legacyDecorators: true |
19 | 21 | } |
20 | 22 | }, |
21 | | - "env": { |
22 | | - "browser": true, |
23 | | - "commonjs": true, |
24 | | - "es6": true |
| 23 | + env: { |
| 24 | + browser: true, |
| 25 | + commonjs: true, |
| 26 | + es6: true |
25 | 27 | }, |
26 | | - "ignorePatterns": ["*.scss.d.ts"], |
27 | | - "plugins": ["react", "react-hooks", "@typescript-eslint"], |
28 | | - "globals": { |
29 | | - "process": true |
| 28 | + ignorePatterns: ["*.scss.d.ts", "/lib/ThirdParty"], |
| 29 | + plugins: ["react", "react-hooks", "@typescript-eslint"], |
| 30 | + globals: { |
| 31 | + process: true |
30 | 32 | }, |
31 | | - "settings": { |
32 | | - "react": { |
33 | | - "version": "detect" |
| 33 | + settings: { |
| 34 | + react: { |
| 35 | + version: "detect" |
34 | 36 | } |
35 | 37 | }, |
36 | | - "rules": { |
| 38 | + rules: { |
| 39 | + // TODO: re-enable the disabled @typescript-eslint rules. |
37 | 40 | "@typescript-eslint/no-explicit-any": "off", |
38 | 41 | "@typescript-eslint/no-namespace": "off", |
39 | | - "@typescript-eslint/no-non-null-asserted-optional-chain": "off", |
40 | 42 | "@typescript-eslint/no-this-alias": "off", |
41 | 43 | "@typescript-eslint/no-var-requires": "off", |
42 | 44 | "@typescript-eslint/unified-signatures": "error", |
43 | 45 | "react-hooks/exhaustive-deps": "error", |
44 | | - "react/jsx-boolean-value": ["error", "never", { "always": [] }], |
| 46 | + "react/jsx-boolean-value": ["error", "never", { always: [] }], |
45 | 47 | "react/no-arrow-function-lifecycle": "error", |
46 | 48 | "react/no-invalid-html-attribute": "error", |
47 | 49 | "react/jsx-no-useless-fragment": "error", |
48 | 50 | "react/jsx-no-constructed-context-values": "error", |
49 | 51 | "react/jsx-fragments": ["error", "syntax"], |
50 | | - "react/jsx-no-duplicate-props": ["error", { "ignoreCase": true }], |
| 52 | + "react/jsx-no-duplicate-props": ["error", { ignoreCase: true }], |
51 | 53 | "react/jsx-pascal-case": [ |
52 | 54 | "error", |
53 | 55 | { |
54 | | - "allowAllCaps": true, |
55 | | - "ignore": [] |
| 56 | + allowAllCaps: true, |
| 57 | + ignore: [] |
56 | 58 | } |
57 | 59 | ], |
58 | 60 | "react/no-danger": "warn", |
59 | 61 | "react/no-did-update-set-state": "error", |
60 | 62 | "react/no-will-update-set-state": "error", |
61 | 63 | "react/self-closing-comp": "error", |
62 | | - "react/jsx-no-undef": ["error", { "allowGlobals": true }], |
| 64 | + "react/jsx-no-undef": ["error", { allowGlobals: true }], |
63 | 65 |
|
64 | 66 | /*Possible Errors */ |
65 | 67 | "no-console": "off", |
66 | 68 | "no-inner-declarations": [1, "functions"], |
67 | 69 |
|
68 | 70 | /* Best Practices */ |
69 | | - "eqeqeq": ["error"], |
| 71 | + eqeqeq: ["error"], |
70 | 72 | "no-alert": ["error"], |
71 | 73 | "no-caller": ["error"], |
72 | 74 | "no-div-regex": ["error"], |
| 75 | + "no-empty": ["error", { allowEmptyCatch: true }], |
73 | 76 | "no-eval": ["error"], |
74 | 77 | "no-extend-native": ["error"], |
75 | 78 | "no-fallthrough": 0, |
|
86 | 89 | "no-return-assign": ["error"], |
87 | 90 | "no-script-url": ["error"], |
88 | 91 | "no-sequences": ["error"], |
89 | | - "radix": "error", |
| 92 | + radix: "error", |
90 | 93 |
|
91 | 94 | /* Strict Mode */ |
92 | | - "strict": [0, "global"], |
| 95 | + strict: [0, "global"], |
93 | 96 |
|
94 | 97 | /* Variables */ |
95 | 98 | "no-label-var": 1, |
96 | 99 | "@typescript-eslint/no-unused-vars": [ |
97 | 100 | "warn", |
98 | 101 | { |
99 | | - "args": "all", |
100 | | - "argsIgnorePattern": "^_", |
101 | | - "varsIgnorePattern": "^_", |
102 | | - "caughtErrors": "all", |
103 | | - "caughtErrorsIgnorePattern": "^_", |
104 | | - "destructuredArrayIgnorePattern": "^_", |
105 | | - "ignoreRestSiblings": true |
| 102 | + args: "all", |
| 103 | + argsIgnorePattern: "^_", |
| 104 | + varsIgnorePattern: "^_", |
| 105 | + caughtErrors: "all", |
| 106 | + caughtErrorsIgnorePattern: "^_", |
| 107 | + destructuredArrayIgnorePattern: "^_", |
| 108 | + ignoreRestSiblings: true |
106 | 109 | } |
107 | 110 | ], |
108 | | - "camelcase": [ |
| 111 | + camelcase: [ |
109 | 112 | 0, |
110 | 113 | { |
111 | | - "properties": "always" |
| 114 | + properties: "always" |
112 | 115 | } |
113 | 116 | ], |
114 | 117 | "no-array-constructor": "error", |
|
118 | 121 | /* See https://stackoverflow.com/questions/64646248/eslintrc-js-for-react-17-and-jsx-without-import-react/64646593#64646593 */ |
119 | 122 | "react/jsx-uses-react": "off", |
120 | 123 | "react/react-in-jsx-scope": "off", |
121 | | - "react/no-unknown-property": ["error", { "ignore": ["css"] }] |
| 124 | + "react/no-unknown-property": ["error", { ignore: ["css"] }] |
122 | 125 | }, |
123 | | - "overrides": [ |
| 126 | + overrides: [ |
124 | 127 | { |
125 | | - "files": ["**/*.ts", "**/*.tsx"], |
126 | | - "rules": { |
| 128 | + files: ["**/*.ts", "**/*.tsx"], |
| 129 | + rules: { |
127 | 130 | /* The no-useless-constructor needs to be disabled for |
128 | 131 | the @typescript-eslint-rule. */ |
129 | 132 | "no-useless-constructor": "off", |
|
135 | 138 | } |
136 | 139 | } |
137 | 140 | ] |
138 | | -} |
| 141 | +}; |
0 commit comments