'How to use eslint autofix in .vue?
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?
Solution 1:[1]
Try to use it with specifying files extensions
eslint --fix --ext .js,.vue src
Solution 2:[2]
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.
Solution 3:[3]
vue 3 -> vue.config.js
module.exports = defineConfig({
chainWebpack: config => {
config
.plugin('eslint')
.tap(args => {
args[0].fix = true
return args
})
}
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Oleg Abrazhaev |
| Solution 2 | Community |
| Solution 3 | Abraao Bueno |
