useSimpleNumberKeys
Este conteúdo não está disponível em sua língua ainda.
Diagnostic Category: lint/complexity/useSimpleNumberKeys
Since: v1.0.0
Disallow number literal object member names which are not base10 or uses underscore as separator
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-block.js:1:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Hexadecimal number literal is not allowed here.
> 1 │ ({ 0x1: 1 });
│ ^^^
2 │
ℹ Safe fix: Replace 0x1 with 1
1 │ - ({·0x1:·1·});
1 │ + ({·1:·1·});
2 2 │
code-block.js:1:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Number literal with underscore is not allowed here.
> 1 │ ({ 11_1.11: “ee” });
│ ^^^^^^^
2 │
ℹ Safe fix: Replace 11_1.11 with 111.11
1 │ - ({·11_1.11:·“ee”·});
1 │ + ({·111.11:·“ee”·});
2 2 │
code-block.js:1:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Octal number literal is not allowed here.
> 1 │ ({ 0o1: 1 });
│ ^^^
2 │
ℹ Safe fix: Replace 0o1 with 1
1 │ - ({·0o1:·1·});
1 │ + ({·1:·1·});
2 2 │
code-block.js:1:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Bigint is not allowed here.
> 1 │ ({ 1n: 1 });
│ ^^
2 │
ℹ Safe fix: Replace 1n with 1
1 │ - ({·1n:·1·});
1 │ + ({·1:·1·});
2 2 │
code-block.js:1:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Number literal with underscore is not allowed here.
> 1 │ ({ 11_1.11: “ee” });
│ ^^^^^^^
2 │
ℹ Safe fix: Replace 11_1.11 with 111.11
1 │ - ({·11_1.11:·“ee”·});
1 │ + ({·111.11:·“ee”·});
2 2 │