Skip to content

Commit e4f500d

Browse files
author
Mika Andrianarijaona
committed
do not trigger no-incorrect-deep-equal for regular expression
fixes avajs#270
1 parent e30eafa commit e4f500d

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
yarn.lock
33
.nyc_output
44
coverage
5+
.vscode

rules/no-incorrect-deep-equal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const create = context => {
3434
const deepEqual = '[callee.property.name="deepEqual"]';
3535
const notDeepEqual = '[callee.property.name="notDeepEqual"]';
3636

37-
const argumentsLiteral = ':matches([arguments.0.type="Literal"],[arguments.1.type="Literal"])';
37+
const argumentsLiteral = ':matches([arguments.0.type="Literal"][arguments.0.regex="undefined"],[arguments.1.type="Literal"][arguments.1.regex="undefined"])';
3838
const argumentsUndefined = ':matches([arguments.0.type="Identifier"][arguments.0.name="undefined"],[arguments.1.type="Identifier"][arguments.1.name="undefined"])';
3939
const argumentsTemplate = ':matches([arguments.0.type="TemplateLiteral"],[arguments.1.type="TemplateLiteral"])';
4040

test/no-incorrect-deep-equal.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ ruleTester.run('no-incorrect-deep-equal', rule, {
4040
test('x', t => {
4141
t.notDeepEqual(expression, []);
4242
});
43+
`,
44+
`
45+
${header}
46+
test('x', t => {
47+
t.deepEqual(expression, /regex/);
48+
});
4349
`
4450
],
4551
invalid: [

0 commit comments

Comments
 (0)