eslint integration with vscode broken in browser/components/newtab
Categories
(Firefox :: Messaging System, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox75 | --- | unaffected |
firefox76 | --- | unaffected |
firefox77 | --- | wontfix |
firefox115 | --- | fixed |
People
(Reporter: k88hudson, Assigned: aminomancer)
References
(Blocks 3 open bugs)
Details
Attachments
(2 files)
As of last week(?) it looks like vscode's eslint plugin is having trouble finding the right packages when trying to lint code inside browser/component/newtab. I see a bunch of errors like this:
Definition for rule 'getter-return' was not found
Definition for rule 'no-global-assign' was not found
Definition for rule 'no-return-await' was not found
Some observations, although I don't know what the cause / fix is for this:
- deleting browser/components/newtab/node_modules fixes the issue, so probably a problem with the eslint plugin not adding the right folders to the node PATH
- mach lint is unaffected
Reporter | ||
Comment 1•5 years ago
|
||
Adding this to my vscode workspace settings temporarily fixes issue, although I think we need a solution that doesn't involve doing this manually:
{
"eslint.nodePath": "./node_modules"
}
Comment 2•5 years ago
•
|
||
It's too bad that eslint doesn't have an option to just replace the head of the command (so that we could start our command with something like mach lint -l eslint
). We'd have to prototype to see if that was really a good solution. I wonder if the extension author would accept a patch for that...
Comment 3•5 years ago
|
||
Given that removing browser/components/newtab/node_modules
fixes the issue, I think it'd be worth figuring out what can be done with saaslint (which has an older version of ESLint as a dependency). I've had issues with ESLint in the past where there's been two different versions in tree, and the wrong version can be picked up at times.
You can probably confirm this by just removing browser/components/newtab/node_modules/eslint
(and maybe eslint-scope
).
We might be able to add "root": true
to newtab's .eslintrc.js, and install ESLint into newtab again. However, I think it could still cause problems depending on what ESLint does. It'd also mean that newtab's config would be separate to the rest of m-c, which I'm not really keen on - I'd like to start working to harmonise the configs and get a clearer picture of what is different and why.
Comment 4•5 years ago
|
||
This is apparently fixed in the master branch of sasslint, but sasslint hasn't been released from master in almost a year: https://github.com/sasstools/sass-lint/issues/1288
Comment 5•5 years ago
|
||
Newtab could consider switching to stylelint: https://stylelint.io/
Updated•5 years ago
|
Comment 6•5 years ago
|
||
There's a lot to like about stylelint, but it has many more dependencies than sasslint. On the other hand, there's high security value in a package that is actually actively maintained.
Since the fix is on sasslint master, the simplest thing we could do is just create our own release based on sasslint-master and depend on that. We could do that by forking sasslint-master, but since we're not really changing the code, we don't even necessarily have to do that.
I'd suggest that we start with the sasslint master , and file a separate bug to evaluate stylelint. Standard8, any opinion on the best way to do this forking or non-forking?
Comment 7•5 years ago
|
||
Sorry, no opinions. If you publish anything on npm, you might get stuck maintaining it though...
Comment 8•5 years ago
|
||
My thinking was not to publish it on npm. I was sort of thinking of keeping a local copy in the tree e.g. in tools/lint/sasslint. Thoughts?
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 9•2 years ago
|
||
Something useful I found: https://dev.to/stories_of_ren/switching-from-sass-lint-to-stylelint-5f8c
Assignee | ||
Comment 10•2 years ago
|
||
Fix a bug where VS Code's eslint integration does not work for the
newtab project because of a conflict caused by sass-lint's eslint
dependency. Switching over to stylelint eliminates that dependency and
generally modernizes our SCSS linting. stylelint doesn't have a 1 to 1
replacement for every sass-lint rule, so a few rules have been changed.
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 11•2 years ago
|
||
Assignee | ||
Comment 12•2 years ago
|
||
Comment 13•2 years ago
|
||
Comment 14•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/84a1894bdd4d
https://hg.mozilla.org/mozilla-central/rev/b496bf4aa91a
Updated•2 years ago
|
Description
•