Skip to content

Commit c18bc37

Browse files
committed
removed an unnecessary check
1 parent 34d7f08 commit c18bc37

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

rules/prefer-t-regex.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const create = context => {
3434
if (!isRegex && lookup.type === 'Identifier') {
3535
const reference = findReference(lookup.name);
3636

37-
// Not all possible references have an init field§
37+
// Not all possible references have an init field
3838
if (reference && reference.init) {
3939
isRegex = reference.init.regex;
4040
}
@@ -91,10 +91,6 @@ const create = context => {
9191
const firstArg = node.arguments[0];
9292
const secondArg = node.arguments[1];
9393

94-
if (!firstArg || !secondArg) {
95-
return;
96-
}
97-
9894
const firstIsRx = isRegExp(firstArg);
9995
const secondIsRx = isRegExp(secondArg);
10096

@@ -111,7 +107,7 @@ const create = context => {
111107
const fix = fixer => {
112108
const source = context.getSourceCode();
113109
return [
114-
fixer.replaceText(node.callee.property, 'regex'),
110+
fixer.replaceText(node.callee.property, assertion),
115111
fixer.replaceText(firstArg, `${source.getText(matchee)}`),
116112
fixer.replaceText(secondArg, `${source.getText(regex)}`)
117113
];

0 commit comments

Comments
 (0)