Skip to content

Goto Definition Issue with eslint-plugin-perfectionist #939

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

Open
rgant opened this issue Jan 12, 2025 · 4 comments
Open

Goto Definition Issue with eslint-plugin-perfectionist #939

rgant opened this issue Jan 12, 2025 · 4 comments

Comments

@rgant
Copy link

rgant commented Jan 12, 2025

I am unable to "Goto Type Definition..." or "Goto Definition..." on eslint-plugin-perfectionist. It works for @eslint/js, globals, and typescript-eslint in eslint.config.mjs.

Minimal reproduction repo: https://github.com/rgant/tmp-eslint-perfectionist-test

I originally found this issue in a new Angular project and opened this ticket with the plugin developers. They have been very helpful in looking into this issue, but believe it is outside of their code. I created the above brand new repo to try and replicate the bug. But I was not able to get the same error message. However the code discovery actions are not working so it feel like there is something here to diagnose. But I am uncertain how to proceed.

When I reported this issue to LSP-typescript I was told:

Hello, Looks like the https://github.com/typescript-language-server/typescript-language-server returns a empty response, but only when doing a goto definition on this line:

import perfectionist from "eslint-plugin-perfectionist";
                                              ^ goto def here

https://github.com/rgant/tmp-eslint-perfectionist-test/blob/6b8b429ebe1eb5045e93eca632a16cb652d59914/eslint.config.mjs#L2

I have tested VS Code, and goto definition works there. I also tested a different language server vtsls and goto definition works there also.

The issue should ideally be reported to https://github.com/typescript-language-server/typescript-language-server/issues

@predragnikolic
Copy link
Contributor

Given the repo that can reproduce the issue
In the repo "moduleResolution" is set to "bundler"`.

Changing the setting "moduleResolution" to "node16" will make typescript-language-server work, and goto definition will work.
https://github.com/rgant/tmp-eslint-perfectionist-test/blob/6b8b429ebe1eb5045e93eca632a16cb652d59914/tsconfig.json#L11

The question is, how can vtsls and VS Code return a definition result even if "moduleResolution" is set to "bundler"?

@rgant
Copy link
Author

rgant commented Jan 12, 2025

That is the moduleResolution used for Angular projects:
https://github.com/rgant/brainfry/blob/000c4d30b522d15f6d44a48f3bd157159e3d55c2/tsconfig.json#L13

Which was the original source of the issue.

@predragnikolic
Copy link
Contributor

To be clear, Vtsls and VS Code do have the correct behavior, I just don't know what causes that behavior. typescript-language-server is just a thin abstraction on top of tsserver.

@rgant
Copy link
Author

rgant commented Jan 13, 2025

I wonder what is the difference is between eslint-plugin-perfectionist and @eslint/js, globals, and typescript-eslint? Because those all Goto Definition for me.

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

No branches or pull requests

2 participants