Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add all configuration #250

Merged
merged 8 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ npm install --save-dev eslint eslint-plugin-regexp
<!--USAGE_SECTION_START-->

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

### The recommended configuration

Expand Down Expand Up @@ -84,6 +84,11 @@ module.exports = {
}
```

### Using `"plugin:regexp/all"`

The `plugin:regexp/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 [https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/all.ts](https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/all.ts) for more details.*

<!--USAGE_SECTION_END-->

## :white_check_mark: Rules
Expand Down
7 changes: 6 additions & 1 deletion docs/user-guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ npm install --save-dev eslint eslint-plugin-regexp
<!--USAGE_SECTION_START-->

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

### The recommended configuration

Expand Down Expand Up @@ -56,6 +56,11 @@ module.exports = {
}
```

### Using `"plugin:regexp/all"`

The `plugin:regexp/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 [https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/all.ts](https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/all.ts) for more details.*

<!--USAGE_SECTION_END-->

See [the rule list](../rules/README.md) to get the `rules` that this plugin provides.
Expand Down
15 changes: 15 additions & 0 deletions lib/configs/all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import recommended from "./recommended"
import { rules } from "../utils/rules"

const all: Record<string, string> = {}
for (const rule of rules) {
all[rule.meta.docs.ruleId] = "error"
}

export = {
plugins: ["regexp"],
rules: {
...all,
...recommended.rules,
},
}
2 changes: 2 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { RuleModule } from "./types"
import { rules as ruleList } from "./utils/rules"
import recommended from "./configs/recommended"
import all from "./configs/all"

const configs = {
recommended,
all,
}

const rules = ruleList.reduce((obj, r) => {
Expand Down