@boehringer-ingelheim/eslint-config 7.0.0-next.6 → 7.0.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -6
- package/configs/base.js +7 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,8 +52,7 @@ export default boehringer.config(
|
|
|
52
52
|
);
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
More Information: [ESLint - Configuration Files
|
|
56
|
-
](https://eslint.org/docs/latest/use/configure/configuration-files#extending-configuration-files)
|
|
55
|
+
More Information: [ESLint - Configuration Files](https://eslint.org/docs/latest/use/configure/configuration-files#extending-configuration-files)
|
|
57
56
|
|
|
58
57
|
### Run
|
|
59
58
|
|
|
@@ -63,7 +62,7 @@ npx eslint .
|
|
|
63
62
|
|
|
64
63
|
## Shared Configurations
|
|
65
64
|
|
|
66
|
-
Opinionated Options that differ from the standard/recommended
|
|
65
|
+
Opinionated Options that differ from the standard/recommended ESLint configurations.
|
|
67
66
|
|
|
68
67
|
### Base
|
|
69
68
|
|
|
@@ -160,8 +159,6 @@ export default boehringer.config(
|
|
|
160
159
|
|
|
161
160
|
This shared ESLint configuration is specifically tailored for [Next.js](https://nextjs.org/) projects. It extends the [react configuration](#react) and includes the [`@next/eslint-plugin-next`](https://nextjs.org/docs/app/api-reference/config/eslint) plugin with the recommended and [`core-web-vital`](https://nextjs.org/docs/app/api-reference/config/eslint#with-core-web-vitals) rule set. The configuration also adapts the rule `react-refresh/only-export-components` to be compatible with Next.js.
|
|
162
161
|
|
|
163
|
-
It
|
|
164
|
-
|
|
165
162
|
### Playwright
|
|
166
163
|
|
|
167
164
|
```js
|
|
@@ -200,6 +197,69 @@ This shared ESLint configuration is wrapper around [`eslint-config-disable`](htt
|
|
|
200
197
|
- [`curly`](https://github.com/eslint/eslint/blob/main/docs/src/rules/curly.md) with the (default) option "all": Enforce consistent brace style for all control statements
|
|
201
198
|
- [`no-confusing-arrow`](https://github.com/eslint/eslint/blob/main/docs/src/rules/no-confusing-arrow.md) with allowParens `false` and onlyOneSimpleParam `true`: Disallow arrow functions where they could be confused with comparisons.
|
|
202
199
|
|
|
200
|
+
## Known issues
|
|
201
|
+
|
|
202
|
+
### Parsing error
|
|
203
|
+
|
|
204
|
+
ESLint may throw the following error for some files (even for its own eslint.config.js): `ESLint was configured to run ... However, that TSConfig does not / none of those TSConfigs include this file`.
|
|
205
|
+
|
|
206
|
+
This error is caused by including the respective file in the scope of ESLint but not in the scope of TypeScript. For more information about this error and more suggestions how to solve it you can check the [FAQ of typescript-eslint](https://typescript-eslint.io/troubleshooting/typed-linting/#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file).
|
|
207
|
+
|
|
208
|
+
Our recommendation is to keep type-aware linting of those files.
|
|
209
|
+
|
|
210
|
+
#### Solution 1
|
|
211
|
+
|
|
212
|
+
Include the .(c|m)?js files in your main tsconfig.json:
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"include": [
|
|
217
|
+
// your existing includes
|
|
218
|
+
"*.*js", // this will include all .js, .cjs, .mjs files and similar in your project root
|
|
219
|
+
"*.ts", // this will include all .ts files and similar in your project root
|
|
220
|
+
// Add all other files/folders in which this error occurs
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### Solution 2
|
|
226
|
+
|
|
227
|
+
Extend your main tsconfig.json in a tsconfig.eslint.json (or similar) which includes those files and ensures allowJs is set to true, which is used in a similar way by typescript-eslint in [their own repo](https://github.com/typescript-eslint/typescript-eslint/tree/v8.20.0):
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"compilerOptions": {
|
|
232
|
+
"noEmit": true,
|
|
233
|
+
"allowJs": true
|
|
234
|
+
},
|
|
235
|
+
"extends": "./tsconfig.json",
|
|
236
|
+
"include": [
|
|
237
|
+
// you have to add here all the items from your original tsconfig.json as it overwrites the whole array
|
|
238
|
+
"*.*js", // this will include all .js, .cjs, .mjs files and similar in your project root
|
|
239
|
+
"*.ts", // this will include all .ts files and similar in your project root
|
|
240
|
+
// Add all other files/folders in which this error occurs
|
|
241
|
+
]
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
In this case you have to overwrite the configured tsconfig file:
|
|
246
|
+
|
|
247
|
+
```js
|
|
248
|
+
import boehringer from '@boehringer-ingelheim/eslint-config';
|
|
249
|
+
|
|
250
|
+
export default boehringer.config(
|
|
251
|
+
// other configs,
|
|
252
|
+
{
|
|
253
|
+
languageOptions: {
|
|
254
|
+
parserOptions: {
|
|
255
|
+
project: './tsconfig.eslint.json',
|
|
256
|
+
tsconfigRootDir: __dirname,
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
)
|
|
261
|
+
```
|
|
262
|
+
|
|
203
263
|
## Local Development
|
|
204
264
|
|
|
205
265
|
### Install Dependencies
|
|
@@ -255,7 +315,7 @@ Give a ⭐️ if this project helped you!
|
|
|
255
315
|
|
|
256
316
|
## License
|
|
257
317
|
|
|
258
|
-
Copyright © 2023 [Boehringer Ingelheim](https://github.com/boehringer-ingelheim)
|
|
318
|
+
Copyright © 2023 [Boehringer Ingelheim](https://github.com/boehringer-ingelheim).
|
|
259
319
|
This project is [MIT](https://github.com/boehringer-ingelheim/eslint-config/blob/master/LICENSE) licensed.
|
|
260
320
|
|
|
261
321
|
## Resources
|
package/configs/base.js
CHANGED
|
@@ -74,14 +74,13 @@ module.exports = tseslint.config(
|
|
|
74
74
|
|
|
75
75
|
// eslint-plugin-import: https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules
|
|
76
76
|
'import/no-cycle': 'error',
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
],
|
|
77
|
+
/**
|
|
78
|
+
* The rule is disabled for now as it is not compatible with flat-configs, without adding an artifical `.eslintrc` file.
|
|
79
|
+
*
|
|
80
|
+
* @see: https://github.com/import-js/eslint-plugin-import/issues/3079#issuecomment-2557191925
|
|
81
|
+
* @todo Enable rule, as soon as fix is available: https://github.com/Boehringer-Ingelheim/eslint-config/blob/9f028ed43bb5db11082a2982f249ddfe7eaf5c13/configs/base.js#L77
|
|
82
|
+
*/
|
|
83
|
+
'import/no-unused-modules': 'off',
|
|
85
84
|
'import/order': 'off', // disabled due to conflict with eslint-plugin-perfectionist
|
|
86
85
|
'import/prefer-default-export': 'off',
|
|
87
86
|
|