Skip to content

Commit 34d24eb

Browse files
authored
feat: add regex support to disableAllRules function (#927)
1 parent 7f9c236 commit 34d24eb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

configs/util.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ export function setFilesIfUndef(configs, files) {
1919
*
2020
* @param {Linter.Config[]} configs
2121
* @param {string[]} except
22+
* @param {RegExp[]} exceptRx
2223
* @return {Linter.RulesRecord}
2324
*/
24-
export function disableAllRules(configs, except = []) {
25+
export function disableAllRules(configs, except = [], exceptRx = []) {
2526
const rules = {};
2627

2728
for (const config of configs) {
@@ -30,6 +31,10 @@ export function disableAllRules(configs, except = []) {
3031
continue;
3132
}
3233

34+
if (exceptRx.some(rx => rx.test(rule))) {
35+
continue;
36+
}
37+
3338
rules[rule] = 'off';
3439
}
3540
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-hookz/eslint-config",
3-
"version": "2.0.0",
3+
"version": "4.0.0",
44
"description": "eslint configuration files used in @react-hookz projects",
55
"license": "MIT",
66
"repository": {

0 commit comments

Comments
 (0)