Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
draperunner opened this issue Oct 12, 2018 · 4 comments
Closed

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

draperunner opened this issue Oct 12, 2018 · 4 comments

Comments

@draperunner
Copy link
Contributor

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'] } ],
@AleksandrZhukov
Copy link
Contributor

Added here #205, but called it as skip :)

@Intellicode
Copy link
Owner

@AleksandrZhukov made a release, thanks!

@AleksandrZhukov
Copy link
Contributor

mb we can close this issue?

@draperunner
Copy link
Contributor Author

Looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants