Context / Problem
Currently, the template uses Prettier for formatting, but lacks an aggressive linter like ESLint. For a team of students (like in EPICS) learning Vue 3 and Nuxt 4, a strict linter is essential to catch logic errors, reactivity pitfalls (like destructuring props incorrectly), and unused variables before they become bugs. Furthermore, ensuring standard format on save and running typechecks are needed for a strong developer guardrail.
Proposed Solution
Integrate @nuxt/eslint to provide Nuxt-specific linting rules. This will act as a strong developer guardrail. Since we already use Prettier (with a Tailwind plugin) for formatting, we will configure ESLint to handle logic checks only and avoid formatting conflicts. Additionally, we will add standard formatting scripts, ensure .vscode is configured properly, and define type-checking scripts.
Implementation Details
- Install the necessary dependencies:
pnpm add -D eslint @nuxt/eslint
- Update
nuxt.config.ts to include the ESLint module and disable stylistic formatting to prevent conflicts with Prettier:
export default defineNuxtConfig({
modules: [
'@nuxt/eslint'
],
eslint: {
config: {
stylistic: false // Prevents conflict with Prettier
}
}
})
- Create an
eslint.config.mjs file in the root directory to enable IDEs and the CLI to pick up the Nuxt generated rules:
import withNuxt from './.nuxt/eslint.config.mjs'
export default withNuxt()
- Add
lint, format, and typecheck scripts to package.json:
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write .",
"typecheck": "nuxi typecheck"
}
- Create
.vscode/settings.json to enable ESLint "fix on save" and Prettier formatting on save for contributors:
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
Acceptance Criteria
Context / Problem
Currently, the template uses Prettier for formatting, but lacks an aggressive linter like ESLint. For a team of students (like in EPICS) learning Vue 3 and Nuxt 4, a strict linter is essential to catch logic errors, reactivity pitfalls (like destructuring props incorrectly), and unused variables before they become bugs. Furthermore, ensuring standard format on save and running typechecks are needed for a strong developer guardrail.
Proposed Solution
Integrate
@nuxt/eslintto provide Nuxt-specific linting rules. This will act as a strong developer guardrail. Since we already use Prettier (with a Tailwind plugin) for formatting, we will configure ESLint to handle logic checks only and avoid formatting conflicts. Additionally, we will add standard formatting scripts, ensure.vscodeis configured properly, and define type-checking scripts.Implementation Details
nuxt.config.tsto include the ESLint module and disable stylistic formatting to prevent conflicts with Prettier:eslint.config.mjsfile in the root directory to enable IDEs and the CLI to pick up the Nuxt generated rules:lint,format, andtypecheckscripts topackage.json:.vscode/settings.jsonto enable ESLint "fix on save" and Prettier formatting on save for contributors:{ "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" } }Acceptance Criteria
@nuxt/eslintis installed and configured.eslint.config.mjsis created at the root level.pnpm run lintsuccessfully lints the project.pnpm run formatsuccessfully formats the project.pnpm run typechecksuccessfully validates TypeScript types.