Skip to content

Fix ESLint extension config#33501

Merged
andrewbranch merged 2 commits intomicrosoft:masterfrom
andrewbranch:bug/vscode-eslint
Sep 19, 2019
Merged

Fix ESLint extension config#33501
andrewbranch merged 2 commits intomicrosoft:masterfrom
andrewbranch:bug/vscode-eslint

Conversation

@andrewbranch
Copy link
Copy Markdown
Member

/cc @IllusionMH

Thanks @uniqueiniquity for the fix!

Comment thread .vscode/settings.json
],
"eslint.options": {
"rulePaths": ["../scripts/eslint/built/rules/"],
"rulePaths": ["./scripts/eslint/built/rules/"],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised changing this allowed it to continue to work. For me, if the only change I make is the below, everything works fine.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the other paths are relative to the workspace root, though, so it kind of makes sense?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I do this locally, it breaks my setup :( it all depends on where the working directory of the eslint process is. Apparently on my machine, it's in the src folder, and it's not clear to me why. Maybe we should just set these to true and keep the leading .. so it's unambiguous?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, "set these to true" means changeProcessCWD: true in both cases.

Copy link
Copy Markdown
Contributor

@IllusionMH IllusionMH Sep 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. If I copy updated file - no error when I open tests/cases/fourslash/addMemberInDeclarationFile.ts, but fails in src/services/findAllReferences.ts

Error: ENOENT: no such file or directory, scandir 'c:\web\projects\TypeScript\src\scripts\eslint\built\rules'

If I change only "eslint.workingDirectories" it's reversed with error when tests/cases/fourslash/addMemberInDeclarationFile.ts is opened (as it is now in master).

Comment thread .vscode/settings.json Outdated
"ext": [".ts"]
},
"eslint.workingDirectories": ["./src", "./scripts"]
"eslint.workingDirectories": [
Copy link
Copy Markdown
Contributor

@IllusionMH IllusionMH Sep 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this option required for this repo?
I tried to remove it, used "rulePaths": ["./scripts/eslint/built/rules/"] and everything looks fine at first glance (for user who don't know what rules should be applied where):

  • space-in-parens, @typescript-eslint/semi, and custom boolean-trivia work in both src and scripts folders
  • no-var suppressed in src\lib\esnext.bigint.d.ts, but will be reported as error if I comment out supression.
  • no ENOENT and lint errors when I open files in tests folder

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right - since we only have one ESLint config file, we shouldn't need this.
Works well on my box as you suggest.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be fair - there is second src/.eslintrc.json config (and third in same folder), but I tried to tweak it (commented out no-var suppression) and saw expected results. Looks like files in overrides were resolved as patterns relative to config anyway.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, that works for me too.

@andrewbranch andrewbranch merged commit 816e3f3 into microsoft:master Sep 19, 2019
@andrewbranch andrewbranch deleted the bug/vscode-eslint branch September 19, 2019 18:35
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants