@boehringer-ingelheim/eslint-config 7.0.0-naming-convetion-configuration.2 → 7.0.0-next.10

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 CHANGED
@@ -84,21 +84,7 @@ The following plugins are used in this configuration:
84
84
 
85
85
  Additionally, the [`eslint-plugin-perfectionist`](https://github.com/azat-io/eslint-plugin-perfectionist) is used to automatically fix sorting issues.
86
86
 
87
- This configuration also sets up the TypeScript parser [`@typescript-eslint/parser`](https://typescript-eslint.io/packages/parser/) and [`eslint-import-resolver-typescript`](https://github.com/import-js/eslint-import-resolver-typescript). The TypeScript project configuration file `./tsconfig.json` is set as default value in the parser configuration. If this is not the case, this must be changed accordingly:
88
-
89
- ```js
90
- import boehringer from '@boehringer-ingelheim/eslint-config';
91
-
92
- export default boehringer.config(boehringer.configs.base, {
93
- languageOptions: {
94
- parserOptions: {
95
- projectService: {
96
- defaultProject: ['./tsconfig.dev.json'],
97
- },
98
- },
99
- },
100
- });
101
- ```
87
+ This configuration also sets up the TypeScript parser [`@typescript-eslint/parser`](https://typescript-eslint.io/packages/parser/) and [`eslint-import-resolver-typescript`](https://github.com/import-js/eslint-import-resolver-typescript).
102
88
 
103
89
  ### Local
104
90
 
@@ -176,7 +162,7 @@ This shared ESLint configuration is designed to enforce best practices and recom
176
162
  - [`playwright/prefer-to-have-length`](https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-to-have-length.md): enforces the use of `.toHaveLength()` instead of `.toEqual(n)` when testing the length of an object.
177
163
  - [`playwright/require-top-level-describe`](https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/require-top-level-describe.md): requires tests to be organized into top-level `describe()` blocks.
178
164
 
179
- ### Naming Convention
165
+ ### (experimental) Naming Convention
180
166
 
181
167
  ```js
182
168
  import boehringer from '@boehringer-ingelheim/eslint-config';
@@ -184,7 +170,7 @@ import boehringer from '@boehringer-ingelheim/eslint-config';
184
170
  export default boehringer.config(
185
171
  boehringer.configs.strict,
186
172
  // possibly other configs,
187
- boehringer.configs.namingConvention
173
+ boehringer.configs.experimentalNamingConvention
188
174
  );
189
175
  ```
190
176
 
@@ -215,9 +201,12 @@ This shared ESLint configuration is wrapper around [`eslint-config-disable`](htt
215
201
 
216
202
  ### Parsing error
217
203
 
218
- 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`.
204
+ ESLint may throw one of the following errors for some files (even for its own eslint.config.js):
219
205
 
220
- 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).
206
+ - `ESLint was configured to run ... However, that TSConfig does not / none of those TSConfigs include this file`.
207
+ - `... was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject`
208
+
209
+ 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 [troubleshooting of typescript-eslint](https://typescript-eslint.io/troubleshooting/typed-linting/#i-get-errors-telling-me--was-not-found-by-the-project-service-consider-either-including-it-in-the-tsconfigjson-or-including-it-in-allowdefaultproject).
221
210
 
222
211
  Our recommendation is to keep type-aware linting of those files.
223
212
 
@@ -225,7 +214,7 @@ Our recommendation is to keep type-aware linting of those files.
225
214
 
226
215
  Include the .(c|m)?js files in your main tsconfig.json:
227
216
 
228
- ```json
217
+ ```jsonc
229
218
  {
230
219
  "include": [
231
220
  // your existing includes
@@ -238,25 +227,7 @@ Include the .(c|m)?js files in your main tsconfig.json:
238
227
 
239
228
  #### Solution 2
240
229
 
241
- 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):
242
-
243
- ```json
244
- {
245
- "compilerOptions": {
246
- "noEmit": true,
247
- "allowJs": true
248
- },
249
- "extends": "./tsconfig.json",
250
- "include": [
251
- // you have to add here all the items from your original tsconfig.json as it overwrites the whole array
252
- "*.*js", // this will include all .js, .cjs, .mjs files and similar in your project root
253
- "*.ts", // this will include all .ts files and similar in your project root
254
- // Add all other files/folders in which this error occurs
255
- ]
256
- }
257
- ```
258
-
259
- In this case you have to overwrite the configured tsconfig file:
230
+ You can use the new [`allowDefaultProject`](https://typescript-eslint.io/packages/parser#allowdefaultproject) option, which works perfectly with our [`projectService` configuration](./configs/base.js#L25):
260
231
 
261
232
  ```js
262
233
  import boehringer from '@boehringer-ingelheim/eslint-config';
@@ -266,8 +237,14 @@ export default boehringer.config(
266
237
  {
267
238
  languageOptions: {
268
239
  parserOptions: {
269
- project: './tsconfig.eslint.json',
270
- tsconfigRootDir: __dirname,
240
+ projectService: {
241
+ allowDefaultProject: [
242
+ '*.*js',
243
+ '.*.*js',
244
+ ],
245
+ // defaultProject can be used to specify separate tsconfig options for "out-of-project" files included by allowDefaultProject
246
+ // defaultProject: 'tsconfig.eslint.json',
247
+ },
271
248
  },
272
249
  },
273
250
  },
package/index.d.ts CHANGED
@@ -1,6 +1,14 @@
1
1
  import { Config } from 'typescript-eslint';
2
2
 
3
- type Configs = 'base' | 'local' | 'nextjs' | 'playwright' | 'prettierDisable' | 'react' | 'strict';
3
+ type Configs =
4
+ | 'base'
5
+ | 'experimentalNamingConvention'
6
+ | 'local'
7
+ | 'nextjs'
8
+ | 'playwright'
9
+ | 'prettierDisable'
10
+ | 'react'
11
+ | 'strict';
4
12
 
5
13
  declare module './index' {
6
14
  const config: typeof import('typescript-eslint').config;
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  const tseslint = require('typescript-eslint');
2
2
 
3
3
  const base = require('./configs/base.js');
4
+ const experimentalNamingConvention = require('./configs/experimental-naming-convention.js');
4
5
  const local = require('./configs/local.js');
5
- const namingConvention = require('./configs/naming-convention.js');
6
6
  const nextjs = require('./configs/nextjs.js');
7
7
  const playwright = require('./configs/playwright.js');
8
8
  const prettierDisable = require('./configs/prettier-disable.js');
@@ -13,8 +13,8 @@ module.exports = {
13
13
  config: tseslint.config,
14
14
  configs: {
15
15
  base,
16
+ experimentalNamingConvention,
16
17
  local,
17
- namingConvention,
18
18
  nextjs,
19
19
  playwright,
20
20
  prettierDisable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boehringer-ingelheim/eslint-config",
3
- "version": "7.0.0-naming-convetion-configuration.2",
3
+ "version": "7.0.0-next.10",
4
4
  "description": "Shared eslint configuration used at Boehringer Ingelheim for code styling",
5
5
  "keywords": [
6
6
  "boehringer",