Setting up ESLint in nuxt 3
Scott Hanson
1 min read
I didn't find any clear guidelines on this, so this is what I ended up with:
Installed eslint and prettier as dev dependencies
Installed @nuxt/eslint-config and eslint-config-prettier
eslintrc.js
module.exports = { env: { node: true, }, extends: ['@nuxt/eslint-config', 'prettier'], rules: { 'no-unused-vars': [ 'error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_', }, ], 'vue/no-multiple-template-root': 'off', 'no-undef': 'off', }, }
'no-unused-vars' lets me keep unused variables that begin with an underscore.
vue3 lets you have multiple roots in a template, so allow that.
nuxt3 automatically imports globals, components and composables. 'no-undef' doesn't like that. Maybe if I were using TypeScript it would work better. 🤷♂️
0
Subscribe to my newsletter
Read articles from Scott Hanson directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by