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: 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.
Copy file name to clipboardExpand all lines: docs/content/1.eslint-config/1.index.md
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,6 +76,25 @@ export default pleaseai(
76
76
)
77
77
```
78
78
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:
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`
101
120
|`typescript`|`true`|
102
121
|`gitignore`|`true`|
103
122
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
+
importpleaseaifrom'@pleaseai/eslint-config'
131
+
132
+
exportdefaultpleaseai({
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
+
exportfunction greet(name:string) {
146
+
return`Hello, ${name}`
147
+
}
148
+
```
149
+
150
+
Override it if you disagree:
151
+
152
+
```ts [eslint.config.ts]
153
+
importpleaseaifrom'@pleaseai/eslint-config'
154
+
155
+
exportdefaultpleaseai({
156
+
rules: {
157
+
'antfu/top-level-function': 'off',
158
+
},
159
+
})
160
+
```
161
+
104
162
## VS Code Integration
105
163
106
164
Install the [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and add to your `.vscode/settings.json`:
0 commit comments