Fix ESLint extension config#33501
Conversation
| ], | ||
| "eslint.options": { | ||
| "rulePaths": ["../scripts/eslint/built/rules/"], | ||
| "rulePaths": ["./scripts/eslint/built/rules/"], |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
All the other paths are relative to the workspace root, though, so it kind of makes sense?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Sorry, "set these to true" means changeProcessCWD: true in both cases.
There was a problem hiding this comment.
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).
| "ext": [".ts"] | ||
| }, | ||
| "eslint.workingDirectories": ["./src", "./scripts"] | ||
| "eslint.workingDirectories": [ |
There was a problem hiding this comment.
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 customboolean-triviawork in bothsrcandscriptsfoldersno-varsuppressed insrc\lib\esnext.bigint.d.ts, but will be reported as error if I comment out supression.- no
ENOENTand lint errors when I open files intestsfolder
There was a problem hiding this comment.
You're right - since we only have one ESLint config file, we shouldn't need this.
Works well on my box as you suggest.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Cool, that works for me too.
/cc @IllusionMH
Thanks @uniqueiniquity for the fix!