Skip to content

Commit c8f9e5a

Browse files
committed
## 1.9.0 - April 2022
* Fixes #16, Unable to use both "ignore" and "inspect" inside "files" property
1 parent ba44074 commit c8f9e5a

File tree

5 files changed

+49
-4
lines changed

5 files changed

+49
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* Closes #15, Allowing mixing different error level.
66
* This bug required that the same rule can be defined with different error levels, that is not possible at the moment on eslint. Error level is not available at plugin level (as indicate by ESLint official documentation: "Keep in mind that the error level is not part of context.options, as the error level cannot be known or modified from inside a rule"). So I came up a different approach, which not only **allows to use "the same" rule with different error levels**, but also **allows Mixing custom set of regex rules**, this is useful for creating package/libraries/plugins with your own set of rules and sharing it with others.
7+
* Fixes #16, Unable to use both "ignore" and "inspect" inside "files" property.
78
* Fixes an issue with remaining source calculation and minified files.
89
* Improves project configuration.
910
* Now uses [`any-eslint-parser`](https://www.npmjs.com/package/any-eslint-parser)

lib/rules/invalid-regex-rule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ module.exports = {
227227
}
228228
},
229229
minProperties: 1,
230-
maxProperties: 1
230+
maxProperties: 2
231231
}
232232
},
233233
required: ['regex']

lib/rules/required-regex-rule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ module.exports = {
7676
}
7777
},
7878
minProperties: 1,
79-
maxProperties: 1
79+
maxProperties: 2
8080
}
8181
},
8282
required: ['regex']

tests/lib/rules/invalid-regex-detailed-rule.e2e-test.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ const shouldNotInspectedFile = {
4343
]
4444
}
4545

46+
const shouldHandleBothIgnoreInspectFile = {
47+
code: 'const z = 1\nvar x = "invalid"',
48+
filename: 'some.test.js',
49+
options: [
50+
[{
51+
regex: 'invalid',
52+
files: {
53+
ignore: '.*test\.js',
54+
inspect: '.*spec\.js'
55+
}
56+
}]
57+
]
58+
}
59+
4660
const shouldFound = {
4761
code: 'var z = 1\nvar x = "invalid"',
4862
filename: 'some.js',
@@ -621,7 +635,8 @@ ruleTester.run(
621635
valid: [
622636
shouldNotFind,
623637
shouldIgnoreFile,
624-
shouldNotInspectedFile
638+
shouldNotInspectedFile,
639+
shouldHandleBothIgnoreInspectFile
625640
],
626641
invalid: [
627642
shouldFound,

tests/lib/rules/required-regex-detailed-rule.e2e-test.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,33 @@ const shouldIgnoreFile = {
3434
]
3535
}
3636

37+
const shouldNotInspectFile = {
38+
code: 'var z = 1\nvar x = "valid"',
39+
filename: 'some.test.js',
40+
options: [
41+
[{
42+
regex: 'required',
43+
files: {
44+
inspect: '.*spec\.js'
45+
}
46+
}],
47+
]
48+
}
49+
50+
const shouldHandleBothIgnoreInspectFile = {
51+
code: 'var z = 1\nvar x = "valid"',
52+
filename: 'some.test.js',
53+
options: [
54+
[{
55+
regex: 'required',
56+
files: {
57+
ignore: '.*test\.js',
58+
inspect: '.*spec\.js'
59+
}
60+
}],
61+
]
62+
}
63+
3764
const shouldFound = {
3865
code: 'var z = 1\nvar x = "required"',
3966
filename: 'some.js',
@@ -60,7 +87,9 @@ ruleTester.run(
6087
valid: [
6188
shouldIgnoreFile,
6289
shouldFound,
63-
shouldFoundAcrossLines
90+
shouldFoundAcrossLines,
91+
shouldNotInspectFile,
92+
shouldHandleBothIgnoreInspectFile
6493
],
6594
invalid: [
6695
shouldNotFind,

0 commit comments

Comments
 (0)