-
Notifications
You must be signed in to change notification settings - Fork 323
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
No error report in editor on "unused-imports/no-unused-imports" #1767
Comments
@AlexMarlow25 you very likely need to let ESLint know about working directories using If this doesn't help, please provide me with a GitHub repository I can clone that demos what you are seeing. |
Sorry for a long response. Let me clear - ESLint works well in VSCode except these types of rules, which I described (unused-imports/***). I've tried to configure
|
I think I've found a problem! I inspected my config with "ts/no-unused-vars": [
0
], and "unused-imports/no-unused-vars": [
2,
{
"args": "after-used",
"argsIgnorePattern": "^_",
"vars": "all",
"varsIgnorePattern": "^_"
}
], In result I don't have errors on unused imported variables, as described earlier. But finally I will see them, if I set this rule manually in config to 'ts/no-unused-vars': [
2,
{
args: 'after-used',
argsIgnorePattern: '^_',
vars: 'all',
varsIgnorePattern: '^_',
},
], From that moment I think, that a problem somewhere on a WebStorm side 😅 Or I am completely confused. |
I have encounterd the same problem, for example: https://github.com/yunsii/cf-worker-status-page-pro/blob/32f076f16843025d06e6223b379f0eceb3447f8b/scripts/public-assets.ts#L3 If I add a extra import import { chalk, fs, path } from 'zx' VS Code report no error, but
|
@yunsii can you please provide me with a GitHub repository I can clone with a minimal repro case. Otherwise it is hard to say why it is not working. |
Okey, I will try to create a minimal repro later. |
@dbaeumer It's really strange:
After my deep investiagtion, it seems that there is a difference between eslint cli and vscode-eslint. Specifically,
But there is only 1 error in editor: |
@yunsii thank you for your repo! In the isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.VSCODE_CWD || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
...
"unused-imports/no-unused-imports": isInEditor ? "off" : "error", A very non-obvious behavior for a library is to disable errors in the editor. If we put both facts together, it seems that this variable does not work for WebStorm and therefore there are errors there, but not in the VSCode. |
@AlexMarlow25 thanks a lot for the great investigation. Indeed very strange to disable errors in an editor. |
Hi! Unfortunately, plugin is not showing and not fixing errors in editor for "unused-imports/no-unused-imports" rule.
If I run npm script "eslint .", I will see these errors in a terminal. Also, I can see these errors in WebStorm IDE, but not in VS Code.
The text was updated successfully, but these errors were encountered: