Skip to content

Commit 61af8d5

Browse files
committed
docs(eslint-config): add Nuxt integration guide and NPM scripts section
Add /eslint-config/nuxt documenting how to compose @pleaseai/eslint-config with @nuxt/eslint — Quick Setup via nuxi, the standalone:false preset switch that avoids duplicate JS/TS/Vue plugins, and the withNuxt wrapping pattern using pleaseai() as the base config. Also lift the lint / lint:fix npm scripts snippet from the Nuxt page into the main ESLint Config page, since it applies to every project and was previously undocumented there.
1 parent 8082dd9 commit 61af8d5

2 files changed

Lines changed: 82 additions & 0 deletions

File tree

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

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

79+
## NPM Scripts
80+
81+
Add the lint commands to your `package.json` script section:
82+
83+
```json [package.json]
84+
{
85+
"scripts": {
86+
"lint": "eslint .",
87+
"lint:fix": "eslint . --fix"
88+
}
89+
}
90+
```
91+
92+
Run `npm run lint` to check if the code style is correct, or `npm run lint:fix` to automatically fix issues.
93+
7994
## Defaults
8095

8196
| Option | Value |
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: Nuxt Integration
3+
description: Use @pleaseai/eslint-config together with @nuxt/eslint in a Nuxt project.
4+
---
5+
6+
# Nuxt Integration
7+
8+
[`@nuxt/eslint`](https://eslint.nuxt.com/packages/module) is the official ESLint module for Nuxt. It generates a project-aware flat config at `./.nuxt/eslint.config.mjs` that knows about your auto-imports, components directory, and pages, so ESLint can correctly resolve Nuxt globals without manual rules.
9+
10+
`@pleaseai/eslint-config` composes cleanly with `@nuxt/eslint` — the module supplies the Nuxt-specific rules, and `@pleaseai/eslint-config` provides the rest.
11+
12+
## Quick Setup
13+
14+
Add the module with Nuxi — it installs `@nuxt/eslint` and wires it into `nuxt.config.ts` automatically:
15+
16+
```bash [Terminal]
17+
npx nuxi@latest module add eslint
18+
```
19+
20+
This gives you a default setup that pulls in ESLint's JS, TS, and Vue plugins on top of the Nuxt-aware rules.
21+
22+
## Custom Config Presets
23+
24+
By default the module installs the JS, TS, and Vue plugins with their recommended rules. Since `@pleaseai/eslint-config` (via `@antfu/eslint-config`) already covers those, disable the default preset by setting `standalone: false` so the module only emits Nuxt-specific rules:
25+
26+
```ts [nuxt.config.ts]
27+
export default defineNuxtConfig({
28+
modules: [
29+
'@nuxt/eslint',
30+
],
31+
eslint: {
32+
config: {
33+
standalone: false,
34+
},
35+
},
36+
})
37+
```
38+
39+
Then create `eslint.config.mjs` that wraps `@pleaseai/eslint-config` with the `withNuxt` helper generated by the module:
40+
41+
```js [eslint.config.mjs]
42+
// @ts-check
43+
import pleaseai from '@pleaseai/eslint-config'
44+
import withNuxt from './.nuxt/eslint.config.mjs'
45+
46+
export default withNuxt(
47+
pleaseai({
48+
// ...@pleaseai/eslint-config options
49+
vue: true,
50+
}),
51+
// ...your other flat config items
52+
)
53+
```
54+
55+
`withNuxt` merges its arguments after the Nuxt-aware rules, so anything you pass (including the `@pleaseai/eslint-config` output) takes precedence over the defaults provided by `@nuxt/eslint`.
56+
57+
## Why `standalone: false`?
58+
59+
Without it, `@nuxt/eslint` and `@pleaseai/eslint-config` both install the JS/TS/Vue plugins, producing duplicate-rule warnings and doubling the resolved config size. Setting `standalone: false` scopes the module down to the parts that only Nuxt knows about (auto-imports, component directory globals, page structure) and lets `@pleaseai/eslint-config` own the language tooling.
60+
61+
## Running ESLint
62+
63+
The standard `lint` / `lint:fix` scripts documented on the [main ESLint Config page](/eslint-config#npm-scripts) work unchanged once `@nuxt/eslint` is wired up.
64+
65+
::note
66+
See the [`@nuxt/eslint` module docs](https://eslint.nuxt.com/packages/module) for additional options like custom rule overrides, per-directory configs, and dev-mode integration.
67+
::

0 commit comments

Comments
 (0)