no-octal
What it does
Section titled “What it does”Reports a number literal that starts with 0 followed by another digit, such as 017 or 08. 0, 0.5 and the modern forms 0o17, 0x1F and 0b11 are not reported.
Why it matters
Section titled “Why it matters”A leading zero makes a legacy octal literal: 017 is 15, not 17. A literal such as 08 or 09 has a digit that is not octal, so it is read as the decimal 8 or 9, which hides the mistake. Both forms are syntax errors in strict mode and in modules.
To fix, drop the leading zero for a decimal number or write 0o17 for an octal one.
Example
Section titled “Example”...var i = 017, j = 08, k = 0, l = 0.5, m = 0o17;...Configuration
Section titled “Configuration”js: lint: rules: no-octal: error # off, warn, error (default)Enabled by the presets: js/eslint-recommended.
Suppress one line with sudsy-disable-next-line no-octal in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| eslint | no-octal |
full |