You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(eslint-config): supplement README from antfu upstream
Close the gap between @antfu/eslint-config's README and ours by porting
five sections that were missing:
- Config Composer: fluent .override() / .renamePlugins() / .remove() API
for when the plain pleaseai({...}) options aren't granular enough.
- Optional Rules — command: document eslint-plugin-command triple-slash
codemods (/// to-function, /// keep-sorted, ...) that ship with the
config. Marked the example with <!-- eslint-skip --> so our own lint
doesn't try to transform it.
- Neovim integration: nvim-lspconfig, conform.nvim, none-ls, nvim-lint
patterns for format-on-save alongside the existing VS Code section.
- Editor Specific Disables: explain isInEditor behaviour for prefer-const,
unused-imports, test/no-only-tests and the pnpm/* rules — a common
source of "why does it behave differently in my editor" confusion.
- Versioning Policy: Node/major refactors are breaking, rule changes are
not. Matches the policy inherited from @antfu/eslint-config.
Also added a "Top-level function style?" FAQ entry since PleaseAI
re-enables antfu/top-level-function and users hit this every time they
write an export const arrow function.
Copy file name to clipboardExpand all lines: packages/eslint-config/README.md
+154Lines changed: 154 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,37 @@ export default pleaseai(
102
102
)
103
103
```
104
104
105
+
### Config Composer
106
+
107
+
The factory function `pleaseai()` returns a [`FlatConfigComposer` object from `eslint-flat-config-utils`](https://github.com/antfu/eslint-flat-config-utils#composer), so you can chain methods to compose the config even more flexibly:
This is the composable escape-hatch when the plain `pleaseai({ ... })` options are not granular enough.
135
+
105
136
### Rules Overrides
106
137
107
138
Use the `overrides` option in each integration:
@@ -249,6 +280,40 @@ export default pleaseai({
249
280
bun add -D @angular-eslint/eslint-plugin @angular-eslint/eslint-plugin-template @angular-eslint/template-parser
250
281
```
251
282
283
+
### Optional Rules — `command`
284
+
285
+
`@antfu/eslint-config` ships with [`eslint-plugin-command`](https://github.com/antfu/eslint-plugin-command), which `@pleaseai/eslint-config` inherits. It is **not** a typical lint rule — it's an on-demand micro-codemod that triggers on specific triple-slash comments.
286
+
287
+
A few built-in triggers:
288
+
289
+
-`/// to-function` — converts an arrow function to a `function` declaration
290
+
-`/// to-arrow` — converts a `function` declaration to an arrow function
291
+
-`/// to-for-each` — converts a `for`-loop to `.forEach()`
292
+
-`/// to-for-of` — converts a `.forEach()` to a `for-of`
293
+
-`/// keep-sorted` — sorts the next object/array/interface
294
+
- …see the [plugin docs](https://github.com/antfu/eslint-plugin-command#built-in-commands) for the full list
295
+
296
+
Place the trigger one line above the code you want to transform:
297
+
298
+
<!-- eslint-skip -->
299
+
300
+
```ts
301
+
/// to-function
302
+
const foo =async (msg:string):Promise<void> => {
303
+
console.log(msg)
304
+
}
305
+
```
306
+
307
+
On the next `eslint --fix` (or auto-fix-on-save) it becomes:
308
+
309
+
```ts
310
+
asyncfunction foo(msg:string):Promise<void> {
311
+
console.log(msg)
312
+
}
313
+
```
314
+
315
+
The trigger comment is one-off — it's removed along with the transformation.
316
+
252
317
### Formatters
253
318
254
319
Use external formatters for files that ESLint cannot handle yet (`.css`, `.html`, etc):
When ESLint runs inside a code editor, a handful of rules are **disabled for auto-fix** so the editor doesn't aggressively rewrite code you're still typing:
> Since `@antfu/eslint-config` v3.16.0 these rules are not disabled — they're made **non-fixable** in editor mode. They still report, just without a quick-fix action.
440
+
441
+
Motivation: an unused import you just pasted shouldn't vanish the moment your editor auto-saves. The rules still apply when you run `eslint` in the terminal or through [Lint Staged](#lint-staged). If you prefer the uniform behaviour across editor and CLI, opt out:
442
+
443
+
```js
444
+
importpleaseaifrom'@pleaseai/eslint-config'
445
+
446
+
exportdefaultpleaseai({
447
+
isInEditor:false,
448
+
})
449
+
```
450
+
342
451
### Lint Staged
343
452
344
453
```json
@@ -378,6 +487,25 @@ This config inherits `@antfu/eslint-config`'s plugin renaming for a consistent D
`@pleaseai/eslint-config` follows [Semantic Versioning](https://semver.org/), but because it's an opinionated style preset with many moving parts, **rule changes are not treated as breaking changes**. The tables below match the policy inherited from `@antfu/eslint-config`.
493
+
494
+
### Considered breaking
495
+
496
+
- Node.js version requirement changes
497
+
- Large refactors that may break downstream configs
498
+
- Major plugin upgrades that may break existing rules
499
+
- Changes that likely affect most codebases
500
+
501
+
### Considered non-breaking
502
+
503
+
- Enabling/disabling individual rules or plugins (even if stricter)
504
+
- Changing rule options
505
+
- Dependency version bumps
506
+
507
+
If a rule tightening breaks your lint, pin to a previous minor version and open an issue so we can discuss the trade-off.
508
+
381
509
## FAQ
382
510
383
511
### Prettier?
@@ -390,6 +518,32 @@ If you need to format files that ESLint cannot handle yet (`.css`, `.html`, etc.
390
518
391
519
You can opt-in to the [`formatters`](#formatters) feature to format your CSS. Note that it only does formatting, not linting. If you want proper linting support, give [`stylelint`](https://stylelint.io/) a try.
392
520
521
+
### Top-level function style?
522
+
523
+
PleaseAI re-enables `antfu/top-level-function` on top of `lessOpinionated: true`, so top-level functions should use a `function` declaration rather than an arrow assigned to a `const`:
Arrow functions are still fine inside function bodies, as callbacks, or for inline JSX handlers — the rule only targets top-level declarations. If you disagree with this choice, override it:
536
+
537
+
```ts
538
+
importpleaseaifrom'@pleaseai/eslint-config'
539
+
540
+
exportdefaultpleaseai({
541
+
rules: {
542
+
'antfu/top-level-function': 'off',
543
+
},
544
+
})
545
+
```
546
+
393
547
### Curly braces style?
394
548
395
549
PleaseAI defaults to `lessOpinionated: true`, which enforces `curly: ['error', 'all']` — always require braces around control flow bodies:
0 commit comments