-
Notifications
You must be signed in to change notification settings - Fork 341
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-relative-import-paths plugin not reported as error by the extension in some cases #1594
Comments
@jgoux this is very likely a problem of a correct working directory setup. Looks like validation happens correctly in the terminal when in the api directory. Such a working directory must be know to the extension as well. See the setting |
This is my {
"eslint.workingDirectories": [
{
"pattern": "./apps/*/"
},
{
"pattern": "./packages/*/"
}
],
} It reflects all my apps/packages roots in my monorepo. |
Looks ok. Can you please provide me with a Github repository I can clone that demos what you are seeing. This ensures that we both look at the same setup. |
@dbaeumer Sorry for the delay! Here is a reproduction: https://github.com/jgoux/vscode-eslint-imports I tested in a non-monorepo setup and VSCode ESLint was able to report the error correctly. So there is definitely something related to the monorepo structure here. |
The underlying problem is that the plugin does path math without using the path npm module which results in a path with |
See also #1605 to avoid these situations as well. |
Thanks for tracking it down! Is your PR fixing the issue or do we have to fix the issue in MelvinVermeer/eslint-plugin-no-relative-import-paths#23 ? |
Mine works around it but MelvinVermeer/eslint-plugin-no-relative-import-paths#23 should be addressed as well. |
Hello,
I'm using https://github.com/MelvinVermeer/eslint-plugin-no-relative-import-paths and I'm having trouble having vscode-eslint reporting errors in my import statements.
Running eslint CLI against my file works as expected, the error is seen and fixable, but somehow vscode-eslint is missing it.
What's even more strange is that if I change the plugin's options, vscode-eslint is able to pick up the rule. But the combination that I want to use isn't detected.
With the CLI:
You can see that vscode-eslint isn't seeing the issue (line 3 should be in error).
If I change the options of the plugin from:
to:
The vscode extension is now able to see the error:
It seems that no matter what I put in
rootDir
, if it's not an empty string, vscode-eslint won't report the error (but the CLI works as expected, and there is no open issue about the plugin not working as I intend to use it in their repository).It's the only rule acting this way among my numerous other rules. 😅
The extension is using my local eslint library installed in my monorepo:
[Info - 11:28:27] ESLint library loaded from: /Users/jgoux/Documents/code/snaplet-labs/node_modules/eslint/lib/api.js
The text was updated successfully, but these errors were encountered: