Skip to content
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

no-raw-text nested text issue #271

Open
BPetronel opened this issue Sep 8, 2020 · 6 comments
Open

no-raw-text nested text issue #271

BPetronel opened this issue Sep 8, 2020 · 6 comments

Comments

@BPetronel
Copy link

On "eslint-plugin-react-native": "3.9.1" there seems to be a false positive error/warning

<Text testID="OuterTestId">
	Message from
	<Text numberOfLines={1} ellipsizeMode="middle" style={styles.middleText}>
		{username}
	</Text>
</Text>

There seems to be a problem with Nested Text for this rule.

@BPetronel BPetronel changed the title no-raw-text no-raw-text nested text issue Sep 8, 2020
@rsml
Copy link

rsml commented Sep 17, 2020

The issue exists on v3.9.0 too. v3.8.1 is fine though. I'm testing with a custom text component like so:
"react-native/no-raw-text": [2, { "skip": [ "Label" ] }],

@Intellicode
Copy link
Owner

Any help on this issue is appreciated, I think its the same as this: #269

@DaniyarJakupov
Copy link

Still present in "eslint-plugin-react-native": "^3.10.0"

@ejain
Copy link

ejain commented Jun 9, 2021

Still present in 3.11.0. As a workaround, you can configure the rule with { "skip": [ "Text.Text" ] }] (add "Text.Text.Text" for two levels of nesting etc).

@leotm
Copy link

leotm commented Jun 19, 2021

Noticed in 3.11.0 too, cheers @ejain this works for me

'react-native/no-raw-text': ['error', { skip: 'Text.Text' }]

leotm pushed a commit to leotm/react-native-template-new-architecture that referenced this issue Jun 20, 2021
@pipedreambomb
Copy link

pipedreambomb commented Jul 7, 2021

Yeah, I found this really confusing as nesting text like this is exactly what the React Native docs tell you to do. I made a YAML version of the workaround by ejain:

  react-native/no-raw-text:
    - error
    - skip:
        - 'Text.Text'

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

7 participants