vscode-eslint: Autofix lightbulb not shown in TypeScript
The fixes lightbulb with suppress options does not show up in TypeScript files. If I manually change the language mode of a file to JavaScript, it shows up, and then disappears again if I change it back to TypeScript. The error shows as expected and I have the following settings enabled:
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 17
- Comments: 16 (7 by maintainers)
Commits related to this issue
- Activate eslint for typescript in vscode https://github.com/microsoft/vscode-eslint/issues/609#issuecomment-460554105 — committed to prettier/plugin-pug by deleted user 5 years ago
- Enable linting for typescript files Typescript was not being checked this whole time, oh well. I had to also enable linting for typescript in vscode-eslint. Not sure if I should commit that config t... — committed to Kinrany/template by Kinrany 5 years ago
- Remove vscode-eslint config instructions The special config instructions for [vscode-eslint](https://github.com/microsoft/vscode-eslint) are no longer necessary since the default [recently changed](h... — committed to theblang/create-react-app by theblang 4 years ago
Fixes are only automatically shown for JS right now. You can enable for TS using the following setting:
Keeping the issue open to consider if we should auto enable TS.
@dbaeumer I vote for an automatic validation and auto fix enabling for TypeScript files because of this https://github.com/typescript-eslint/typescript-eslint. I’m currently using it in VS Code and it works perfectly. I even think TSLint after some time will be abandoned… Even TypeScript team will use ESLint for their own repo, you can read it here: https://github.com/Microsoft/TypeScript/issues/29288 and here https://eslint.org/blog/2019/01/future-typescript-eslint
This got improved and fixed for 2.x. The extension now auto detects TypeScript. No config necessary.
This is actually easy and I can add this.
when config in project, it’s not work, but when i config it in user, it is ok
To me these settings are fine as-is. As I see it, this excellent plugin already has all the functionality it needs, it’s just that this one config setting is confusing. 😃
Specifically, as a user of the plugin, I expected that if I enter this in my settings…
… that it would result in TypeScript and TSX getting the same level of functionality as JavaScript and JSX.
The ability for the plugin to auto-detect the TS configuration etc, would be nice. But I would be very happy with just this small change, of only requiring
"typescript"
in the settings instead of{ "language": "typescript", "autoFix": true }
Could you use
CLIEngine.getConfigForFile()
to check for the presence of the@typescript-eslint
plugin? https://github.com/eslint/eslint/blob/master/docs/developer-guide/nodejs-api.md#clienginegetconfigforfile@agwells 1. and 2. are actually the case but the requests ask to make this a better out of the box expierence. So include
typescript
andtypscriptreact
in theeslint.validate
and even enable autofix. But this makes only sense when the linter is configured to lint TS files.