ESLint Auto Fix on Nuxt.js
A quick solution to automatically lint-fix your files upon save on Nuxt.js using the eslint module.
Published on April 7, 2020
![](https://d33wubrfki0l68.cloudfront.net/2646535e094866f8b958d5126ba87b170c3d5247/c9594/_nuxt/images/eslint-auto-fix-on-nuxtjs-320.0d6faae.jpg)
Regardless what the documentation says, you can automatically lint your files just by including the module’s option within your nuxt configuration file, no extra loaders or anything!
Note: You must have @nuxtjs/eslint-module
installed, otherwise this won’t work.
Modify your configuration so it looks like this:
// nuxt.config.js
export default {
buildModules: ['@nuxtjs/eslint-module'],
eslint: {
fix: true
}
}
Now whenever you save your code it will automatically be fixed (not everything can be fixed automatically) by the eslint
module, you can for example ignore indentation, new-lines and white space while typing, because it will be fixed anyway upon save.
Thanks for reading and cya in the next post!