-
Notifications
You must be signed in to change notification settings - Fork 130
no-raw-text does not properly consider Animated.Text #225
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
Comments
You can add this to your .eslintrc for a short term fix @holden-caulfield 'react-native/no-raw-text': [ I use NativeBase so the h1, h2, h3 also fit this I agree the rule needs to be adjusted to fix these by default rather than needing the skip setup though. |
Thanks!! |
I think the issue should be relatively easy to fix, so if anyone wants to give it a shot :) |
PR is up. I also considered adding the H1, H2, H3 tags but since those are library specific I wasn't sure if it would be appropriate. |
I know this change has already been merged so maybe this should be brought up in a new issue but, am I the only one who would like some kind of wildcard matching? Ideally I'd like an option to suppress errors if the component name ends with Text. There are a number of places in my code where I will use styled to create various Text components with different styling. The names can vary but generally always end with Text. There may be reasons why this shouldn't be the default behaviour but as an opt-in I can't see it causing any pain. Another option would be to allow regex to be passed to skip. Happy to have a look at implementing this if it's likely to get merged. |
The above merge should be reverted. See comments of the PR, it was never actually fixed. |
Does not work for me.
|
I have a similar issue, I have a custom component called I have plenty of other components in there, and working well with this rule, however none of them has a |
In my case, with
I used
And it worked OK. |
Any update on this Issue? I'm using <Button
mode="outlined"
onPress={() => props.navigation.navigate('SignUp')}
color={COLORS.primaryGreen}
style={[styles.button, { borderColor: COLORS.primaryGreen, borderWidth: 3, backgroundColor: COLORS.white }]}
>
Sign Up
</Button> error: I add this to the eslint rules to no avail: 'react-native/no-raw-text': [
2,
{
skip: [ 'Button', 'Button.Text' ]
}
], |
I hit a similar For example:
The first two variations work fine, but the third one errors. It seems like the lint rule may not be accounting for some valid AST variations in its logic? |
@merrywhether this case should be covered here #270 |
skip is working for me {
"rules": {
"react-native/no-raw-text": [
2,
{
"skip": ["Animated.Text", "Button", "Link"]
}
],
}
} |
The following code:
Triggers this error:
This should not create an error as Animated.Text is a Text tag
The text was updated successfully, but these errors were encountered: