Skip to content
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/rules/consistent-data-testid.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getDocsUrl } from '../utils';
import { ESLintUtils, TSESTree } from '@typescript-eslint/experimental-utils';
import { ESLintUtils } from '@typescript-eslint/experimental-utils';
import { isJSXAttribute, isLiteral } from '../node-utils';

export const RULE_NAME = 'consistent-data-testid';
Expand All @@ -13,6 +13,11 @@ type Options = [

const FILENAME_PLACEHOLDER = '{fileName}';

/**
* This rule is not created with `createTestingLibraryRule` since:
* - it doesn't need any detection helper
* - it doesn't apply to testing files but component files
*/
export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
name: RULE_NAME,
meta: {
Expand Down Expand Up @@ -89,7 +94,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
}

return {
[`JSXIdentifier`]: (node: TSESTree.JSXIdentifier) => {
JSXIdentifier: (node) => {
if (
!isJSXAttribute(node.parent) ||
!isLiteral(node.parent.value) ||
Expand Down