Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

eslint-plugin-regexp

> 后端框架
Open source

ESLint plugin for finding regex mistakes and style guide violations.

769 stars0 likes0 views
WebsiteGitHub

About

ESLint plugin for finding regex mistakes and style guide violations.

Introduction

eslint-plugin-regexp is ESLint plugin for finding RegExp mistakes and RegExp style guide violations.

:name_badge: Features

This ESLint plugin provides linting rules relate to better ways to help you avoid problems when using RegExp.

  • Find the wrong usage of regular expressions, and their hints.
  • Enforces a consistent style of regular expressions.
  • Find hints for writing optimized regular expressions.
  • 80 plugin rules for regular expression syntax and features.

You can check on the Online DEMO.

:book: Documentation

See documents.

:cd: Installation

bash
npm install --save-dev eslint eslint-plugin-regexp

Requirements

  • ESLint v9.38.0 and above
  • Node.js v20.19.0, v22.13.0, v24 and above

:book: Usage

Add regexp to the plugins section of your eslint.config.js configuration file (you can omit the eslint-plugin- prefix) and either use one of the two configurations available (recommended or all) or configure the rules you want:

The recommended configuration

The plugin.configs.recommended config enables a subset of the rules that should be most useful to most users. See lib/configs/rules/recommended.ts for more details.

javascript
// eslint.config.js
import regexpPlugin from "eslint-plugin-regexp"

export default [
    regexpPlugin.configs.recommended,
];

Advanced Configuration

Override/add specific rules configurations. See also: http://eslint.org/docs/user-guide/configuring.

javascript
// eslint.config.js
import regexpPlugin from "eslint-plugin-regexp"

export default [
    {
        plugins: { regexp: regexpPlugin },
        rules: {
            // Override/add rules settings here, such as:
            "regexp/rule-name": "error"
        }
    }
];

Using the all configuration

The plugin.configs.all config enables all rules. It's meant for testing, not for production use because it changes with every minor and major version of the plugin. Use it at your own risk. See lib/configs/rules/all.ts for more details.

:white_check_mark: Rules

Configurations enabled in.
⚠️ Configurations set to warn in.
Set in the flat/recommended configuration.
Set in the recommended configuration.
Automatically fixable by the --fix CLI option.
Manually fixable by editor suggestions.

Possible Errors

Name Description ⚠️
no-contradiction-with-assertion disallow elements that contradict assertions
no-control-character disallow control characters
no-dupe-disjunctions disallow duplicate disjunctions
no-empty-alternative disallow alternatives without elements
no-empty-capturing-group disallow capturing group that captures empty.
no-empty-character-class disallow character classes that match no characters
no-empty-group disallow empty group
no-empty-lookarounds-assertion disallow empty lookahead assertion or empty lookbehind assertion
no-escape-backspace disallow escape backspace ([\b])
no-invalid-regexp disallow invalid regular expression strings in RegExp constructors
no-lazy-ends disallow lazy quantifiers at the end of an expression
no-misleading-capturing-group disallow capturing groups that do not behave as one would expect
no-misleading-unicode-character disallow multi-code-point characters in character classes and quantifiers
no-missing-g-flag disallow missing g flag in patterns used in String#matchAll and String#replaceAll
no-optional-assertion disallow optional assertions
no-potentially-useless-backreference disallow backreferences that reference a group that might not be matched
no-super-linear-backtracking disallow exponential and polynomial backtracking
no-super-linear-move disallow quantifiers that cause quadratic moves
no-useless-assertions disallow assertions that are known to always accept (or reject)
no-useless-backreference disallow useless backreferences in regular expressions
no-useless-dollar-replacements disallow useless $ replacements in replacement string
strict disallow not strictly valid regular expressions

Best Practices

Name Description ⚠️
confusing-quantifier disallow confusing quantifiers
control-character-escape enforce consistent escaping of control characters
negation enforce use of escapes on negation
no-dupe-characters-character-class disallow duplicate characters in the RegExp character class
no-empty-string-literal disallow empty string literals in character classes
no-extra-lookaround-assertions disallow unnecessary nested lookaround assertions
no-invisible-character disallow invisible raw character
no-legacy-features disallow legacy RegExp features
no-non-standard-flag disallow non-standard flags
[no-obscure-ra

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScripteslint-plugineslintpluginregexregexp

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架