I'm using ESLint with its VS Code extension to format my code.
At some point it stopped auto-formatting the code on save. I uninstalled everything and reinstalled anew: VS Code, ESLint and ESLint extension for VS Code.
I think I'm close to making the formatter work, but ESLint logs this in VS Code when I try and save a file with a linting error:
2020-10-10T10:41:45.345Z eslint:source-code-fixer shouldFix parameter was false, not attempting fixes
I guess if I find that shouldFix
parameter and set it to true
it'll work, but where is it?
I'm using ESLint with its VS Code extension to format my code.
At some point it stopped auto-formatting the code on save. I uninstalled everything and reinstalled anew: VS Code, ESLint and ESLint extension for VS Code.
I think I'm close to making the formatter work, but ESLint logs this in VS Code when I try and save a file with a linting error:
2020-10-10T10:41:45.345Z eslint:source-code-fixer shouldFix parameter was false, not attempting fixes
I guess if I find that shouldFix
parameter and set it to true
it'll work, but where is it?
4 Answers
Reset to default 7The above solution didn't work for me. I had to explicity add the following to my VSCode settings.
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
I think maybe something in the newest VSCode update municating this with the plugin went wrong.
I managed to fix it changing the .eslintrc.js at the root of the project.
'parserOptions': {
'ecmaVersion': 12,
}
instead of
'parserOptions': {
'ecmaVersion': 2018,
}
I don't know why it worked till yesterday and then stopped.... but well that solved it for me.
Configuring a default formatter resolved this for me. From the extension's page:
eslint.format.enable (@since 2.0.0): uses ESlint as a formatter for files that are validated by ESLint. If enabled please ensure to disable other formatters if you want to make this the default. A good way to do so is to add the following setting "[javascript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" } for JavaScript. For TypeScript you need to add "[typescript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" }.
run npm run lint
this will start debugging your code with eslint and your error should be solve then,