Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Feature Request] Exclude children of specific JSX components in eslint-plugin-formatjs/no-literal-string-in-jsx #5132

Copy link
Copy link
@Jisu-Woniu

Description

@Jisu-Woniu
Issue body actions

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:

JSXAttribute: (node: TSESTree.JSXAttribute) => {
if (shouldSkipCurrentJsxAttribute(node)) {
return
}

But no checks for JSX text items:

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.