Skip to content

Commit

Permalink
feat: --debug prints time it takes to parse a file (#15609)
Browse files Browse the repository at this point in the history
* feat: --debug prints time it takes to parse a file

* Update lib/linter/linter.js

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* add separate logs for parsing and scope analysis

* lint

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
  • Loading branch information
bartlomieju and mdjermanovic committed Feb 20, 2022
1 parent 345e70d commit 115cae5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/linter/linter.js
Expand Up @@ -800,14 +800,21 @@ function parse(text, languageOptions, filePath) {
* problem that ESLint identified just like any other.
*/
try {
debug("Parsing:", filePath);
const parseResult = (typeof parser.parseForESLint === "function")
? parser.parseForESLint(textToParse, parserOptions)
: { ast: parser.parse(textToParse, parserOptions) };

debug("Parsing successful:", filePath);
const ast = parseResult.ast;
const parserServices = parseResult.services || {};
const visitorKeys = parseResult.visitorKeys || evk.KEYS;

debug("Scope analysis:", filePath);
const scopeManager = parseResult.scopeManager || analyzeScope(ast, languageOptions, visitorKeys);

debug("Scope analysis successful:", filePath);

return {
success: true,

Expand Down

0 comments on commit 115cae5

Please sign in to comment.