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

import/resolver with rules from import/errors and using @typescript-esint/parser causes VSCode to hang while saving files #163

Closed
lachlanhunt opened this issue Aug 3, 2022 · 5 comments

Comments

@lachlanhunt
Copy link

Given this .eslintrc.js

module.exports = {
  parser: '@typescript-eslint/parser',
  plugins: ['import'],
  rules: {
    'import/no-unresolved': 2, // Enabling one or more of these 3 rules causes the issue.
    // 'import/named': 2,
    // 'import/namespace': 2,
  },
  settings: {
    'import/resolver': {
      typescript: {},
    },
  },
};

Then with with the ESLint extension for VSCode installed, and enabling this option in VSCode's settings.json

    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },

This causes VSCode to get stuck while trying to save, showing a dialog saying "Getting code actions from ESLint ...".

I have tried to diagnose this issue by following the advice in microsoft/vscode-eslint#1344, but I've only been able to narrow it down to this combination of settings. I don't actually know for sure if the bug is somewhere in these 3 rules, in typescript's parser or the ESLint plugin, or even somewhere else. But I've only had this issue occur with either of those 3 specific rules enabled.

I've only been able to workaround this by disabling the 3 rules: import/no-unresolved, import/named and import/namespace.

@JounQin
Copy link
Collaborator

JounQin commented Aug 3, 2022

I don't understand why the issue is created here, this resolver has nothing to do with the editor, why you think this is caused by this resolver instead of the import plugin or vscode-eslint extension, or even VSCode itself?

@vire
Copy link

vire commented Aug 3, 2022

Sadly I can only confirm that disabling import/no-unresolved, import/named and import/namespace did NOT resolve the "Getting code actions from ESLint ...". problem.

@JounQin
Copy link
Collaborator

JounQin commented Aug 3, 2022

Sadly I can only confirm that disabling import/no-unresolved, import/named and import/namespace did NOT resolve the "Getting code actions from ESLint ...". problem.

So there is nothing related to this resolver.

@JounQin JounQin closed this as not planned Won't fix, can't repro, duplicate, stale Aug 3, 2022
@lachlanhunt
Copy link
Author

I opened it here because I mistakenly thought this was the repo for the import plugin. Both are within import-js and I didn't notice, so that was my mistake. I did intend to open it in import-js/eslint-plugin-import.

But also, in that microsoft/vscode-eslint#1344 issue I linked to, it very clearly explained that issues like this are more likely caused by slow eslint plugins, rather than VSCode or the extension itself.

Would you prefer I reopen the issue within in import-js/eslint-plugin-import?

@JounQin
Copy link
Collaborator

JounQin commented Aug 3, 2022

@lachlanhunt I think there are already issues for performance problems, see https://github.com/import-js/eslint-plugin-import/issues?q=performance+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants