Skip to content

Commit

Permalink
fix linting erros with '?.' expression
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagofelix committed Jun 15, 2023
1 parent 4f2a2ff commit 5b4fe3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rules/jsx-no-literals.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ module.exports = {

function isParentNodeStandard() {
if (!/^[\s]+$/.test(node.value) && typeof node.value === 'string' && parent.type.includes('JSX')) {

if (config.noAttributeStrings) {
return (parent.type === 'JSXAttribute' || parent.type === 'JSXElement') && !config.allowedProps.has(parent.name?.name);
const isAllowedProp = parent.name && config.allowedProps.has(parent.name.name);
return (parent.type === 'JSXAttribute' || parent.type === 'JSXElement') && !isAllowedProp;
}
if (!config.noAttributeStrings) {
return parent.type !== 'JSXAttribute';
Expand Down

0 comments on commit 5b4fe3f

Please sign in to comment.