ESLint Error 'Invalid count value' when run with --fix
See original GitHub issueI couldn’t run the lint test with --fix and I am getting the following error.
Run command
> esw -c .eslintrc ./src '.js, .jsx' --color --fix
Error
Invalid count value
RangeError: Invalid count value
at String.repeat (native)
at report (/Users/Projects/uni-sh/fr-webapp/node_modules/eslint/lib/rules/indent.js:267:73)
at checkLastReturnStatementLineIndent (/Users/Projects/uni-sh/fr-webapp/node_modules/eslint/lib/rules/indent.js:430:17)
at EventEmitter.ReturnStatement (/Users/Projects/uni-sh/fr-webapp/node_modules/eslint/lib/rules/indent.js:1050:21)
at emitOne (events.js:101:20)
at EventEmitter.emit (events.js:188:7)
at NodeEventGenerator.enterNode (/Users/Projects/uni-sh/fr-webapp/node_modules/eslint/lib/util/node-event-generator.js:40:22)
at CodePathAnalyzer.enterNode (/Users/Projects/uni-sh/fr-webapp/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:608:23)
at CommentEventGenerator.enterNode (/Users/Projects/uni-sh/fr-webapp/node_modules/eslint/lib/util/comment-event-generator.js:97:23)
at Controller.enter (/Users/Projects/uniqlo-sh/fr-webapp/node_modules/eslint/lib/eslint.js:927:36)
I have resolved the issue. If there is no blank line before the return statement in anywhere in the code we will get this error message.
I have just put a blank line before the return statement then lint command with --fix is working without any issue
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
ESLint Error 'Invalid count value' when run with --fix
I have resolved the issue. If there is no blank line before the return statement in anywhere in the code we will get...
Read more >ESLint Error 'Invalid count value' when run with --fix-Reactjs
Coding example for the question ESLint Error 'Invalid count value' when run with --fix-Reactjs.
Read more >Command Line Interface - 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 >RangeError: repeat count must be less than infinity - JavaScript
RangeError: Invalid string length (V8-based) RangeError: Invalid count value: Infinity (V8-based) RangeError: repeat count must be less than ...
Read more >eslint/eslint - Gitter
Receiving the following error when running npm run lint : Oops! Something went wrong! :( ESLint: 6.1.0. ESLint couldn't find the config "prettier"...
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
I was able to narrow down a repro:
The code is able to remove indentations as a fix. The issue is that the desired indent is coming out as a negative number for some reason. The correct behavior would be for the desired indent size to be
0
, which would causedesiredIndent
to be an empty string.For what it’s worth, I think this code has the correct behavior:
So I’m guessing there is an off-by-one error somewhere caused by the semicolon after the closing paren.