-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
Which package?
eslint-plugin-formatjs
Describe the bug
I want to exclude i18n for all children of a specific element, e.g. <MenubarShortcut>
since it will not be helpful to translate Ctrl+C
or something like that.
Currently, the exclude
prop only works for JSX attributes:
formatjs/packages/eslint-plugin-formatjs/rules/no-literal-string-in-jsx.ts
Lines 185 to 188 in 3a192d4
JSXAttribute: (node: TSESTree.JSXAttribute) => { | |
if (shouldSkipCurrentJsxAttribute(node)) { | |
return | |
} |
But no checks for JSX text items:
formatjs/packages/eslint-plugin-formatjs/rules/no-literal-string-in-jsx.ts
Lines 211 to 221 in 3a192d4
JSXText: (node: TSESTree.JSXText) => { | |
// Ignore purely spacing fragments | |
if (!node.value.replace(/\s*/gm, '')) { | |
return | |
} | |
context.report({ | |
node: node, | |
messageId: 'noLiteralStringInJsx', | |
}) | |
}, |
Expected behavior
A way to exclude children of specific JSX elements.
Metadata
Metadata
Assignees
Labels
No labels