From 115cae54125b9ef509af90620f51d4a692b51ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 20 Feb 2022 15:05:34 +0100 Subject: [PATCH] feat: `--debug` prints time it takes to parse a file (#15609) * feat: --debug prints time it takes to parse a file * Update lib/linter/linter.js Co-authored-by: Milos Djermanovic * add separate logs for parsing and scope analysis * lint Co-authored-by: Milos Djermanovic --- lib/linter/linter.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/linter/linter.js b/lib/linter/linter.js index 9b9f4919207..5304a612a59 100644 --- a/lib/linter/linter.js +++ b/lib/linter/linter.js @@ -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,