Skip to content

Commit 12f4ed5

Browse files
committed
docs: surface Config Composer, editor disables, and top-level function FAQ
Mirror the most impactful README additions into the docs site page so browser visitors don't have to hop to npm for advanced usage: - Config Composer section under Usage (fluent .override() / .remove()) - Editor Specific Disables section above FAQ (isInEditor behaviour) - FAQ section with the top-level function style explanation README stays the complete reference; the docs page keeps its quick-start shape but covers the three topics users hit most often.
1 parent ac90468 commit 12f4ed5

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

docs/content/1.eslint-config/1.index.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,25 @@ export default pleaseai(
7676
)
7777
```
7878

79+
### Config Composer
80+
81+
`pleaseai()` returns a [`FlatConfigComposer`](https://github.com/antfu/eslint-flat-config-utils#composer), so you can fluently override, prepend, or remove named config blocks when the plain options object isn't granular enough:
82+
83+
```ts [eslint.config.ts]
84+
import pleaseai from '@pleaseai/eslint-config'
85+
86+
export default pleaseai()
87+
.override('antfu/stylistic/rules', {
88+
rules: {
89+
'style/generator-star-spacing': ['error', { after: true, before: false }],
90+
},
91+
})
92+
.renamePlugins({
93+
'old-prefix': 'new-prefix',
94+
})
95+
.remove('antfu/stylistic')
96+
```
97+
7998
## NPM Scripts
8099

81100
Add the lint commands to your `package.json` script section:
@@ -101,6 +120,45 @@ Run `npm run lint` to check if the code style is correct, or `npm run lint:fix`
101120
| `typescript` | `true` |
102121
| `gitignore` | `true` |
103122

123+
## Editor Specific Disables
124+
125+
When ESLint runs inside a code editor, a handful of rules (`prefer-const`, `unused-imports/no-unused-imports`, `test/no-only-tests`, several `pnpm/*` rules) report as non-fixable so your editor doesn't aggressively rewrite code you're still typing. The same rules apply normally when you run `eslint` in the terminal or through a pre-commit hook, so nothing slips through.
126+
127+
If you want editor and CLI to behave identically, opt out:
128+
129+
```ts [eslint.config.ts]
130+
import pleaseai from '@pleaseai/eslint-config'
131+
132+
export default pleaseai({
133+
isInEditor: false,
134+
})
135+
```
136+
137+
## FAQ
138+
139+
### Top-level function style?
140+
141+
PleaseAI re-enables `antfu/top-level-function`, 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.
142+
143+
```ts
144+
// ✓ preferred
145+
export function greet(name: string) {
146+
return `Hello, ${name}`
147+
}
148+
```
149+
150+
Override it if you disagree:
151+
152+
```ts [eslint.config.ts]
153+
import pleaseai from '@pleaseai/eslint-config'
154+
155+
export default pleaseai({
156+
rules: {
157+
'antfu/top-level-function': 'off',
158+
},
159+
})
160+
```
161+
104162
## VS Code Integration
105163

106164
Install the [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and add to your `.vscode/settings.json`:

0 commit comments

Comments
 (0)