Skip to content

Commit 32704da

Browse files
bradzacherljharb
authored andcommitted
fix: Improve parse perf when using @typescript-eslint/parser
Fixes #1408 See the above issue for justification.
1 parent 3b21de6 commit 32704da

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: utils/parse.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ exports.default = function parse(path, content, context) {
3131
// provide the `filePath` like eslint itself does, in `parserOptions`
3232
// https://github.com/eslint/eslint/blob/3ec436ee/lib/linter.js#L637
3333
parserOptions.filePath = path
34-
34+
35+
// @typescript-eslint/parser will parse the entire project with typechecking if you provide
36+
// "project" or "projects" in parserOptions. Removing these options means the parser will
37+
// only parse one file in isolate mode, which is much, much faster.
38+
// https://github.com/benmosher/eslint-plugin-import/issues/1408#issuecomment-509298962
39+
delete parserOptions.project;
40+
delete parserOptions.projects;
41+
3542
// require the parser relative to the main module (i.e., ESLint)
3643
const parser = moduleRequire(parserPath)
3744

0 commit comments

Comments
 (0)