|
1 | 1 | diff --git a/dist/rules/require-test-case-name.js b/dist/rules/require-test-case-name.js |
2 | | -index 74d279129e367ed2a4e6c601f2b596579a690f9e..9aec1f032bea7ae9324e9928b522fc6f386a9c83 100644 |
| 2 | +index b60e75d4ac94a725e09ba1fdd86dbd71228762b4..8bf4fbc0009eaecc429a0f54f22e454f825c66d0 100644 |
3 | 3 | --- a/dist/rules/require-test-case-name.js |
4 | 4 | +++ b/dist/rules/require-test-case-name.js |
5 | | -@@ -54,6 +54,12 @@ const rule = { |
| 5 | +@@ -54,6 +54,13 @@ const rule = { |
6 | 6 | hasName: false, |
7 | 7 | hasConfig: false |
8 | 8 | }; |
| 9 | ++ // We use tagged template literals to strip indentation in test cases. |
9 | 10 | + if (testCase.type === "TaggedTemplateExpression" && testCase.quasi?.type === "TemplateLiteral") return { |
10 | | -+ node: testCase.quasi, |
11 | | -+ isObject: false, |
12 | | -+ hasName: false, |
13 | | -+ hasConfig: false |
14 | | -+ }; |
| 11 | ++ node: testCase, |
| 12 | ++ isObject: false, |
| 13 | ++ hasName: false, |
| 14 | ++ hasConfig: false |
| 15 | ++ }; |
15 | 16 | if (testCase.type === "ObjectExpression") { |
16 | 17 | let hasName = false; |
17 | 18 | let hasConfig = false; |
18 | 19 | diff --git a/dist/rules/test-case-shorthand-strings.js b/dist/rules/test-case-shorthand-strings.js |
19 | | -index 584c6a36a619ab1241b72ce4f8aa199e8023f8bc..b4134b70f1871b1fcb99f0f33c16fa7524cb81a3 100644 |
| 20 | +index 8474a7400eddb2fba2e46b71b815f237e2ee1242..c7ddefb9b16007166086246962ac44451f231565 100644 |
20 | 21 | --- a/dist/rules/test-case-shorthand-strings.js |
21 | 22 | +++ b/dist/rules/test-case-shorthand-strings.js |
22 | 23 | @@ -37,6 +37,12 @@ const rule = { |
23 | 24 | shorthand: true, |
24 | 25 | needsLongform: false |
25 | 26 | }; |
| 27 | ++ // We use tagged template literals to strip indentation in test cases. |
26 | 28 | + if (testCase.type === "TaggedTemplateExpression" && testCase.quasi?.type === "TemplateLiteral") return { |
27 | | -+ node: testCase.quasi, |
28 | | -+ fixNode: testCase, |
29 | | -+ shorthand: true, |
30 | | -+ needsLongform: false |
31 | | -+ }; |
| 29 | ++ node: testCase, |
| 30 | ++ shorthand: true, |
| 31 | ++ needsLongform: false |
| 32 | ++ }; |
32 | 33 | if (testCase.type === "ObjectExpression") return { |
33 | 34 | node: testCase, |
34 | 35 | shorthand: false, |
35 | | -@@ -71,7 +77,8 @@ const rule = { |
36 | | - actual: badCaseInfo.shorthand ? "a string" : "an object" |
37 | | - }, |
38 | | - fix(fixer) { |
39 | | -- return fixer.replaceText(badCaseInfo.node, badCaseInfo.shorthand ? `{code: ${sourceCode.getText(badCaseInfo.node)}}` : sourceCode.getText(badCaseInfo.node.properties[0].value)); |
40 | | -+ const fixNode = badCaseInfo.fixNode || badCaseInfo.node; |
41 | | -+ return fixer.replaceText(fixNode, badCaseInfo.shorthand ? `{code: ${sourceCode.getText(fixNode)}}` : sourceCode.getText(fixNode.properties[0].value)); |
42 | | - } |
43 | | - }); |
44 | | - }); |
45 | 36 | diff --git a/dist/utils.js b/dist/utils.js |
46 | | -index 8ab5f760911fb4441ed9c54272504bb848a1e705..140e1a3cd080905752a6865a775c4bd9ddd70ba7 100644 |
| 37 | +index 8ab5f760911fb4441ed9c54272504bb848a1e705..04eba7ce82ef00e9b9d4188946065a6d4d8d1718 100644 |
47 | 38 | --- a/dist/utils.js |
48 | 39 | +++ b/dist/utils.js |
49 | | -@@ -22,6 +22,7 @@ function isNormalFunctionExpression(node) { |
| 40 | +@@ -22,6 +22,8 @@ function isNormalFunctionExpression(node) { |
50 | 41 | * @returns `true` if the node is probably constructing a RuleTester instance |
51 | 42 | */ |
52 | 43 | function isRuleTesterConstruction(node) { |
| 44 | ++ // We import "ruleTester" from a custom util. |
53 | 45 | + if (node.type === "CallExpression" && node.callee.type === "Identifier" && node.callee.name === "ruleTester") return true; |
54 | 46 | return node.type === "NewExpression" && (node.callee.type === "Identifier" && node.callee.name === "RuleTester" || node.callee.type === "MemberExpression" && node.callee.property.type === "Identifier" && node.callee.property.name === "RuleTester"); |
55 | 47 | } |
|
0 commit comments