@bitfactory/eslint-config 6.1.1 → 6.3.0

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/QUICKSTART.md ADDED
@@ -0,0 +1,55 @@
1
+ # Quick Start
2
+
3
+ ## Installation
4
+
5
+ Install the package:
6
+
7
+ ```bash
8
+ # Using pnpm (recommended)
9
+ pnpm add @bitfactory/eslint-config --save-dev --save-exact
10
+
11
+ # Using npm
12
+ npm install @bitfactory/eslint-config --save-dev --save-exact
13
+ ```
14
+
15
+ For detailed installation instructions including peer dependencies and Vue/TypeScript setup, see [Installation](docs/01-installation.md) documentation.
16
+
17
+ ## Configuration
18
+
19
+ Create an `eslint.config.js` file in your project root:
20
+
21
+ ```js
22
+ import bitfactoryBase from '@bitfactory/eslint-config';
23
+ import gitignore from 'eslint-config-flat-gitignore';
24
+
25
+ export default [
26
+ // Automatically ignore .gitignore patterns
27
+ gitignore(),
28
+ // Base Javascript config
29
+ ...bitfactoryBase,
30
+ ];
31
+ ```
32
+
33
+ For more configuration examples including Vue and TypeScript setups, see [Configuration](docs/02-configuration.md) documentation.
34
+
35
+ ## CLI Usage
36
+
37
+ Add scripts to your `package.json`:
38
+
39
+ ```json
40
+ {
41
+ "scripts": {
42
+ "lint": "eslint .",
43
+ "lint:fix": "pnpm run lint --fix"
44
+ }
45
+ }
46
+ ```
47
+
48
+ Run with:
49
+
50
+ ```bash
51
+ pnpm run lint
52
+ pnpm run lint:fix
53
+ ```
54
+
55
+ For more extensive CLI usage examples, see [CLI Usage](docs/03-cli-usage.md) documentation.
package/README.md CHANGED
@@ -7,398 +7,43 @@
7
7
  [![Node.js Package](https://github.com/bitfactory-nl/shared-npm-eslint-config-bitfactory/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/bitfactory-nl/shared-npm-eslint-config-bitfactory/actions/workflows/npm-publish.yml)
8
8
  [![NPM package version](https://badgen.net/npm/v/@bitfactory/eslint-config)](https://npmjs.com/package/@bitfactory/eslint-config)
9
9
 
10
- This is a shareable config for [ESLint](https://eslint.org). All the rules and configurations are already set. Rules can be overridden if needed.
10
+ Shareable ESLint config for ESLint v9+ Flat Config (ESM). All rules and configurations are pre-configured. Rules can be overridden as needed.
11
11
 
12
12
  > [!IMPORTANT]
13
- > **This package now supports only ESLint v9+ Flat Config (ESM).** Legacy `.eslintrc.*` configurations are no longer supported as of v6.0.0. See [:rocket: ESLint v9+ Flat Config Usage](#rocket-eslint-v9-flat-config-usage) for usage examples.
13
+ > **From v6.0 this package only supports ESLint v9+ with Flat Config (ESM).**
14
14
  >
15
- > For legacy `.eslintrc.*` support, use v5.x. See the Release Roadmap <https://github.com/bitfactory-nl/shared-npm-eslint-config-bitfactory/issues/83>
16
-
17
- - [@bitfactory/eslint-config](#bitfactoryeslint-config)
18
- - [:technologist: Development](#technologist-development)
19
- - [Publishing](#publishing)
20
- - [Local Development Configs](#local-development-configs)
21
- - [:package: Installing](#package-installing)
22
- - [Vue.js projects](#vuejs-projects)
23
- - [TypeScript projects](#typescript-projects)
24
- - [Vue.js, TypeScript and regular JavaScript together](#vuejs-typescript-and-regular-javascript-together)
25
- - [:rocket: CLI usage](#rocket-cli-usage)
26
- - [:pencil2: Editor / IDE integration](#pencil2-editor--ide-integration)
27
- - [Visual Studio Code](#visual-studio-code)
28
- - [Additional Extensions](#additional-extensions)
29
- - [PhpStorm](#phpstorm)
30
- - [:rocket: ESLint v9+ Flat Config Usage](#rocket-eslint-v9-flat-config-usage)
31
- - [Flat Config Entry Points](#flat-config-entry-points)
32
- - [Example: Using Only the Base Config](#example-using-only-the-base-config)
33
- - [Example: TypeScript Project](#example-typescript-project)
34
- - [Example: Vue Project](#example-vue-project)
35
- - [Example: Combined Vue + TypeScript + JS](#example-combined-vue--typescript--js)
36
-
37
- ## :technologist: Development
38
-
39
- ### Publishing
40
-
41
- Before publishing a new version:
42
-
43
- 1. Update the version number in the `package.json` file.
44
- 2. For majors and minors update the badge(s) in the `README.md` file.
45
- 3. Create a new release, after merging the PR. This will trigger a workflow.
46
- 4. The GitHub action workflow will then automatically create a new NPM package.
47
-
48
- > **For detailed automation and release rules, see the [Bitfactory NPM Package Automation Rules](.cursor/rules/tooling-shared-npm-package.mdc).**
49
-
50
- ### Local Development Configs
51
-
52
- > The files `.eslintrc.cjs` and `eslint.config.js` are provided for local development and testing only. They are not included in the published npm package and are not intended for consumer use. Consumers of this package should use the shareable config files (`index.(m)js`, `typescript.(m)js`, `vue.(m)js`, etc.) as described in the usage instructions.
53
-
54
- ### Debugging ESLint Configuration
55
-
56
- For debugging ESLint configuration issues, rule conflicts, or understanding config behavior, use the official ESLint Config Inspector:
57
-
58
- ```bash
59
- npx @eslint/config-inspector
60
- ```
61
-
62
- **Use cases:**
63
-
64
- - Debug rule conflicts and understand which rules are active
65
- - Visualize how configs apply to different file patterns
66
- - Help consumers troubleshoot configuration issues
67
- - Generate visual documentation of rule sets
68
-
69
- The inspector provides a web interface showing all active rules, plugins, and file matching patterns for your ESLint configuration.
70
-
71
- ## :package: Installing
72
-
73
- Include the config into your project:
74
-
75
- ```shell
76
- make npm "i @bitfactory/eslint-config --save-dev --save-exact"
77
- ```
78
-
79
- ```shell
80
- make pnpm "i @bitfactory/eslint-config --save-dev --save-exact"
81
- ```
82
-
83
- Then install the dependencies that the config needs:
84
-
85
- ```shell
86
- make npx "install-peerdeps --dev --extra-args="-E" @bitfactory/eslint-config"
87
- ```
88
-
89
- ```shell
90
- make pnpm dlx "install-peerdeps --dev --extra-args="-E" @bitfactory/eslint-config"
91
- ```
92
-
93
- Create an `eslint.config.js` file in your project root with the following contents:
94
-
95
- ```js
96
- import base from '@bitfactory/eslint-config';
97
-
98
- export default [...base];
99
- ```
100
-
101
- ### Vue.js projects
102
-
103
- To use this config with a Vue.js project also install the following packages:
104
-
105
- ```shell
106
- make npm "i eslint-plugin-vue eslint-plugin-vuejs-accessibility --save-dev --save-exact"
107
- ```
108
-
109
- ```shell
110
- make pnpm "i eslint-plugin-vue eslint-plugin-vuejs-accessibility --save-dev --save-exact"
111
- ```
112
-
113
- Create an `eslint.config.js` file with the Vue config:
114
-
115
- ```js
116
- import vue from '@bitfactory/eslint-config/vue';
117
-
118
- export default [...vue];
119
- ```
120
-
121
- #### Vue 3 extra configuration
122
-
123
- > [!IMPORTANT]
124
- > For Vue 3 TypeScript is mandatory, so [install the TS packages](#typescript-projects) as described in the TypeScript section.
125
-
126
- For Vue 3 projects, combine Vue and TypeScript configs:
127
-
128
- ```js
129
- import vue from '@bitfactory/eslint-config/vue';
130
- import ts from '@bitfactory/eslint-config/typescript';
131
- import vuePlugin from 'eslint-plugin-vue';
132
-
133
- export default [
134
- ...vue,
135
- ...vuePlugin.configs['flat/vue3-recommended'],
136
- ...ts,
137
- ];
138
- ```
139
-
140
- ### TypeScript projects
141
-
142
- To use this config with a TypeScript project _also_ install the following packages
143
-
144
- > [!NOTE]
145
- > Check and make sure a compatible TypeScript version is installed. Can be added with: `make [p]npm i typescript`.
146
-
147
- ```shell
148
- make npm "i @typescript-eslint/eslint-plugin @typescript-eslint/parser --save-dev --save-exact"
149
- ```
150
-
151
- ```shell
152
- make pnpm "i @typescript-eslint/eslint-plugin @typescript-eslint/parser --save-dev --save-exact"
153
- ```
154
-
155
- Create an `eslint.config.js` file with the TypeScript config:
156
-
157
- ```js
158
- import ts from '@bitfactory/eslint-config/typescript';
159
-
160
- export default [...ts];
161
- ```
162
-
163
- ### Vue.js, TypeScript and regular JavaScript together
164
-
165
- To use this config with a Vue.js, TypeScript and regular JavaScript together in one project make sure to install the packages from all three sections:
166
-
167
- - [:package: Installing](#package-installing)
168
- - [Vue.js projects](#vuejs-projects)
169
- - [TypeScript projects](#typescript-projects)
170
-
171
- Create an `eslint.config.js` file combining all configs:
172
-
173
- ```js
174
- import vue from '@bitfactory/eslint-config/vue';
175
- import ts from '@bitfactory/eslint-config/typescript';
176
- // import vuePlugin from 'eslint-plugin-vue'; // <-- add this only for Vue 3
177
-
178
- export default [
179
- ...vue,
180
- // ...vuePlugin.configs['flat/vue3-recommended'], // <-- add this only for Vue 3
181
- ...ts,
182
- ];
183
- ```
184
-
185
- ## :rocket: CLI usage
186
-
187
- To use ESLint in the command-line, add the following scripts to your projects `package.json`:
188
-
189
- ```json
190
- "scripts": {
191
- "eslint": "eslint 'path/to/your/assets/**/*.{cjs,js,mjs}'",
192
- "eslint:fix": "npm run eslint -- --fix"
193
- }
194
- ```
195
-
196
- ```json
197
- "scripts": {
198
- "eslint": "eslint 'path/to/your/assets/**/*.{cjs,js,mjs}'",
199
- "eslint:fix": "pnpm run eslint --fix"
200
- }
201
- ```
202
-
203
- To also check Vue.js files:
204
-
205
- ```json
206
- "scripts": {
207
- "eslint": "eslint 'path/to/your/assets/**/*.{cjs,js,mjs,vue}'",
208
- "eslint:fix": "npm run eslint -- --fix"
209
- }
210
- ```
211
-
212
- ```json
213
- "scripts": {
214
- "eslint": "eslint 'path/to/your/assets/**/*.{cjs,js,mjs,vue}'",
215
- "eslint:fix": "pnpm run eslint --fix"
216
- }
217
- ```
218
-
219
- Or TypeScript files:
220
-
221
- ```json
222
- "scripts": {
223
- "eslint": "eslint 'path/to/your/assets/**/*.{cjs,js,mjs,ts,tsx}'",
224
- "eslint:fix": "npm run eslint -- --fix"
225
- }
226
- ```
227
-
228
- ```json
229
- "scripts": {
230
- "eslint": "eslint 'path/to/your/assets/**/*.{cjs,js,mjs,ts,tsx}'",
231
- "eslint:fix": "pnpm run eslint --fix"
232
- }
233
- ```
234
-
235
- You can run the commands with:
236
-
237
- ```shell
238
- make npm run eslint
239
- make npm run eslint:fix
240
- ```
241
-
242
- ```shell
243
- make pnpm run eslint
244
- make pnpm run eslint:fix
245
- ```
246
-
247
- > With PNPM you can also run scripts without 'run' like `make pnpm eslint`.
248
-
249
- ## :pencil2: Editor / IDE integration
250
-
251
- For ESLint to work, you need to set up your editor / IDE.
252
- See also <https://eslint.style/guide/faq#how-to-auto-format-on-save>
253
-
254
- ### Visual Studio Code
255
-
256
- 1. Install the [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension
257
- 2. Add the following settings via `Code` → `Preferences` → `Settings`
258
- 3. Get linting :rocket:
259
-
260
- ```json
261
- {
262
- "editor.codeActionsOnSave": {
263
- "source.fixAll.eslint": true
264
- }
265
- }
266
- ```
267
-
268
- #### Additional Extensions
269
-
270
- - [Error Lens](https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens) to get inline error messages
271
-
272
- > :warning: If you have the [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extension enabled, make sure to **disable** the extension for your project's workspace. This is because Prettier's rules will conflict with ours.
273
-
274
- ---
275
-
276
- ### PhpStorm
277
-
278
- Go to [Preferences | Languages & Frameworks | JavaScript | Code Quality Tools | ESLint](jetbrains://PhpStorm/settings?name=Languages+%26+Frameworks--JavaScript--Code+Quality+Tools--ESLint) and set it to `Automatic ESLint configuration`
279
-
280
- 1. Install the [File Watchers](jetbrains://PhpStorm/settings?name=Plugins) plugin when not installed
281
- 2. Add a new watcher in [Preferences | Tools | File Watchers](jetbrains://PhpStorm/settings?name=Tools--File+Watchers) (\<custom\>) with the follow data:
282
-
283
- ```text
284
- Name: ESLint
285
- File type: Any
286
- Scope: Project files
287
- Program: $ProjectFileDir$/node_modules/.bin/eslint
288
- Arguments: --fix $FilePath$
289
- Output paths to refresh: $FileDir$
290
- - Working directory & Environment variables -
291
- Working directory: $ProjectFileDir$
292
- ```
293
-
294
- You can also select JavaScript, Vue.js or TypeScript files for `File type`, and copy the watcher for each needed file to only check those files
295
-
296
- Or import the following xml file:
297
-
298
- ```xml
299
- <TaskOptions>
300
- <TaskOptions>
301
- <option name="arguments" value="--fix $FilePath$" />
302
- <option name="checkSyntaxErrors" value="true" />
303
- <option name="description" />
304
- <option name="exitCodeBehavior" value="ERROR" />
305
- <option name="fileExtension" value="*" />
306
- <option name="immediateSync" value="true" />
307
- <option name="name" value="ESLint" />
308
- <option name="output" value="$FileDir$" />
309
- <option name="outputFilters">
310
- <array />
311
- </option>
312
- <option name="outputFromStdout" value="false" />
313
- <option name="program" value="$ProjectFileDir$/node_modules/.bin/eslint" />
314
- <option name="runOnExternalChanges" value="true" />
315
- <option name="scopeName" value="Project Files" />
316
- <option name="trackOnlyRoot" value="false" />
317
- <option name="workingDir" value="$ProjectFileDir$" />
318
- <envs />
319
- </TaskOptions>
320
- </TaskOptions>
321
- ```
322
-
323
- ## :rocket: ESLint v9+ Flat Config Usage
324
-
325
- > [!IMPORTANT]
326
- > ESLint v9+ uses Flat Config by default. This package now provides ESM-based Flat Config entry points for modern usage.
327
-
328
- ### Available Exports
329
-
330
- This package provides clean import paths for all configurations:
331
-
332
- ```js
333
- // Main entry point (base JavaScript rules)
334
- import base from '@bitfactory/eslint-config';
335
-
336
- // TypeScript configuration
337
- import ts from '@bitfactory/eslint-config/typescript';
338
-
339
- // Vue.js configuration
340
- import vue from '@bitfactory/eslint-config/vue';
341
- ```
342
-
343
- > **Legacy paths**: For backward compatibility, the full file paths are still supported:
15
+ > See [Migration Guide Flat Config](docs/migration-flat-config.md) for detailed instructions from v5.x (legacy `.eslintrc.*`) to v6.0.0+ (flat config).
344
16
  >
345
- > - `@bitfactory/eslint-config/typescript.flat.js`
346
- > - `@bitfactory/eslint-config/vue.flat.js`
347
-
348
- ### Flat Config Entry Points
349
-
350
- - **Base JS config:** Clean path `@bitfactory/eslint-config` or legacy `index.flat.js`
351
- - **TypeScript config:** Clean path `@bitfactory/eslint-config/typescript` or legacy `typescript.flat.js`
352
- - **Vue config:** Clean path `@bitfactory/eslint-config/vue` or legacy `vue.flat.js`
17
+ > For legacy `.eslintrc.*` support, use v5.x. See the Release Roadmap <https://github.com/bitfactory-nl/shared-npm-eslint-config-bitfactory/issues/83>.
353
18
 
354
- ### Example: Using Only the Base Config
355
-
356
- Create an `eslint.config.js` in your project root:
19
+ - [@bitfactory/eslint-config](#bitfactoryeslint-config)
20
+ - [Quick Start](#quick-start)
21
+ - [Contributing](#contributing)
22
+ - [Installation](#installation)
23
+ - [Configuration](#configuration)
24
+ - [CLI Usage](#cli-usage)
25
+ - [Editor Integration](#editor-integration)
357
26
 
358
- ```js
359
- import base from '@bitfactory/eslint-config';
27
+ ## Quick Start
360
28
 
361
- export default [
362
- ...base,
363
- ];
364
- ```
29
+ For a quick start guide with basic installation and configuration, see [QUICKSTART.md](QUICKSTART.md).
365
30
 
366
- ### Example: TypeScript Project
31
+ ## Contributing
367
32
 
368
- ```js
369
- import base from '@bitfactory/eslint-config';
370
- import ts from '@bitfactory/eslint-config/typescript';
33
+ For information about contributing to this project, including publishing guidelines, local development setup, and debugging tips, see [CONTRIBUTING.md](CONTRIBUTING.md).
371
34
 
372
- export default [
373
- ...base,
374
- ...ts,
375
- ];
376
- ```
35
+ ## Installation
377
36
 
378
- ### Example: Vue Project
37
+ For detailed installation instructions including peer dependencies and Vue/TypeScript setup, see [Installation Guide](docs/01-installation.md).
379
38
 
380
- ```js
381
- import base from '@bitfactory/eslint-config';
382
- import vue from '@bitfactory/eslint-config/vue';
39
+ ## Configuration
383
40
 
384
- export default [
385
- ...base,
386
- ...vue,
387
- ];
388
- ```
41
+ For configuration examples (Vue, TypeScript) and advanced configuration options (custom plugins, ECMAScript version overrides), see [Configuration Guide](docs/02-configuration.md).
389
42
 
390
- ### Example: Combined Vue + TypeScript + JS
43
+ ## CLI Usage
391
44
 
392
- ```js
393
- import base from '@bitfactory/eslint-config';
394
- import ts from '@bitfactory/eslint-config/typescript';
395
- import vue from '@bitfactory/eslint-config/vue';
45
+ For CLI usage instructions and command examples, see [CLI Usage Guide](docs/03-cli-usage.md).
396
46
 
397
- export default [
398
- ...base,
399
- ...ts,
400
- ...vue,
401
- ];
402
- ```
47
+ ## Editor Integration
403
48
 
404
- > You can combine these configs as needed, just like with the legacy CJS configs. Only import the ones you need for your project.
49
+ For editor integration instructions (Visual Studio Code, PhpStorm), see [Editor Integration Guide](docs/04-editor-integration.md).
@@ -0,0 +1,52 @@
1
+ # Installation
2
+
3
+ > [!NOTE]
4
+ > When using Docker with `[p]npm` Make recipes add `make` before every command, and surround instruction with quotes.
5
+
6
+ Install the JavaScript config and required dependencies:
7
+
8
+ ```bash
9
+ # Using pnpm (recommended)
10
+ pnpm add @bitfactory/eslint-config --save-dev --save-exact
11
+
12
+ # Using npm
13
+ npm install @bitfactory/eslint-config --save-dev --save-exact
14
+ ```
15
+
16
+ ## Peer Dependencies
17
+
18
+ If your project uses `.npmrc` with auto-install configuration, peer dependencies will be installed automatically. Ensure your `.npmrc` includes `auto-install-peers=true`, for example:
19
+
20
+ ```ini
21
+ auto-install-peers=true
22
+ package-import-method=copy
23
+ save-exact=true
24
+ update-notifier=false
25
+ ```
26
+
27
+ If you're not using auto-install, install peer dependencies manually:
28
+
29
+ ```bash
30
+ pnpm dlx install-peerdeps --dev --extra-args="-E" @bitfactory/eslint-config
31
+ # or: npx install-peerdeps --dev --extra-args="-E" @bitfactory/eslint-config
32
+ ```
33
+
34
+ ## Vue & TypeScript installation
35
+
36
+ For Vue.js projects, also install:
37
+
38
+ ```bash
39
+ pnpm add eslint-plugin-vue eslint-plugin-vuejs-accessibility vue-eslint-parser --save-dev --save-exact
40
+ # or: npm install eslint-plugin-vue eslint-plugin-vuejs-accessibility vue-eslint-parser --save-dev --save-exact
41
+ ```
42
+
43
+ For TypeScript projects, also install:
44
+
45
+ > [!NOTE]
46
+ > Check and make sure a compatible TypeScript version is installed. You can install it with:
47
+ > `[p]npm add typescript --save-dev --save-exact`.
48
+
49
+ ```bash
50
+ pnpm add @typescript-eslint/eslint-plugin @typescript-eslint/parser --save-dev --save-exact
51
+ # or: npm install @typescript-eslint/eslint-plugin @typescript-eslint/parser --save-dev --save-exact
52
+ ```
@@ -0,0 +1,89 @@
1
+ # Advanced Configuration
2
+
3
+ > [!IMPORTANT]
4
+ > **v5.x**: Required `/index.flat.js` path (e.g., `import bitfactoryBase from '@bitfactory/eslint-config/index.flat.js'`).
5
+ > **v6.0.0+**: Use clean import path (e.g., `import bitfactoryBase from '@bitfactory/eslint-config'`), supports v5 format.
6
+
7
+ ## Configuration Examples
8
+
9
+ ### Vue 3 + TypeScript
10
+
11
+ > [!TIP]
12
+ > Use this configuration for Nuxt 3 and Laravel Inertia projects.
13
+
14
+ ```js
15
+ import bitfactoryBase from '@bitfactory/eslint-config';
16
+ import bitfactoryTypeScript from '@bitfactory/eslint-config/typescript';
17
+ import bitfactoryVue from '@bitfactory/eslint-config/vue';
18
+ import gitignore from 'eslint-config-flat-gitignore';
19
+ import vuePlugin from 'eslint-plugin-vue';
20
+
21
+ export default [
22
+ gitignore(),
23
+ ...bitfactoryBase,
24
+ ...bitfactoryTypeScript,
25
+ ...bitfactoryVue,
26
+ ...vuePlugin.configs['flat/vue3-recommended'],
27
+ ];
28
+ ```
29
+
30
+ ### TypeScript only
31
+
32
+ ```js
33
+ import bitfactoryBase from '@bitfactory/eslint-config';
34
+ import bitfactoryTypeScript from '@bitfactory/eslint-config/typescript';
35
+ import gitignore from 'eslint-config-flat-gitignore';
36
+
37
+ export default [
38
+ gitignore(),
39
+ ...bitfactoryBase,
40
+ ...bitfactoryTypeScript,
41
+ ];
42
+ ```
43
+
44
+ ### Vue 2 (support deprecated)
45
+
46
+ ```js
47
+ import bitfactoryBase from '@bitfactory/eslint-config';
48
+ import bitfactoryVue from '@bitfactory/eslint-config/vue';
49
+ import gitignore from 'eslint-config-flat-gitignore';
50
+
51
+ export default [
52
+ gitignore(),
53
+ ...bitfactoryBase,
54
+ ...bitfactoryVue,
55
+ ];
56
+ ```
57
+
58
+ ## Custom Configuration
59
+
60
+ ### Adding Custom Plugins
61
+
62
+ ```js
63
+ import bitfactoryBase from '@bitfactory/eslint-config';
64
+ import gitignore from 'eslint-config-flat-gitignore';
65
+ import yourPlugin from 'eslint-plugin-your-plugin';
66
+
67
+ export default [
68
+ gitignore(),
69
+ ...bitfactoryBase,
70
+ {
71
+ plugins: {
72
+ 'your-plugin': yourPlugin,
73
+ },
74
+ rules: {
75
+ 'your-plugin/rule-name': 'error',
76
+ },
77
+ },
78
+ ];
79
+ ```
80
+
81
+ ### Override ECMAScript Version
82
+
83
+ ```js
84
+ {
85
+ languageOptions: {
86
+ ecmaVersion: 'latest', // Override default 2021
87
+ },
88
+ }
89
+ ```
@@ -0,0 +1,104 @@
1
+ # CLI Usage
2
+
3
+ > [!NOTE]
4
+ > When using Docker with `[p]npm` Make recipes add `make` before every command, and surround instruction with quotes.
5
+
6
+ ## NPM Scripts
7
+
8
+ To use ESLint in the command-line, add the following scripts to your projects `package.json`:
9
+
10
+ ### Basic JavaScript
11
+
12
+ ```json
13
+ {
14
+ "scripts": {
15
+ "eslint": "eslint 'path/to/your/assets/**/*.{cjs,js,mjs}'",
16
+ "eslint:fix": "pnpm run eslint --fix"
17
+ }
18
+ }
19
+ ```
20
+
21
+ ```json
22
+ {
23
+ "scripts": {
24
+ "eslint": "eslint 'path/to/your/assets/**/*.{cjs,js,mjs}'",
25
+ "eslint:fix": "npm run eslint -- --fix"
26
+ }
27
+ }
28
+ ```
29
+
30
+ ### Vue.js files
31
+
32
+ ```json
33
+ {
34
+ "scripts": {
35
+ "eslint": "eslint 'path/to/your/assets/**/*.vue'",
36
+ "eslint:fix": "pnpm run eslint --fix"
37
+ }
38
+ }
39
+ ```
40
+
41
+ ```json
42
+ {
43
+ "scripts": {
44
+ "eslint": "eslint 'path/to/your/assets/**/*.vue'",
45
+ "eslint:fix": "npm run eslint -- --fix"
46
+ }
47
+ }
48
+ ```
49
+
50
+ ### TypeScript files
51
+
52
+ ```json
53
+ {
54
+ "scripts": {
55
+ "eslint": "eslint 'path/to/your/assets/**/*.{ts,tsx}'",
56
+ "eslint:fix": "pnpm run eslint --fix"
57
+ }
58
+ }
59
+ ```
60
+
61
+ ```json
62
+ {
63
+ "scripts": {
64
+ "eslint": "eslint 'path/to/your/assets/**/*.{ts,tsx}'",
65
+ "eslint:fix": "npm run eslint -- --fix"
66
+ }
67
+ }
68
+ ```
69
+
70
+ ### All files (let config decide)
71
+
72
+ ```json
73
+ {
74
+ "scripts": {
75
+ "eslint": "eslint .",
76
+ "eslint:fix": "pnpm run eslint --fix"
77
+ }
78
+ }
79
+ ```
80
+
81
+ ```json
82
+ {
83
+ "scripts": {
84
+ "eslint": "eslint .",
85
+ "eslint:fix": "npm run eslint -- --fix"
86
+ }
87
+ }
88
+ ```
89
+
90
+ ## Running Commands
91
+
92
+ You can run the commands with:
93
+
94
+ ```bash
95
+ pnpm run eslint
96
+ pnpm run eslint:fix
97
+ ```
98
+
99
+ ```bash
100
+ npm run eslint
101
+ npm run eslint:fix
102
+ ```
103
+
104
+ > With PNPM you can also run scripts without 'run' like `pnpm eslint`.
@@ -0,0 +1,74 @@
1
+ # Editor Integration
2
+
3
+ For ESLint to work, you need to set up your editor or IDE.
4
+
5
+ See also <https://eslint.style/guide/faq#how-to-auto-format-on-save>
6
+
7
+ ## Visual Studio Code
8
+
9
+ 1. Install the [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension
10
+ 2. Add the following settings via `Code` → `Preferences` → `Settings`:
11
+
12
+ ```json
13
+ {
14
+ "editor.codeActionsOnSave": {
15
+ "source.fixAll.eslint": true
16
+ }
17
+ }
18
+ ```
19
+
20
+ ### Additional Extensions
21
+
22
+ - [Error Lens](https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens) to get inline error messages
23
+
24
+ > [!WARNING]
25
+ > If you have the [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extension enabled, make sure to **disable** the extension for your project's workspace. This is because Prettier's rules will conflict with ours.
26
+
27
+ ## PhpStorm
28
+
29
+ Go to [Preferences | Languages & Frameworks | JavaScript | Code Quality Tools | ESLint](jetbrains://PhpStorm/settings?name=Languages+%26+Frameworks--JavaScript--Code+Quality+Tools--ESLint) and set it to `Automatic ESLint configuration`
30
+
31
+ 1. Install the [File Watchers](jetbrains://PhpStorm/settings?name=Plugins) plugin when not installed
32
+ 2. Add a new watcher in [Preferences | Tools | File Watchers](jetbrains://PhpStorm/settings?name=Tools--File+Watchers) (\<custom\>) with the following data:
33
+
34
+ ```text
35
+ Name: ESLint
36
+ File type: Any
37
+ Scope: Project files
38
+ Program: $ProjectFileDir$/node_modules/.bin/eslint
39
+ Arguments: --fix $FilePath$
40
+ Output paths to refresh: $FileDir$
41
+
42
+ - Working directory & Environment variables -
43
+
44
+ Working directory: $ProjectFileDir$
45
+ ```
46
+
47
+ You can also select JavaScript, Vue.js or TypeScript files for `File type`, and copy the watcher for each needed file to only check those files.
48
+
49
+ Or import the following XML file:
50
+
51
+ ```xml
52
+ <TaskOptions>
53
+ <TaskOptions>
54
+ <option name="arguments" value="--fix $FilePath$" />
55
+ <option name="checkSyntaxErrors" value="true" />
56
+ <option name="description" />
57
+ <option name="exitCodeBehavior" value="ERROR" />
58
+ <option name="fileExtension" value="*" />
59
+ <option name="immediateSync" value="true" />
60
+ <option name="name" value="ESLint" />
61
+ <option name="output" value="$FileDir$" />
62
+ <option name="outputFilters">
63
+ <array />
64
+ </option>
65
+ <option name="outputFromStdout" value="false" />
66
+ <option name="program" value="$ProjectFileDir$/node_modules/.bin/eslint" />
67
+ <option name="runOnExternalChanges" value="true" />
68
+ <option name="scopeName" value="Project Files" />
69
+ <option name="trackOnlyRoot" value="false" />
70
+ <option name="workingDir" value="$ProjectFileDir$" />
71
+ <envs />
72
+ </TaskOptions>
73
+ </TaskOptions>
74
+ ```
@@ -0,0 +1,87 @@
1
+ # Migration Guide Flat Config
2
+
3
+ Migrating from v5.x (legacy `.eslintrc.*`) to v6.0.0+ (flat config only):
4
+
5
+ ## Step-by-Step Migration
6
+
7
+ 1. **Update ESLint to v9+**
8
+
9
+ ```bash
10
+ # Using pnpm (recommended)
11
+ pnpm add eslint@^9.0.0 --save-dev --save-exact
12
+
13
+ # Using npm
14
+ npm install eslint@^9.0.0 --save-dev --save-exact
15
+ ```
16
+
17
+ 2. **Update @bitfactory/eslint-config**
18
+
19
+ ```bash
20
+ # Using pnpm (recommended)
21
+ pnpm add @bitfactory/eslint-config@^6.0.0 --save-dev --save-exact
22
+
23
+ # Using npm
24
+ npm install @bitfactory/eslint-config@^6.0.0 --save-dev --save-exact
25
+ ```
26
+
27
+ 3. **Install required dependencies** _(optional)_
28
+
29
+ If your project doesn't use `.npmrc` with `auto-install-peers=true`, install peer dependencies manually.
30
+ This includes `eslint-config-flat-gitignore`, which is needed for automatic `.gitignore` integration.
31
+ See [Peer Dependencies](01-installation.md#peer-dependencies) for details.
32
+
33
+ ```bash
34
+ # Using pnpm
35
+ pnpm dlx install-peerdeps --dev --extra-args="-E" @bitfactory/eslint-config
36
+
37
+ # Using npm
38
+ npx install-peerdeps --dev --extra-args="-E" @bitfactory/eslint-config
39
+ ```
40
+
41
+ 4. **Remove legacy ESLint configuration**
42
+
43
+ - Remove `.eslintrc.js`, `.eslintrc.json`, `.eslintrc.yml`, or `.eslintrc.yaml`
44
+ - Remove `.eslintignore` (no longer needed with flat config and gitignore plugin)
45
+
46
+ 5. **Update package.json scripts**
47
+
48
+ Remove `ESLINT_USE_FLAT_CONFIG=false` environment variable from your scripts if present:
49
+
50
+ ```json
51
+ {
52
+ "scripts": {
53
+ "lint": "eslint .",
54
+ "lint:fix": "eslint . --fix"
55
+ }
56
+ }
57
+ ```
58
+
59
+ 6. **Create new flat config file**
60
+
61
+ - Review your existing legacy config to identify custom rules, plugins, and configurations
62
+ - Create `eslint.config.js` using examples from [Configuration Examples](02-configuration.md#configuration-examples) as a base
63
+ - **Preserve all customizations** from your old config:
64
+ - Custom rules (add them as additional config objects after the base configs)
65
+ - Custom plugins (see [Custom Configuration](02-configuration.md#custom-configuration) for examples)
66
+ - Project-specific overrides (file patterns, language options, etc.)
67
+ - **Include gitignore plugin** in your config (already installed via peer dependencies):
68
+
69
+ ```js
70
+ import bitfactoryBase from '@bitfactory/eslint-config';
71
+ import gitignore from 'eslint-config-flat-gitignore';
72
+
73
+ export default [
74
+ gitignore(), // Automatically ignore .gitignore patterns
75
+ ...bitfactoryBase,
76
+ ];
77
+ ```
78
+
79
+ 7. **Test your configuration**
80
+
81
+ ```bash
82
+ # Using pnpm
83
+ pnpm run lint
84
+
85
+ # Using npm
86
+ npm run lint
87
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitfactory/eslint-config",
3
- "version": "6.1.1",
3
+ "version": "6.3.0",
4
4
  "description": "ESLint sharable config for Bitfactory projects",
5
5
  "keywords": [
6
6
  "eslint",
@@ -18,33 +18,39 @@
18
18
  "./vue.flat.js": "./vue.flat.js"
19
19
  },
20
20
  "main": "index.flat.js",
21
+ "directories": {
22
+ "doc": "docs"
23
+ },
21
24
  "files": [
25
+ "docs",
22
26
  "rules",
23
27
  "index.flat.js",
24
28
  "typescript.flat.js",
25
29
  "vue.flat.js",
26
- "README.md"
30
+ "README.md",
31
+ "QUICKSTART.md"
27
32
  ],
28
33
  "devDependencies": {
29
- "eslint": "9.29.0",
30
- "lint-staged": "15.5.2",
31
- "npm-check-updates": "18.0.1",
32
- "simple-git-hooks": "2.13.0"
34
+ "eslint": "9.39.1",
35
+ "lint-staged": "16.2.6",
36
+ "npm-check-updates": "19.1.2",
37
+ "simple-git-hooks": "2.13.1"
33
38
  },
34
39
  "peerDependencies": {
35
40
  "@babel/core": ">=7.26.10",
36
41
  "@babel/eslint-parser": ">=7.26.10",
37
42
  "@eslint/js": "^9.0.0",
38
- "@stylistic/eslint-plugin": ">=2.6.0 <4.0.0",
43
+ "@stylistic/eslint-plugin": ">=2.6.0",
39
44
  "@typescript-eslint/eslint-plugin": ">=7.0.0",
40
45
  "@typescript-eslint/parser": ">=7.0.0",
41
46
  "eslint": "^9.0.0",
47
+ "eslint-config-flat-gitignore": "^2.0.0",
42
48
  "eslint-plugin-import": ">=2.31.0",
43
49
  "eslint-plugin-jsdoc": ">=47.0.0",
44
- "eslint-plugin-unicorn": ">=56.0.1 <59.0.0",
50
+ "eslint-plugin-unicorn": ">=59.0.0",
45
51
  "eslint-plugin-vue": ">=9.0.0",
46
52
  "eslint-plugin-vuejs-accessibility": ">=0.5.0",
47
- "globals": ">=16.2.0",
53
+ "globals": ">=15.0.0",
48
54
  "vue-eslint-parser": ">=9.0.0"
49
55
  },
50
56
  "peerDependenciesMeta": {
@@ -65,7 +71,7 @@
65
71
  }
66
72
  },
67
73
  "engines": {
68
- "node": "^20.9.0 || ^22.11.0"
74
+ "node": "^20.9.0 || ^22.11.0 || ^24.11.0"
69
75
  },
70
76
  "scripts": {
71
77
  "eslint": "eslint '**/*.{cjs,js,mjs}'",