Skip to content

Commit ae37793

Browse files
committed
refactor: use isMemberExpression
1 parent 8b2bc0b commit ae37793

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

rules/prefer-string-raw.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {isStringLiteral, isDirective} from './ast/index.js';
1+
import {isStringLiteral, isDirective, isMemberExpression} from './ast/index.js';
22
import {fixSpaceAroundKeyword} from './fix/index.js';
33

44
const MESSAGE_ID = 'prefer-string-raw';
@@ -70,12 +70,7 @@ const create = context => {
7070
context.on('TaggedTemplateExpression', node => {
7171
const {quasi, tag} = node;
7272

73-
if (tag.type !== 'MemberExpression'
74-
|| tag.object.type !== 'Identifier'
75-
|| tag.property.type !== 'Identifier'
76-
|| tag.object.name !== 'String'
77-
|| tag.property.name !== 'raw'
78-
) {
73+
if (!isMemberExpression(tag, {object: 'String', property: 'raw'})) {
7974
return;
8075
}
8176

0 commit comments

Comments
 (0)