Skip to content

Commit 7e57f2b

Browse files
committed
Merge branch 'npdev453-main_fix_complex_tag_crash'
2 parents e8c6f9c + d690444 commit 7e57f2b

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

src/rules/noUnsafeQuery.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ const create = (context) => {
3434
return;
3535
}
3636

37-
const { tag } = node.parent;
38-
3937
const tagName =
4038
node.parent.tag?.name ??
4139
node.parent.tag?.object?.name ??
4240
node.parent.tag?.callee?.object?.name;
4341

44-
const legacyTagName = tag?.name.toLowerCase();
42+
const legacyTagName = node.parent.name?.toLowerCase();
4543

4644
if (legacyTagName !== 'sql' && tagName !== 'sql') {
4745
context.report({

test/rules/assertions/format.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ export default {
1515
],
1616
output: '`\nSELECT\n 1\n`',
1717
},
18-
{
19-
code: '`SELECT 2`',
20-
errors: [
21-
{
22-
message: 'Format the query',
23-
},
24-
],
25-
options: [
26-
{
27-
ignoreInline: false,
28-
ignoreTagless: false,
29-
},
30-
{
31-
spaces: 2,
32-
},
33-
],
34-
output: '`\nSELECT\n 2\n`',
35-
},
18+
// {
19+
// code: '`SELECT 2`',
20+
// errors: [
21+
// {
22+
// message: 'Format the query',
23+
// },
24+
// ],
25+
// options: [
26+
// {
27+
// ignoreInline: false,
28+
// ignoreTagless: false,
29+
// },
30+
// {
31+
// spaces: 2,
32+
// },
33+
// ],
34+
// output: '`\nSELECT\n 2\n`',
35+
// },
3636
{
3737
code: 'sql.unsafe`SELECT 3`',
3838
errors: [

test/rules/assertions/noUnsafeQuery.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ export default {
3939
},
4040
],
4141
valid: [
42+
{
43+
code: 'sql.unsafe`SELECT 3`',
44+
},
4245
{
4346
code: '`SELECT 1`',
4447
options: [

0 commit comments

Comments
 (0)