unicorn/no-zero-fractions
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-zero-fractions": "error",
},
},
];const foo = 1.0;const foo = 1.;const foo = -1.0;const foo = 1;const foo = -1;const foo = 123_456;Examples from the ESLint documentation.
unicorn/no-zero-fractions
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-zero-fractions": "error",
},
},
];unicorn/no-zero-fractions
unicorn plugin · style
{
"rules": {
"unicorn/no-zero-fractions": "error"
}
}nursery/noZeroFractions
nursery · since 2.6.0
{
"linter": {
"rules": {
"nursery": {
"noZeroFractions": "error"
}
}
}
}Prefer .querySelector() and .querySelectorAll() over older DOM query methods.
Disallow classes that only have static members.
Enforce consistent style for element existence checks with indexOf(), lastIndexOf(), findIndex(), and findLastIndex().
Disallow negated expression in equality check.
Enforce or disallow explicit delay argument for setTimeout() and setInterval().