Vscode-eslint: How to debug or add verbose output?

Created on 4 Jan 2019  路  7Comments  路  Source: microsoft/vscode-eslint

Is there some way I can get verbose output from eslint inside vscode about which files its checking and where it's getting the configuration info from for each file it checks?

feature-request help wanted

Most helpful comment

@synchronos-t I was just in the process of implementing this. A next version will have a 'eslint.debug' setting which prints something like this to the console:

2019-11-13T13:41:40.975Z eslint:ignored-paths contains:
2019-11-13T13:41:40.975Z eslint:ignored-paths target = "C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\test.js"
2019-11-13T13:41:40.975Z eslint:ignored-paths base = "C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib"
2019-11-13T13:41:40.975Z eslint:ignored-paths relative = "test.js"
2019-11-13T13:41:40.976Z eslint:ignored-paths result = false
2019-11-13T13:41:40.976Z eslint:cascading-config-array-factory Load config files for C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib.
2019-11-13T13:41:40.976Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib.
2019-11-13T13:41:40.976Z eslint:config-array-factory Loading JSON config file: C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib.eslintrc.json
2019-11-13T13:41:40.976Z eslint:config-array-factory Config file found: C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib.eslintrc.json
2019-11-13T13:41:40.976Z eslint:config-array-factory Loading plugin "html" from C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib.eslintrc.json
2019-11-13T13:41:40.977Z eslint:config-array-factory Loaded: [email protected] (C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\node_modules\eslint-plugin-html\src\index.js)
2019-11-13T13:41:40.977Z eslint:config-array-factory Loading plugin "vue" from C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib.eslintrc.json
2019-11-13T13:41:40.977Z eslint:config-array-factory Loaded: [email protected] (C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\node_modules\eslint-plugin-vue\lib\index.js)
2019-11-13T13:41:40.977Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters.
2019-11-13T13:41:40.977Z eslint:config-array-factory Config file not found on C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters
2019-11-13T13:41:40.977Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds.
2019-11-13T13:41:40.978Z eslint:config-array-factory Config file not found on C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds
2019-11-13T13:41:40.978Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb\Projects\mseng\VSCode.
2019-11-13T13:41:40.978Z eslint:config-array-factory Config file not found on C:\Users\dirkb\Projects\mseng\VSCode
2019-11-13T13:41:40.978Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb\Projects\mseng.
2019-11-13T13:41:40.979Z eslint:config-array-factory Config file not found on C:\Users\dirkb\Projects\mseng
2019-11-13T13:41:40.979Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb\Projects.
2019-11-13T13:41:40.979Z eslint:config-array-factory Config file not found on C:\Users\dirkb\Projects
2019-11-13T13:41:40.979Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb.
2019-11-13T13:41:40.979Z eslint:cascading-config-array-factory Stop traversing because of considered root.
2019-11-13T13:41:40.980Z eslint:cascading-config-array-factory Configuration was determined: ConfigArray [ { name: '.eslintrc.json#processors["vue/.vue"]', filePath: 'C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\.eslintrc.json', criteria: { includes: [Array], excludes: null, basePath: 'C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib' }, env: undefined, globals: undefined, parser: undefined, parserOptions: undefined, plugins: undefined, processor: 'vue/.vue', root: undefined, rules: undefined, settings: undefined }, { name: '.eslintrc.json', filePath: 'C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\.eslintrc.json', criteria: null, env: { browser: true, commonjs: true, es6: true, node: true }, globals: undefined, parser: undefined, parserOptions: { ecmaFeatures: [Object], sourceType: 'module' }, plugins: { html: [Object], vue: [Object] }, processor: undefined, root: undefined, rules: { 'no-const-assign': 'warn', 'no-this-before-super': 'warn', 'no-undef': 'warn', 'no-unreachable': 'warn', 'no-unused-vars': 'warn', 'constructor-super': 'warn', 'valid-typeof': 'warn', 'no-extra-semi': 'warn', curly: 'warn', 'no-console': [Array], eqeqeq: [Array], indent: [Array] }, settings: undefined }, { name: '.eslintrc.json#overrides[0]', filePath: 'C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\.eslintrc.json', criteria: { includes: [Array], excludes: null, basePath: 'C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib' }, env: undefined, globals: undefined, parser: undefined, parserOptions: undefined, plugins: undefined, processor: undefined, root: undefined, rules: { 'no-console': 'error' }, settings: undefined } ] on C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib
2019-11-13T13:41:40.981Z eslint:cli-engine Lint C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\test.js
2019-11-13T13:41:40.981Z eslint:linter Linting code for C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\test.js (pass 1)
2019-11-13T13:41:40.981Z eslint:linter Verify
2019-11-13T13:41:40.981Z eslint:linter With ConfigArray: C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\test.js
2019-11-13T13:41:40.993Z eslint:linter Generating fixed text for C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\test.js (pass 1)
2019-11-13T13:41:40.993Z eslint:source-code-fixer Applying fixes
2019-11-13T13:41:40.993Z eslint:source-code-fixer shouldFix parameter was false, not attempting fixes
2019-11-13T13:41:40.993Z eslint:cli-engine Linting complete in: 18ms

All 7 comments

No not really. There is a tracing option for the LSP but this traces all communication (for example user typings as well).

Edit settings.json and add "eslint.trace.server": "verbose" but I'm not sure if it'll get you what you want.

hi

I just debugged why ESLint in VSCode gave different results than ESLint run on command line. In the end, the reason was CLI loading different versions of plugins from the global node_modules.

However, I would've found useful if ESLint in VSCode would had somehow given the similar information I get through running ESLint on CLI with --debug, e.g. in my case I wanted to see this row, revealing the location and the version of the plugin:
eslint:plugins Loaded plugin import ([email protected]) (from C:\Users\...\AppData\Roaming\npm\node_modules\eslint-plugin-import\lib\index.js) +251ms

@synchronos-t I was just in the process of implementing this. A next version will have a 'eslint.debug' setting which prints something like this to the console:

2019-11-13T13:41:40.975Z eslint:ignored-paths contains:
2019-11-13T13:41:40.975Z eslint:ignored-paths target = "C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\test.js"
2019-11-13T13:41:40.975Z eslint:ignored-paths base = "C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib"
2019-11-13T13:41:40.975Z eslint:ignored-paths relative = "test.js"
2019-11-13T13:41:40.976Z eslint:ignored-paths result = false
2019-11-13T13:41:40.976Z eslint:cascading-config-array-factory Load config files for C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib.
2019-11-13T13:41:40.976Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib.
2019-11-13T13:41:40.976Z eslint:config-array-factory Loading JSON config file: C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib.eslintrc.json
2019-11-13T13:41:40.976Z eslint:config-array-factory Config file found: C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib.eslintrc.json
2019-11-13T13:41:40.976Z eslint:config-array-factory Loading plugin "html" from C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib.eslintrc.json
2019-11-13T13:41:40.977Z eslint:config-array-factory Loaded: [email protected] (C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\node_modules\eslint-plugin-html\src\index.js)
2019-11-13T13:41:40.977Z eslint:config-array-factory Loading plugin "vue" from C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib.eslintrc.json
2019-11-13T13:41:40.977Z eslint:config-array-factory Loaded: [email protected] (C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\node_modules\eslint-plugin-vue\lib\index.js)
2019-11-13T13:41:40.977Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters.
2019-11-13T13:41:40.977Z eslint:config-array-factory Config file not found on C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters
2019-11-13T13:41:40.977Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds.
2019-11-13T13:41:40.978Z eslint:config-array-factory Config file not found on C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds
2019-11-13T13:41:40.978Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb\Projects\mseng\VSCode.
2019-11-13T13:41:40.978Z eslint:config-array-factory Config file not found on C:\Users\dirkb\Projects\mseng\VSCode
2019-11-13T13:41:40.978Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb\Projects\mseng.
2019-11-13T13:41:40.979Z eslint:config-array-factory Config file not found on C:\Users\dirkb\Projects\mseng
2019-11-13T13:41:40.979Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb\Projects.
2019-11-13T13:41:40.979Z eslint:config-array-factory Config file not found on C:\Users\dirkb\Projects
2019-11-13T13:41:40.979Z eslint:cascading-config-array-factory No cache found: C:\Users\dirkb.
2019-11-13T13:41:40.979Z eslint:cascading-config-array-factory Stop traversing because of considered root.
2019-11-13T13:41:40.980Z eslint:cascading-config-array-factory Configuration was determined: ConfigArray [ { name: '.eslintrc.json#processors["vue/.vue"]', filePath: 'C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\.eslintrc.json', criteria: { includes: [Array], excludes: null, basePath: 'C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib' }, env: undefined, globals: undefined, parser: undefined, parserOptions: undefined, plugins: undefined, processor: 'vue/.vue', root: undefined, rules: undefined, settings: undefined }, { name: '.eslintrc.json', filePath: 'C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\.eslintrc.json', criteria: null, env: { browser: true, commonjs: true, es6: true, node: true }, globals: undefined, parser: undefined, parserOptions: { ecmaFeatures: [Object], sourceType: 'module' }, plugins: { html: [Object], vue: [Object] }, processor: undefined, root: undefined, rules: { 'no-const-assign': 'warn', 'no-this-before-super': 'warn', 'no-undef': 'warn', 'no-unreachable': 'warn', 'no-unused-vars': 'warn', 'constructor-super': 'warn', 'valid-typeof': 'warn', 'no-extra-semi': 'warn', curly: 'warn', 'no-console': [Array], eqeqeq: [Array], indent: [Array] }, settings: undefined }, { name: '.eslintrc.json#overrides[0]', filePath: 'C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\.eslintrc.json', criteria: { includes: [Array], excludes: null, basePath: 'C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib' }, env: undefined, globals: undefined, parser: undefined, parserOptions: undefined, plugins: undefined, processor: undefined, root: undefined, rules: { 'no-console': 'error' }, settings: undefined } ] on C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib
2019-11-13T13:41:40.981Z eslint:cli-engine Lint C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\test.js
2019-11-13T13:41:40.981Z eslint:linter Linting code for C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\test.js (pass 1)
2019-11-13T13:41:40.981Z eslint:linter Verify
2019-11-13T13:41:40.981Z eslint:linter With ConfigArray: C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\test.js
2019-11-13T13:41:40.993Z eslint:linter Generating fixed text for C:\Users\dirkb\Projects\mseng\VSCode\Playgrounds\linters\lib\test.js (pass 1)
2019-11-13T13:41:40.993Z eslint:source-code-fixer Applying fixes
2019-11-13T13:41:40.993Z eslint:source-code-fixer shouldFix parameter was false, not attempting fixes
2019-11-13T13:41:40.993Z eslint:cli-engine Linting complete in: 18ms

Nice!

Available in 2.0.4

Was this page helpful?
0 / 5 - 0 ratings