eslint-plugin-decimal-system
v1.0.9
Published
ESLint plugin that allows only decimal numeric literals
Readme
eslint-plugin-decimal-system
ESLint plugin that enforces usage of decimal numeric literals only.
Disallows:
- Hexadecimal (
0xFF) - Binary (
0b1010) - Octal (
0o755) - BigInt in non-decimal form (
0xFFn)
Allows:
- Decimal numbers (
10,12345,0,42n)
Installation
npm install --save-dev eslint-plugin-decimal-systemPeer dependency:
npm install --save-dev eslintWhat the plugin exports
default → plugin (contains
rulesandconfigs)named export →
rules
Usage
ESLint 9
import { defineConfig } from "eslint/config";
import decimal from "eslint-plugin-decimal-system";
export default defineConfig([
...decimal.configs.recommended,
])
Or enable manually:
import decimal from "eslint-plugin-decimal-system";
export default [
{
plugins: { decimal },
rules: {
"decimal/decimal-system-only": "error",
},
},
];Rule Details
The rule checks all Literal AST nodes and reports when:
The literal is number or bigint
The raw source starts with 0x, 0b, or 0o
When to Use
This rule is useful when:
Enforcing numeric consistency in codebases
Avoiding mixed numeral systems
Improving readability
Preventing accidental octal usage
License
ISC
