An ESLint plugin that provides 80+ rules to detect regex mistakes, enforce style consistency, and optimize regular expressions.
eslint-plugin-regexp is an ESLint plugin that provides linting rules to find mistakes, enforce style, and offer optimization hints for regular expressions in JavaScript and TypeScript codebases. It helps developers avoid common regex pitfalls like invalid syntax, contradictory assertions, and inefficient patterns, thereby improving code quality and reliability. The plugin applies static analysis and established best practices to make regular expressions more maintainable and less error-prone.
JavaScript and TypeScript developers who regularly work with regular expressions in their code, particularly those in codebases where regex correctness, consistency, and performance are critical. It is also valuable for teams enforcing coding standards and seeking to prevent regex-related bugs.
Developers choose this plugin because it offers a comprehensive, specialized rule set of over 80 configurable rules focused solely on regex quality, which goes beyond general ESLint capabilities. Its unique selling point is the combination of error detection, style enforcement, and performance optimization with auto-fix support for many rules, streamlining the process of writing and maintaining robust regular expressions.
ESLint plugin for finding regex mistakes and style guide violations.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Identifies invalid regex syntax and contradictory assertions with rules like 'no-invalid-regexp' and 'no-contradiction-with-assertion', preventing runtime errors early in development.
Detects inefficient quantifiers and super-linear backtracking through rules like 'no-super-linear-backtracking', with auto-fix support to streamline regex optimization for better performance.
Many rules, such as 'no-useless-escape' and 'sort-flags', include automatic fixes (marked with 🔧 in the README), reducing manual correction effort and enforcing consistency quickly.
Enforces proper usage of Unicode flags (e.g., 'require-unicode-regexp' for the 'u' flag) and discourages legacy features, ensuring robust handling of modern JavaScript regex capabilities.
Requires ESLint v9.38.0+ and specific Node.js versions (v20.19.0, v22.13.0, v24+), which can hinder adoption in projects with older or locked toolchains.
With over 80 rules, the 'all' config is explicitly not recommended for production due to breaking changes, forcing teams to manually curate rules, which can be time-consuming and error-prone.
Cannot analyze dynamically generated regex patterns (e.g., built via string concatenation), missing potential issues that only arise at runtime, which limits its effectiveness in some codebases.
While it integrates with ESLint, there's limited mention of pre-built configs for frameworks or tools beyond the basic recommended setup, potentially requiring custom tuning for complex projects.