unicorn/explicit-timer-delay
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/explicit-timer-delay": "error",
},
},
];Enforce or disallow explicit delay argument for setTimeout() and setInterval().
setTimeout(() => console.log('Hello'));setInterval(callback);window.setTimeout(() => console.log('Hello'));setTimeout(() => console.log('Hello'), 0);setInterval(callback, 0);window.setTimeout(() => console.log('Hello'), 0);Examples from the ESLint documentation.
unicorn/explicit-timer-delay
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/explicit-timer-delay": "error",
},
},
];unicorn/explicit-timer-delay
unicorn plugin · style
{
"rules": {
"unicorn/explicit-timer-delay": "error"
}
}Biome does not have this rule.
Prefer .querySelector() and .querySelectorAll() over older DOM query methods.
Enforce specifying rules to disable in eslint-disable comments.
Prefer negative index over .length - index when possible.
Disallow recursive access to this within getters and setters.
Require consistent decimal numbers without redundant zeros.
Disallow anonymous functions and classes as the default export.