@antfu/eslint-config 2.8.2 → 2.9.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/README.md CHANGED
@@ -21,6 +21,14 @@
21
21
 
22
22
  ## Usage
23
23
 
24
+ ### Wizard
25
+
26
+ We provided a CLI tool to help you set up your project, or migrate from the legacy config to the new flat config.
27
+
28
+ ```bash
29
+ npx @antfu/eslint-config@latest
30
+ ```
31
+
24
32
  ### Install
25
33
 
26
34
  ```bash
@@ -91,16 +99,6 @@ For example:
91
99
  }
92
100
  ```
93
101
 
94
- ### Migration
95
-
96
- We provided an experimental CLI tool to help you migrate from the legacy config to the new flat config.
97
-
98
- ```bash
99
- npx @antfu/eslint-config@latest
100
- ```
101
-
102
- Before running the migration, make sure to commit your unsaved changes first.
103
-
104
102
  ## VS Code support (auto fix)
105
103
 
106
104
  Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
@@ -280,7 +278,7 @@ Since flat config requires us to explicitly provide the plugin names (instead of
280
278
 
281
279
  | New Prefix | Original Prefix | Source Plugin |
282
280
  | ---------- | ---------------------- | ------------------------------------------------------------------------------------------ |
283
- | `import/*` | `i/*` | [eslint-plugin-i](https://github.com/un-es/eslint-plugin-i) |
281
+ | `import/*` | `import-x/*` | [eslint-plugin-import-x](https://github.com/un-es/eslint-plugin-import-x) |
284
282
  | `node/*` | `n/*` | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) |
285
283
  | `yaml/*` | `yml/*` | [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) |
286
284
  | `ts/*` | `@typescript-eslint/*` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |
@@ -296,6 +294,15 @@ When you want to override rules, or disable them inline, you need to update to t
296
294
  type foo = { bar: 2 }
297
295
  ```
298
296
 
297
+ > [!NOTE]
298
+ > About plugin renaming - it is actually rather a dangrous move that might leading to potential naming collisions, pointed out [here](https://github.com/eslint/eslint/discussions/17766) and [here](https://github.com/prettier/eslint-config-prettier#eslintconfigjs-flat-config-plugin-caveat). As this config also very **personal** and **opinionated**, I ambitiously poisition this config as the only **"top-level"** config per project, that might pivots the taste of how rules are named.
299
+ >
300
+ > This config cares more about the user-facings DX, and try to ease out the implementation details. For example, users could keep using the semantic `import/order` without ever knowing the underlying plugin has migrated twice to `eslint-plugin-i` and then to `eslint-plugin-import-x`. User are also not forced to migrate to the implicit `i/order` halfway only because we swapped the implementation to a fork.
301
+ >
302
+ > That said, it's probably still not a good idea. You might not want to doing this if you are maintaining your own eslint config.
303
+ >
304
+ > Feel free to open issues if you want to combine this config with some other config presets but faced naming collisions. I am happy to figure out a way to make them work. But at this moment I have no plan to revert the renaming.
305
+
299
306
  ### Rules Overrides
300
307
 
301
308
  Certain rules would only be enabled in specific files, for example, `ts/*` rules would only be enabled in `.ts` files and `vue/*` rules would only be enabled in `.vue` files. If you want to override the rules, you need to specify the file extension:
@@ -506,6 +513,21 @@ export default antfu({
506
513
  })
507
514
  ```
508
515
 
516
+ ### Editor Specific Disables
517
+
518
+ Some rules are disabled when inside ESLint IDE integrations, namely [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports) [`test/no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)
519
+
520
+ This is to prevent unused imports from getting removed by the IDE during refactoring to get a better developer experience. Those rules will be applied when you run ESLint in the terminal or [Lint Staged](#lint-staged). If you don't want this behavior, you can disable them:
521
+
522
+ ```js
523
+ // eslint.config.js
524
+ import antfu from '@antfu/eslint-config'
525
+
526
+ export default antfu({
527
+ isInEditor: false
528
+ })
529
+ ```
530
+
509
531
  ### Lint Staged
510
532
 
511
533
  If you want to apply lint and auto-fix before every commit, you can add the following to your `package.json`: