An ESLint plugin that enforces best practices and consistent patterns for JavaScript promises.
eslint-plugin-promise is an ESLint plugin that provides linting rules to enforce best practices and consistent patterns when working with JavaScript promises. It helps developers avoid common pitfalls in asynchronous code, such as missing error handling, unnecessary promise wrapping, and nested promise chains. The plugin includes both recommended and configurable rules to improve code reliability and maintainability.
JavaScript developers working with promise-based asynchronous code, particularly those using ESLint for code quality enforcement in Node.js or browser environments.
Developers choose eslint-plugin-promise because it offers a focused, comprehensive set of rules specifically for promises, catching subtle bugs that generic linting might miss. Its recommended configuration provides sensible defaults, while its flexibility allows teams to customize rules to fit their coding standards.
Enforce best practices for JavaScript promises
The plugin offers over 15 specific rules targeting promise anti-patterns, from error handling ('catch-or-return') to constructor usage ('no-new-statics'), as detailed in the rules table.
Includes a 'recommended' rule set that enforces critical practices like 'always-return' and 'catch-or-return', making it easy to adopt best practices without extensive setup.
Rules like 'no-new-statics' and 'prefer-catch' are marked as fixable with ESLint's --fix option, allowing automatic correction of code without manual refactoring.
The README shows continuous integration badges and lists multiple maintainers, indicating ongoing support, updates, and reliability for production use.
Requires ESLint to be installed and configured, adding complexity for projects not already using it or those with minimal linting needs, as noted in the installation steps.
Rules like 'avoid-new' discourage using new Promise() in favor of util.promisify, which may not fit all coding styles or legacy codebases, potentially causing friction.
Focuses solely on promises, missing linting for other async patterns like async/await nuances beyond basic rules, though some rules like 'prefer-await-to-then' are included.
ESLint plugin with rules that help validate proper imports.
ESLint rules to disable mutation and promote fp in JavaScript and TypeScript.
ESLint rules for functional programming
ESLint plugin to disable all mutation in JavaScript.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.