eslint-plugin-nuxt
raw JSON → 4.0.0 verified Sat Apr 25 auth: no javascript
ESLint plugin providing Nuxt.js-specific linting rules, including checks for environment variables, lifecycle hooks, and correct usage of asyncData/fetch. Current stable version is 4.0.0, released in 2022. Maintained by the Nuxt team, it enforces best practices for Nuxt 2 and Nuxt 3 projects. Key differentiators: rules like no-env-in-context and no-this-in-fetch-data that catch common Nuxt pitfalls. Supports ESLint 8 and requires eslint-plugin-vue and vue-eslint-parser. Release cadence is sporadic with major version bumps aligning with Nuxt ecosystem updates.
Common errors
error Error: Failed to load plugin 'nuxt': Cannot find module 'eslint-plugin-nuxt' ↓
cause eslint-plugin-nuxt not installed
fix
npm install --save-dev eslint-plugin-nuxt
error Parsing error: The keyword 'import' is reserved ↓
cause Missing vue-eslint-parser or incorrect parser
fix
Add 'parser: vue-eslint-parser' to .eslintrc if not using presets
error Definition for rule 'nuxt/no-this-in-fetch-data' was not found ↓
cause The rule name might be misspelled or the version is too old
fix
Use correct rule name like 'nuxt/no-this-in-fetch-data' and ensure eslint-plugin-nuxt >=0.4
Warnings
breaking Node.js 12 support dropped in v4.0.0 ↓
fix Use Node.js 14 or later
breaking ESLint 7 dropped in v3.0.0, requires ESLint 8 ↓
fix Update ESLint to 8.x
breaking vue-eslint-parser v9 required in v4.0.0 ↓
fix Update vue-eslint-parser to v9
breaking eslint-plugin-vue v9 required in v4.0.0 ↓
fix Update eslint-plugin-vue to v9
deprecated Node 10 support dropped in v3.0.0 ↓
fix Use Node.js 12+ (but for v4, use Node 14+)
Install
npm install eslint-plugin-nuxt yarn add eslint-plugin-nuxt pnpm add eslint-plugin-nuxt Imports
- plugin:nuxt/recommended wrong
"extends": ["nuxt/recommended"]correct"extends": ["plugin:nuxt/recommended"] - plugins wrong
"plugins": ["eslint-plugin-nuxt"]correct"plugins": ["nuxt"] - nuxt/rule-name wrong
"rules": { "no-env-in-context": "error" }correct"rules": { "nuxt/no-env-in-context": "error" }
Quickstart
// .eslintrc.json
{
"extends": ["plugin:nuxt/recommended"],
"rules": {
"nuxt/no-env-in-context": "error"
}
}
// Install dependencies:
// npm install --save-dev eslint eslint-plugin-nuxt eslint-plugin-vue vue-eslint-parser