|
| 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