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
ESLint setup in VS Code #20996
Comments
@retrofox @brbrr @davidlonjon Is this still an issue for you? |
Yeah, I'm facing the same issue when trying to save changes in Jetpack's JS code |
and I think @sdixon194 was experiencing something similar recently |
Hi @jeherve, I actually always had a very similar issue (since I setup Jetpack Monorepo for the first time) but with PHPStorm as shown in the following screenshots: When on the When on a JS file inside the Jetpack Boost plugin directory: Today I am still experiencing it in PHPStorm. I did not have the opportunity to try it on VSCode but I guess the root of the issue for both IDE is related. |
After trying out a few things, it seems that adding a
I tried to add them on the
without having the So while having a
After doing the commands above the However before the fix, the folder looked like: So it seems the Note the content of the I don't know much about PNPM and how it works as well as Eslint. I am actually if this fix is just a dirty hack and might not be too relevant to try to find a final solution but hopefully, this can help. |
Interesting, nice catch! You would expect the link to
Yes, we'd have to add svelte to the configuration, just like I did for Typescript in #20537. |
Just pushing an update in top of this. I fixed this problem exporting the NODE_PATH auto-generated from PNPM. It's located at:
I don't think is the best solution, since this is auto-generated and could change easily, but it makes the eslint work again. Will continue to search more solutions for that, since it's related with PNPM way of hoist deps (thanks @anomiex for point that). |
Just chiming in that I have this problem as well :D |
Facing a similar issue, VS Code output says
|
Here is the full error with Prettier for me:
|
Having the same problem here with VSCode. Using |
Why is I think it belongs to |
It was added in #21568. We currently do not have a cascading Prettier configuration with multiple config files for each plugin / project in the monorepo. It may be worth giving it a try indeed, that seems logical, although I do not know if Prettier currently supports that kind of cascading setup? |
We do this this in root {
useTabs: true,
tabWidth: 2,
printWidth: 100,
singleQuote: true,
trailingComma: 'es5',
bracketSpacing: true,
parenSpacing: true,
jsxBracketSameLine: false,
semi: true,
arrowParens: 'avoid',
} Then in package specific {
...require('../../../.prettierrc.js'),
plugins: [ 'prettier-plugin-svelte' ],
svelteStrictMode: false,
svelteBracketNewLine: true,
svelteIndentScriptAndStyle: true,
svelteSortOrder: 'options-scripts-styles-markup',
} |
Also, with regards to ESLint, extending a base config doesn't mean that the dependencies (eslint plugins) will be used from the base config location, those would rather be looked at the location ( So, it means if we extend any ESLint config, we will have to add all the underlying dependencies as well. |
While the documentation does say that, in practice we already have various plugins that are only installed within |
CLI and IDE work differently. When using ESLint CLI, plugins are loaded relative to CWD but when using npm packages (used by IDEs), plugins are loaded relative to config files.
https://eslint.org/docs/user-guide/command-line-interface#options |
The issue is much deeper than it looks. There is a feature request which is still open eslint/eslint#3458. The current state of ESLint doesn't work for monorepos as we expect it to... Good news is that there is a workaround exactly for issue we are facing - @rushstack/eslint-patch. I tested it and it works with minimal changes. Will try to create a PR today. |
There are 2 main ways to lint JS files in our monorepo:
pnpm lint-file filename
command to lint a file from your terminal.For some reason, the latter doesn't seem to work in VS Code anymore.
I wonder if it could be related to our switch to PNPM and its workspaces, or to the changes we made in #20085.
Steps to reproduce
Here is the output on my end today:
Previous conversations on the topic:
The text was updated successfully, but these errors were encountered: