Cannot finish file scan in `eslint --init` when file contains invalid ESLint config comment
See original GitHub issueWhat version of ESLint are you using?
2.8.0
What parser (default, Babel-ESLint, etc.) are you using?
default I hope
Please show your full configuration:
There is no configuration yet
What did you do? Please include the actual source code causing the issue.
eslint --init
and I choose to scan my files to determine the best configuration
one of files contains invalid comment /*eslint max-statements[2,60], max-depth:[2,4] */
What did you expect to happen?
successful finish
What actually happened? Please include the actual, raw output from ESLint.
(mention.js:31:13) Failed to parse JSON from ' max-statements[2,60], "max-depth":[2,4]': Unexpected token m
Error: (mention.js:31:13) Failed to parse JSON from ' max-statements[2,60], "max-depth":[2,4]': Unexpected token m
at getSourceCodeOfFile (C:\Users\khomyackov\AppData\Roaming\npm\node_modules\eslint\lib\util\source-code-util.js:43:15) at C:\Users\khomyackov\AppData\Roaming\npm\node_modules\eslint\lib\util\source-code-util.js:99:26
at Array.forEach (native)
at getSourceCodeOfFiles (C:\Users\khomyackov\AppData\Roaming\npm\node_modules\eslint\lib\util\source-code-util.js:98:15) at configureRules (C:\Users\khomyackov\AppData\Roaming\npm\node_modules\eslint\lib\config\config-initializer.js:128:23)
at processAnswers (C:\Users\khomyackov\AppData\Roaming\npm\node_modules\eslint\lib\config\config-initializer.js:250:18)
at null.completed (C:\Users\khomyackov\AppData\Roaming\npm\node_modules\eslint\lib\config\config-initializer.js:404:30)
at PromptUI.onCompletion (C:\Users\khomyackov\AppData\Roaming\npm\node_modules\eslint\node_modules\inquirer\lib\ui\prompt.js:57:10)
at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.completed (C:\Users\khomyackov\AppData\Roaming\npm\node_modules\eslint\node_modules\inquirer\node_modules\rx-lite\rx.lite.js:1550:12)
at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (C:\Users\khomyackov\AppData\Roaming\npm\node_modules\eslint\node_modules\inquirer\node_modules\rx-lite\rx.lite.js:1489:14)
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Cannot finish file scan in `eslint --init` · Issue #5992 - GitHub
eslint --init scripts on existing project · I choose to scan my files to determine the best configuration. What did you expect to...
Read more >Configuration Files - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >ESLINT An error occurred while generating your JavaScript ...
A config file was still generated, but the config file itself may not follow your linting rules. Error: BaseConfig » eslint-config-airbnb-base » ...
Read more >Linting in TypeScript using ESLint and Prettier - LogRocket Blog
Integrate Prettier with ESLint to automate type-checking in your TypeScript code and ensure that the code has no bugs.
Read more >Working with JavaScript in Visual Studio Code
js files same as in .ts files. When types cannot be inferred, they can be specified using JSDoc comments. You can read more...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fair enough. Then perhaps we can make config comment parsing failure a reported error instead of a thrown error as @victor-homyakov suggested? That would be a change to the core rather than an autoconfig change.
Closing this because we haven’t made any progress in months. Thanks for contributing!