-
Notifications
You must be signed in to change notification settings - Fork 130
no-raw-text doesn't work for custom styled components #248
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
Same problem... My codebase is using a lot of Typograph components made with |
+1 |
First, @vjsingh You should rename the issue to 'no-raw-text doesn't work for Been doing some investigation into what it would take to implement this. |
Also running into this. One possible option to fix it would be to change the 'react-native/no-raw-text': ['error', {skip: '/Text$/'}] to skip any component that is suffixed with |
@mattpetrie |
This does not work for me. I.e. I have a styled component called <SummaryText> if I add skip: ['SummaryText'] the error goes away so the rule is working. But /Text$/ doesn't work (nor did /^Text/ work for <TextSummary>). I've also tried does variations on this, ie. /Text.*/ /.Text../
Thanks in advance, sorry if I'm missing something simple. |
RegEx does not work for me with version: v3.10.0 |
Regex isnt implemented, @mattpetrie was simply giving a suggestion. |
Hi. How are you all currently working around this problem? |
You need to put the same tag name as the one you're using in the code, without the regex, something like: // your styled components:
const Text = styled.Text``
const AnotherText = styled.Text``
// your rule:
'react-native/no-raw-text': [
'error',
{
skip: [
'Text',
'AnotherText'
],
},
], |
Unless I'm doing something wrong, the no-raw-text rule doesn't seem to work when using styled-components. This makes it largely useless I think? Would be nice to be able to use this rule but not sure how to do so when using styled-components.
The text was updated successfully, but these errors were encountered: