promise/no-native
eslint-plugin-promise
No autofix
eslint.config.js
import promise from "eslint-plugin-promise";
export default [
{
plugins: { promise },
rules: {
"promise/no-native": "error",
},
},
];Require creating a Promise constructor before using it in an ES5 environment.
const x = Promise.resolve('bad')const Promise = require('bluebird')
const x = Promise.resolve('good')Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
promise/no-native
eslint-plugin-promise
import promise from "eslint-plugin-promise";
export default [
{
plugins: { promise },
rules: {
"promise/no-native": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Prefer await to then()/catch()/finally() for reading Promise values.
Disallow use of non-standard Promise static methods.
Prefer async/await to the callback pattern.
Prefer catch to then(a, b)/then(null, b) for handling errors.
Disallow creating new promises with paths that resolve multiple times.
Disallow creating new promises outside of utility libs (use [util.promisify][] instead).