New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no-octal rule on NonOctalDecimalIntegerLiterals #11794
no-octal rule on NonOctalDecimalIntegerLiterals #11794
Comments
thanks for the issue! |
Is By the way, I made a parser that could help with this if we do decide to implement it: https://github.com/not-an-aardvark/js-numeric-literal-parser |
In strict mode, ESLint's parser itself correctly reports 'Parsing error: Invalid number' on first occurence of any In non-strict mode,
Looks like a simple replace of |
You're right, I think this is just a bug in the rule. It doesn't make sense that |
It most likely wasn't a bug when However, browsers did support them as decimal integers. There were attempts to remove this support, but some important sites/apps were broken, so they are eventually included in ES6 as |
Tell us about your environment
5.16.0
10.16.0
6.9.0
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
What did you expect to happen?
By the specification both 018 and 081 are NonOctalDecimalIntegerLiteral, not LegacyOctalIntegerLiteral.
If the no-octal rule is supposed to catch these literals (which look like octal literals
but are actually evaluated as decimal literals), then it should report all 6 as errors.
Otherwise, if the rule is supposed to catch only octal literals, then it should report zero errors, and perhaps a new rule could be added.
What actually happened? Please include the actual, raw output from ESLint.
Only 018, 018.2 and 018e2 are reported as errors:
2:5 error Octal literals should not be used no-octal
4:5 error Octal literals should not be used no-octal
6:5 error Octal literals should not be used no-octal
✖ 3 problems (3 errors, 0 warnings)
Are you willing to submit a pull request to fix this bug?
yes
The text was updated successfully, but these errors were encountered: