Registry / testing / eslint-plugin-regex

eslint-plugin-regex

JSON →
library1.10.0jsnpmunverified

ESLint plugin that provides custom rules using regular expressions, allowing developers to quickly define custom lint rules without writing full ESLint rules. Version 1.10.0, actively maintained. Key differentiator: enables inline regex-based checks (invalid/required patterns) with rich options (file filters, auto-fix for invalid, custom messages). No TypeScript support. Minimal learning curve.

npm install eslint-plugin-regex
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-REGE
E
eslint-plugin-regex
testingjavascriptv1.10.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

regex
✓ /* no import needed; plugins are added via eslint config */
✗ import { regex } from 'eslint-plugin-regex'
This is an ESLint plugin, not a module. It is loaded via the 'plugins' field in .eslintrc.*

Shows how to configure eslint-plugin-regex to disallow console.log and debugger, and require 'use strict'.

// .eslintrc.json { "plugins": ["regex"], "rules": { "regex/invalid": [ "error", [ "console\\.log", "debugger" ] ], "regex/required": [ "error", [ "\\"use strict\\"" ] ] } }
Debug
Known issues
gotchaPatterns are case-sensitive by default; no flag to make case-insensitive.
fix
Write patterns with both cases, e.g., /[Ff]oo/ or use (?i) syntax if supported by JS regex engine.
affects: >=1.0.0
gotchaThe 'regex' plugin name is taken, so you cannot use it alongside another plugin with the same name.
fix
Prefix with npm scope, e.g., '@scope/eslint-plugin-regex' if needed.
affects: >=1.0.0
gotchaThe 'replacement' option for regex/invalid only works with literal strings; cannot use functions.
fix
Use a custom ESLint rule if function replacement is required.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'regex': Cannot find module 'eslint-plugin-regex'
Plugin not installed or eslint cannot resolve it.
fix
Run 'npm install eslint-plugin-regex --save-dev' and ensure it is in node_modules.
ESLint: Configuration for rule "regex/invalid" is invalid: value is not an array.
Rule config must be an array with severity and options.
fix
Set config as ["error", ["pattern"]].
Upgrade
Version history
1.10.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency: required to run the plugin
Agent activity
5 hits · last 30 days
node
4
Bingbot
1
Resources
eslint-plugin-regex — npm install eslint-plugin-regex · libregistry