Skip to content

Commit 063ceda

Browse files
authored
Add all and all-warn configs (#23)
1 parent ebce2b1 commit 063ceda

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,33 @@ module.exports = {
4040

4141
### ./.eslintrc
4242

43+
#### Use all rules as errors
44+
45+
```json
46+
{
47+
"plugins": ["local-rules"],
48+
"extends": [
49+
"plugin:local-rules/all"
50+
]
51+
}
52+
```
53+
54+
#### Use all rules as warnings
55+
4356
```json
4457
{
45-
"plugins": ["eslint-plugin-local-rules"],
58+
"plugins": ["local-rules"],
59+
"extends": [
60+
"plugin:local-rules/all-warn"
61+
]
62+
}
63+
```
4664

65+
#### Customize each rule independently
66+
67+
```json
68+
{
69+
"plugins": ["local-rules"],
4770
"rules": {
4871
"local-rules/disallow-identifiers": "error"
4972
}

index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ if (!rules) {
2626
);
2727
}
2828

29+
var getConfig = (type) => ({
30+
rules: Object.fromEntries(
31+
Object
32+
.keys(rules)
33+
.map((rule) => [`local-rules/${rule}`, type])
34+
);
35+
});
36+
2937
module.exports = {
38+
configs: {
39+
all: getConfig('error'),
40+
'all-warn': getConfig('warn'),
41+
},
3042
rules: rules,
3143
};

0 commit comments

Comments
 (0)