-
Notifications
You must be signed in to change notification settings - Fork 128
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
Rule to detect JSX text not in a Text component #186
Comments
Excellent idea! I'll see if I can have a go at it |
Added this new rule #201 |
Awesome! I was just searching for a rule like that.
React Native does not evaluate |
no, this one is the only case that can't be handled or I didn't understand how 😄 |
Yes, I know. Problem is to not forget about that while writing code... |
Needs the ability to configure it. i.e. So you can add 'CustomStyledText' to valid text nodes if you use a Text wrapper to provide standardized text styles through your app. Sadly even with that this quickly falls apart for me because I use |
can you provide a code example? yeah, seems this rule doesn't support styled components, but need to investigate |
Styled example: const ContentText = styled.Text`
${material.body1Object}
color: ${colors.primaryText};
`; Example of a "standard" wrapper: <MaterialText body1>Foo</MaterialText> Or a port of MUI's Typography: https://material-ui.com/style/typography/ |
Standardized within an app, anyone can make their own with the typography rules for their app. That's just an example of an old one I made to wrap Text with Material Design typography classes. |
#205 only works with styled components if the styled Text component is called StyledText, does not work if several StyledText are defined, unless each of them is skipped... |
I am using |
In some components such as View, text can not be placed directly inside (it must be wrapped with a Text component).
Could you add a rule for this ? Ideally list of standard component forbidding direct use of text could be completed with a rule configuration.
The text was updated successfully, but these errors were encountered: