Skip to content

Rule proposal: the never option for the numeric-separators-style #2493

@vanyauhalin

Description

@vanyauhalin

Description

I would appreciate a flag or option to disallow the use of a separator for numbers.

Fail

const n = 10_000

Pass

const n = 10000

Proposed rule name

numeric-separators-style

Additional Info

To avoid adding a new flag it could be achieved using a negative (exact -1) value:

{
  "unicorn/number-literal-case": ["error", -1],
}
{
  "unicorn/number-literal-case": {
    hexadecimal: -1,
    binary: -1,
    octal: -1,
    number: -1,
  },
}
{
  "unicorn/number-literal-case": {
    hexadecimal: {minimumDigits: -1},
    binary: {minimumDigits: -1},
    octal: {minimumDigits: -1},
    number: {minimumDigits: -1},
  },
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions