|
1 |
| -# eslint-plugin-regexp |
2 |
| -ESLint plugin for finding regex mistakes and style guide violations. |
| 1 | +# Introduction |
| 2 | + |
| 3 | +[eslint-plugin-regexp](https://www.npmjs.com/package/eslint-plugin-regexp) is ESLint plugin for finding RegExp mistakes and RegExp style guide violations. |
| 4 | + |
| 5 | +[](https://www.npmjs.com/package/eslint-plugin-regexp) |
| 6 | +[](https://www.npmjs.com/package/eslint-plugin-regexp) |
| 7 | +[](http://www.npmtrends.com/eslint-plugin-regexp) |
| 8 | +[](http://www.npmtrends.com/eslint-plugin-regexp) |
| 9 | +[](http://www.npmtrends.com/eslint-plugin-regexp) |
| 10 | +[](http://www.npmtrends.com/eslint-plugin-regexp) |
| 11 | +[](http://www.npmtrends.com/eslint-plugin-regexp) |
| 12 | +[](https://github.com/ota-meshi/eslint-plugin-regexp/actions?query=workflow%3ACI) |
| 13 | +[](https://coveralls.io/github/ota-meshi/eslint-plugin-regexp?branch=master) |
| 14 | + |
| 15 | +## Features |
| 16 | + |
| 17 | +This ESLint plugin provides linting rules relate to better ways to help you avoid problems when using RegExp. |
| 18 | + |
| 19 | +You can check on the [Online DEMO](https://ota-meshi.github.io/eslint-plugin-regexp/playground/). |
| 20 | + |
| 21 | +<!--DOCS_IGNORE_START--> |
| 22 | + |
| 23 | +## Documentation |
| 24 | + |
| 25 | +See [documents](https://ota-meshi.github.io/eslint-plugin-regexp/). |
| 26 | + |
| 27 | +## Installation |
| 28 | + |
| 29 | +```bash |
| 30 | +npm install --save-dev eslint eslint-plugin-regexp |
| 31 | +``` |
| 32 | + |
| 33 | +> **Requirements** |
| 34 | +> |
| 35 | +> - ESLint v5.0.0 and above |
| 36 | +> - Node.js v8.10.0 and above |
| 37 | +
|
| 38 | +<!--DOCS_IGNORE_END--> |
| 39 | + |
| 40 | +## Usage |
| 41 | + |
| 42 | +<!--USAGE_SECTION_START--> |
| 43 | + |
| 44 | +Create `.eslintrc.*` file to configure rules. See also: [http://eslint.org/docs/user-guide/configuring](http://eslint.org/docs/user-guide/configuring). |
| 45 | + |
| 46 | +Example **.eslintrc.js**: |
| 47 | + |
| 48 | +```js |
| 49 | +module.exports = { |
| 50 | + extends: [ |
| 51 | + // add more generic rulesets here, such as: |
| 52 | + // 'eslint:recommended', |
| 53 | + 'plugin:regexp/recommended' |
| 54 | + ], |
| 55 | + rules: { |
| 56 | + // override/add rules settings here, such as: |
| 57 | + // 'regexp/rule-name': 'error' |
| 58 | + } |
| 59 | +} |
| 60 | +``` |
| 61 | + |
| 62 | +## Configs |
| 63 | + |
| 64 | +This plugin provides one config: |
| 65 | + |
| 66 | +- `plugin:regexp/recommended` ... This is the recommended configuration for this plugin. |
| 67 | + |
| 68 | +<!--USAGE_SECTION_END--> |
| 69 | + |
| 70 | +## Rules |
| 71 | + |
| 72 | +<!--RULES_SECTION_START--> |
| 73 | + |
| 74 | +The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) automatically fixes problems reported by rules which have a wrench :wrench: below. |
| 75 | +The rules with the following star :star: are included in the `plugin:regexp/recommended` config. |
| 76 | + |
| 77 | +<!--RULES_TABLE_START--> |
| 78 | + |
| 79 | +| Rule ID | Description | | |
| 80 | +|:--------|:------------|:---| |
| 81 | +| [regexp/match-any](https://ota-meshi.github.io/eslint-plugin-regexp/rules/match-any.html) | enforce match any character style | :star::wrench: | |
| 82 | +| [regexp/no-assertion-capturing-group](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-assertion-capturing-group.html) | disallow capturing group that captures assertions. | :star: | |
| 83 | +| [regexp/no-dupe-characters-character-class](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-dupe-characters-character-class.html) | disallow duplicate characters in the RegExp character class | :star: | |
| 84 | +| [regexp/no-empty-group](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-empty-group.html) | disallow empty group | :star: | |
| 85 | +| [regexp/no-empty-lookarounds-assertion](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-empty-lookarounds-assertion.html) | disallow empty lookahead assertion or empty lookbehind assertion | :star: | |
| 86 | +| [regexp/no-escape-backspace](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-escape-backspace.html) | disallow escape backspace (`[\b]`) | :star: | |
| 87 | +| [regexp/no-octal](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-octal.html) | disallow octal escape sequence | :star: | |
| 88 | +| [regexp/no-useless-exactly-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-exactly-quantifier.html) | disallow unnecessary exactly quantifier | :star: | |
| 89 | +| [regexp/prefer-d](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-d.html) | enforce using `\d` | :star::wrench: | |
| 90 | +| [regexp/prefer-plus-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-plus-quantifier.html) | enforce using `+` quantifier | :star::wrench: | |
| 91 | +| [regexp/prefer-question-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-question-quantifier.html) | enforce using `?` quantifier | :star::wrench: | |
| 92 | +| [regexp/prefer-star-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-star-quantifier.html) | enforce using `*` quantifier | :star::wrench: | |
| 93 | +| [regexp/prefer-t](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-t.html) | enforce using `\t` | :star::wrench: | |
| 94 | +| [regexp/prefer-w](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-w.html) | enforce using `\w` | :star::wrench: | |
| 95 | + |
| 96 | +<!--RULES_TABLE_END--> |
| 97 | +<!--RULES_SECTION_END--> |
| 98 | + |
| 99 | +<!--DOCS_IGNORE_START--> |
| 100 | + |
| 101 | +## Contributing |
| 102 | + |
| 103 | +Welcome contributing! |
| 104 | + |
| 105 | +Please use GitHub's Issues/PRs. |
| 106 | + |
| 107 | +### Development Tools |
| 108 | + |
| 109 | +- `npm test` runs tests and measures coverage. |
| 110 | +- `npm run update` runs in order to update readme and recommended configuration. |
| 111 | + |
| 112 | +<!--DOCS_IGNORE_END--> |
| 113 | + |
| 114 | +## License |
| 115 | + |
| 116 | +See the [LICENSE](LICENSE) file for license rights and limitations (MIT). |
0 commit comments