Skip to content

Commit 5b4fe3f

Browse files
committed
fix linting erros with '?.' expression
1 parent 4f2a2ff commit 5b4fe3f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/rules/jsx-no-literals.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ module.exports = {
107107

108108
function isParentNodeStandard() {
109109
if (!/^[\s]+$/.test(node.value) && typeof node.value === 'string' && parent.type.includes('JSX')) {
110-
111110
if (config.noAttributeStrings) {
112-
return (parent.type === 'JSXAttribute' || parent.type === 'JSXElement') && !config.allowedProps.has(parent.name?.name);
111+
const isAllowedProp = parent.name && config.allowedProps.has(parent.name.name);
112+
return (parent.type === 'JSXAttribute' || parent.type === 'JSXElement') && !isAllowedProp;
113113
}
114114
if (!config.noAttributeStrings) {
115115
return parent.type !== 'JSXAttribute';

0 commit comments

Comments
 (0)