Skip to content

Commit

Permalink
Tweak rule for more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
CoenWarmer committed Sep 5, 2023
1 parent c0cea1c commit ca1f86e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function checkNodeForExistingDataTestSubjProp(
const variable = getScope().variables.find((v) => v.name === name); // the variable definition of the spreaded variable

return variable && variable.defs.length > 0
? variable.defs[0].node.init.properties.find((property: TSESTree.Property) => {
? variable.defs[0].node.init?.properties.find((property: TSESTree.Property) => {
if ('value' in property.key) {
return property.key.value === 'data-test-subj';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const EventGeneratingElementsShouldBeInstrumented: Rule.RuleModule = {
const intent = getIntentFromNode(parent);

// 4. The element name that generates the events
const element = name.replace('Eui', '').replace('Empty', '');
const element = name.replace('Eui', '').replace('Empty', '').replace('Icon', '');

const suggestion = `${appName}${componentName}${intent}${element}`; // 'o11yHeaderActionsSubmitButton'

Expand Down

0 comments on commit ca1f86e

Please sign in to comment.