Rules
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
No rules match “”.
Popular · 1 of 50
Disallow creating new promises outside of utility libs (use [util.promisify][] instead).
function promisifiedFn(arg) {
return new Promise((resolve, reject) => {
callbackStyleFn(arg, (error, result) =>
error ? reject(error) : resolve(result),
)
})
}
new Promise((resolve, reject) => resolve(1))
new Promise((resolve, reject) => reject(new Error('oops')))import util from 'util'
const promisifiedFn = util.promisify(callbackStyleFn)
Promise.resolve(1)
Promise.reject(new Error('oops'))