Skip to content

Commit d27a6e6

Browse files
authored
fix(no-identical-titles): ignore .each template cases (#788)
1 parent 9725597 commit d27a6e6

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/rules/__tests__/no-identical-title.test.ts

+12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { TSESLint } from '@typescript-eslint/experimental-utils';
2+
import dedent from 'dedent';
23
import resolveFrom from 'resolve-from';
34
import rule from '../no-identical-title';
45

@@ -113,6 +114,17 @@ ruleTester.run('no-identical-title', rule, {
113114
'describe.content(`testing backticks with the same title`);',
114115
'describe.content(`testing backticks with the same title`);',
115116
].join('\n'),
117+
dedent`
118+
describe.each\`
119+
description
120+
${'b'}
121+
\`("$description", () => {})
122+
123+
describe.each\`
124+
description
125+
${'a'}
126+
\`("$description", () => {})
127+
`,
116128
],
117129
invalid: [
118130
{

src/rules/no-identical-title.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { AST_NODE_TYPES } from '@typescript-eslint/experimental-utils';
12
import {
23
createRule,
34
getStringValue,
@@ -41,6 +42,10 @@ export default createRule({
4142
CallExpression(node) {
4243
const currentLayer = contexts[contexts.length - 1];
4344

45+
if (node.callee.type === AST_NODE_TYPES.TaggedTemplateExpression) {
46+
return;
47+
}
48+
4449
if (isDescribe(node)) {
4550
contexts.push(newDescribeContext());
4651
}

0 commit comments

Comments
 (0)