Skip to content

no-raw-text fails for custom components (add ignore option?) #204

@draperunner

Description

@draperunner

Problematic case with custom components:

const Title = ({ children }) => (
    <Text style={styles.title}>
        { children }
    </Text>
)
// Next line gets no-raw-text error!
const title = <Title>This is the title</Title> 

Problematic case with jsx-control-statements:

<Text>
    <If condition={showText}>
        This is text. Real text.
    </If>
</Text>

Both these cases could be solved with a blacklist/ignore option for the no-raw-text rule. For example

"react-native/no-raw-text": ["error", { ignore: ['Title', 'If', 'Choose', 'When', 'Otherwise'] } ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions