This is an ESLint config for all Nuxt.js projects.
-
npm i @novicell/eslint-config-nuxt
-
Create a .eslintrc.json
in the root of the project
-
Add the following 👇
{
"extends": "@novicell/eslint-config-nuxt",
"rules": {
}
}
-
Add lint scripts to package.json
"scripts": {
"eslint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"eslint:fix": "eslint --ext .js,.vue --ignore-path .gitignore . --fix",
}
-
Make VS Code autofix issues on save (optional)
- Create a
.vscode
folder in root and add settings.json
to it - Add the following
{
"css.validate": false,
"less.validate": false,
"scss.validate": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
}
}
-
Configure webpack to autofix eslint issues during build (optional)
extend (config, { isDev, isClient }) {
if (isDev && isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue|ts)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/,
options: {
fix: true
}
});
}
}
Looking to contribute something? Here's how you can help. Please take a moment to review our contribution guidelines in order to make the contribution process easy and effective for everyone involved.