Skip to content

Commit d963ccd

Browse files
authoredFeb 6, 2025··
prefer-string-raw: Ignore ImportAttribute (#2551)
1 parent 4a677c6 commit d963ccd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
 

‎rules/prefer-string-raw.js

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const create = context => {
4747
|| (node.parent.type === 'Property' && !node.parent.computed && node.parent.key === node)
4848
|| (node.parent.type === 'JSXAttribute' && node.parent.value === node)
4949
|| (node.parent.type === 'TSEnumMember' && (node.parent.initializer === node || node.parent.id === node))
50+
|| (node.parent.type === 'ImportAttribute' && (node.parent.key === node || node.parent.value === node))
5051
) {
5152
return;
5253
}

‎test/prefer-string-raw.js

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ test.snapshot({
3030
},
3131
},
3232
},
33+
String.raw`import {} from "foo" with {key: "value\\value"}`,
34+
String.raw`import {} from "foo" with {"key\\key": "value"}`,
35+
String.raw`export {} from "foo" with {key: "value\\value"}`,
36+
String.raw`export {} from "foo" with {"key\\key": "value"}`,
3337
],
3438
invalid: [
3539
String.raw`a = 'a\\b'`,

0 commit comments

Comments
 (0)
Please sign in to comment.