Package Exports
- eslint-plugin-regexp
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-plugin-regexp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Introduction
eslint-plugin-regexp is ESLint plugin for finding RegExp mistakes and RegExp style guide violations.
Features
This ESLint plugin provides linting rules relate to better ways to help you avoid problems when using RegExp.
You can check on the Online DEMO.
Documentation
See documents.
Installation
npm install --save-dev eslint eslint-plugin-regexp
Requirements
- ESLint v6.0.0 and above
- Node.js v8.10.0 and above
Usage
Create .eslintrc.*
file to configure rules. See also: http://eslint.org/docs/user-guide/configuring.
Example .eslintrc.js:
module.exports = {
extends: [
// add more generic rulesets here, such as:
// 'eslint:recommended',
'plugin:regexp/recommended'
],
rules: {
// override/add rules settings here, such as:
// 'regexp/rule-name': 'error'
}
}
Configs
This plugin provides one config:
plugin:regexp/recommended
... This is the recommended configuration for this plugin.
See lib/configs/recommended.ts for details.
Rules
The --fix
option on the command line automatically fixes problems reported by rules which have a wrench 🔧 below.
The rules with the following star ⭐ are included in the plugin:regexp/recommended
config.
Rule ID | Description | |
---|---|---|
regexp/match-any | enforce match any character style | ⭐🔧 |
regexp/no-assertion-capturing-group | disallow capturing group that captures assertions. | ⭐ |
regexp/no-dupe-characters-character-class | disallow duplicate characters in the RegExp character class | ⭐ |
regexp/no-empty-group | disallow empty group | ⭐ |
regexp/no-empty-lookarounds-assertion | disallow empty lookahead assertion or empty lookbehind assertion | ⭐ |
regexp/no-escape-backspace | disallow escape backspace ([\b] ) |
⭐ |
regexp/no-invisible-character | disallow invisible raw character | ⭐🔧 |
regexp/no-octal | disallow octal escape sequence | ⭐ |
regexp/no-useless-backreference | disallow useless backreferences in regular expressions | |
regexp/no-useless-exactly-quantifier | disallow unnecessary exactly quantifier | ⭐ |
regexp/no-useless-two-nums-quantifier | disallow unnecessary {n,m} quantifier |
⭐ |
regexp/prefer-d | enforce using \d |
⭐🔧 |
regexp/prefer-plus-quantifier | enforce using + quantifier |
⭐🔧 |
regexp/prefer-quantifier | enforce using quantifier | 🔧 |
regexp/prefer-question-quantifier | enforce using ? quantifier |
⭐🔧 |
regexp/prefer-star-quantifier | enforce using * quantifier |
⭐🔧 |
regexp/prefer-t | enforce using \t |
⭐🔧 |
regexp/prefer-w | enforce using \w |
⭐🔧 |
Contributing
Welcome contributing!
Please use GitHub's Issues/PRs.
Development Tools
npm test
runs tests and measures coverage.npm run update
runs in order to update readme and recommended configuration.
License
See the LICENSE file for license rights and limitations (MIT).