I want to use autofix in .vue
file, but Eslint only show the errors, no autofix.
How do I configure the .eslintrc
to make it work?
It will not work. I had exactly the same issue and asked this question here (surprised you haven't found it). I also asked them on Github and the answer is that they still not came with solution to use fix with plugins (vue-loader).
Eslint and VueJS files. Throwing errors but not fixing them
Here is thread on Github of Eslint: https://github.com/eslint/eslint/issues/7456#issuecomment-256757117
Hope it helps.
Assuming Vue.js 3, in your root directory, create a file vue.config.js
, if not exists already, and insert:
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
chainWebpack: config => {
config
.plugin('eslint')
.tap(args => {
args[0].fix = true
return args
})
}
})