Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why is the exlint:source-code-fxer shouldFix parameter false #1846

Open
dagda1 opened this issue May 14, 2024 · 7 comments
Open

why is the exlint:source-code-fxer shouldFix parameter false #1846

dagda1 opened this issue May 14, 2024 · 7 comments
Labels
info-needed Issue requires more information from poster

Comments

@dagda1
Copy link

dagda1 commented May 14, 2024

I am using eslint v8.57.0 and I use eslint-config-prettier with my prettier rules in my eslint config.

I have pasted my eslint settings from my vscode settings at the end of this post.

Formatting on save has suddenly stopped working and I have no idea why.

I did notice this entry in the eslint output of vscode.

eslint:source-code-fixer shouldFix parameter was false, not attempting fixes

I can see this in the eslint source code here.

And it appears to be an option that is somehow passed in as option here.

Can I set this value on the extension so that it starts formatting on save again?

  "eslint.debug": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  },
  "eslint.codeActionsOnSave.mode": "all",
  "eslint.timeBudget.onFixes": {
    "warn": 300000,
    "error": 600000
  },
  "eslint.onIgnoredFiles": "warn",
  "editor.formatOnSave": false,
  "eslint.lintTask.enable": true,
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact"
  ],
  "[javascript]": {
    "editor.formatOnSave": false,
  },
  "[javascriptreact]": {
    "editor.formatOnSave": false
  },
  "[typescript]": {
    "editor.formatOnSave": false
  },
  "[typescriptreact]": {
    "editor.formatOnSave": false
  },
  
@dagda1
Copy link
Author

dagda1 commented May 15, 2024

rolling back @typescript-eslint/eslint-plugin to 7.7.0 fixed my problem but I am still curious to know how that fix parameter can be set.....if indeed it can be set externally,

@dbaeumer
Copy link
Member

You can pass options to the linter using eslint.options settings. The option structure is decribed here: https://eslint.org/docs/latest/integrate/nodejs-api#-new-eslintoptions

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label May 15, 2024
@dbaeumer
Copy link
Member

Let me know how it goes.

@Derasm
Copy link

Derasm commented May 19, 2024

@dbaeumer can this option be set in the eslint.config.js file? It seems like VsCode autosets the "source.fixAll.eslint" to "explicit" now, as it doesn't support boolean values anymore.

@dbaeumer
Copy link
Member

@Derasm yes that is correct. But the extension / VS Code handles them equally so things should work the same way. Do you see it not working with the explicity value?

@dagda1
Copy link
Author

dagda1 commented May 21, 2024

@dbaeumer I console logged the fix value in the source code of eslint in node_modules here and it was false until I rolled back @typescript-eslint/eslint-plugin to 7.7.0

@dbaeumer
Copy link
Member

The options literal passed to the linter is the one from eslint.options. I don't set any fix property on it to ensure the default is taken. So I am a little bit lost why this is false for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants