Not all of the ESLint rules are fixable (actually most of the rules are not fixable as of yet). You can find out which rules can be autofixed by looking for wrench glyph on this page: http://eslint.org/docs/rules/
None of the rules that you have errors for are currently autofixable. Some because the ESLint team hasn't gotten to them yet (like newline-after-var), some, because it's very likely to create a different logic then was intended in the original code (like eqeqeq) and some, because it's impossible to figure out the right way to autofix it (like no-unused-vars and no-redeclare)
Not all of the ESLint rules are fixable (actually most of the rules are not fixable as of yet). You can find out which rules can be autofixed by looking for wrench glyph on this page: http://eslint.org/docs/rules/
None of the rules that you have errors for are currently autofixable. Some because the ESLint team hasn't gotten to them yet (like newline-after-var), some, because it's very likely to create a different logic then was intended in the original code (like eqeqeq) and some, because it's impossible to figure out the right way to autofix it (like no-unused-vars and no-redeclare)
I've created a new Vue project using this command npm init vue@latest I have added prettier and eslint.
But I have a problem with eslint, it doesn't lint the code (I have inconsistency in the code, some lines end with a ; others not, mixing single and double quotes).
after running the npm run lint I get no error but the code is kept as it is, this is the output of the command:
> find-apartment@0.0.0 lint > eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore
I installed the eslint vs code extension but nothing changed.
Please how can I make the eslint work?
This is the content of the package.json and .eslintrc.cjs files
package.json
{
"name": "find-apartment",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore",
"format": "prettier --write src/"
},
"dependencies": {
"@supabase/supabase-js": "^2.24.0",
"pinia": "^2.0.36",
"vue": "^3.3.2",
"vue-router": "^4.2.0"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.2.0",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/eslint-config-prettier": "^7.1.0",
"eslint": "^8.39.0",
"eslint-plugin-vue": "^9.11.0",
"prettier": "^2.8.8",
"vite": "^4.3.5"
}
}.eslintrc.cjs
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')
module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}To use --fix option, you need to run eslint directly.
Try this
./node_modules/.bin/eslint src --fix
On Windows:
.\node_modules\.bin\eslint src\** --fix
The format should be:
./node_modules/.bin/eslint --fix path/to/file.js
See this thread (and aravind1078's answer) for more background.