Skip to content

Commit

Permalink
fix: Improve parse perf when using @typescript-eslint/parser
Browse files Browse the repository at this point in the history
Fixes #1408
See the above issue for justification.
  • Loading branch information
bradzacher authored and ljharb committed Jul 8, 2019
1 parent 3b21de6 commit 32704da
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion utils/parse.js
Expand Up @@ -31,7 +31,14 @@ exports.default = function parse(path, content, context) {
// provide the `filePath` like eslint itself does, in `parserOptions`
// https://github.com/eslint/eslint/blob/3ec436ee/lib/linter.js#L637
parserOptions.filePath = path


// @typescript-eslint/parser will parse the entire project with typechecking if you provide
// "project" or "projects" in parserOptions. Removing these options means the parser will
// only parse one file in isolate mode, which is much, much faster.
// https://github.com/benmosher/eslint-plugin-import/issues/1408#issuecomment-509298962
delete parserOptions.project;
delete parserOptions.projects;

// require the parser relative to the main module (i.e., ESLint)
const parser = moduleRequire(parserPath)

Expand Down

0 comments on commit 32704da

Please sign in to comment.