Skip to content

docs: the example for unicorn/number-literal-case is nonsense #896

@kennytm

Description

@kennytm

Currently the example in https://oxc.rs/docs/guide/usage/linter/rules/unicorn/number-literal-case.html#examples says

Examples of incorrect code for this rule:

const foo = 0xff;
const foo = 0xff;
const foo = 0xff;
const foo = 0xffn;

const foo = 0b10;
const foo = 0b10n;

const foo = 0o76;
const foo = 0o76n;

const foo = 2e-5;

Examples of correct code for this rule:

const foo = 0xff;
const foo = 0b10;
const foo = 0o76;
const foo = 0xffn;
const foo = 2e5;

which is meaningless because all "incorrect" and "correct" code has been formatted to the same by #711.


Compare with the intended outcome in https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/rules/unicorn/number_literal_case.rs:

Examples of incorrect code for this rule:

const foo = 0XFF;
const foo = 0xff;
const foo = 0Xff;
const foo = 0Xffn;

const foo = 0B10;
const foo = 0B10n;

const foo = 0O76;
const foo = 0O76n;

const foo = 2E-5;

Examples of correct code for this rule:

const foo = 0xFF;
const foo = 0b10;
const foo = 0o76;
const foo = 0xFFn;
const foo = 2e+5;

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions