-
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
[3.9.1] Crash related to <Text> #270
Comments
I got the same issue using the latest version |
Same issue when I use Adding |
+1 eslint error: Oops! Something went wrong! :( ESLint: 7.13.0 Error: Couldn't find a Program actionsheet/view.tsx:59 |
Can confirm this happened to me on a larger project. Version |
Same issue here with <Button onPress={() => functionWithuseCallback(true)}>Click me</Button> |
Came up with a workaround 😄 "rules": {
"react-native/no-raw-text": "off",
}, |
I'm also getting this error with both arrow functions on Package.json:
.eslintrc.json
Using node v14.16.0 |
Have the same issue with <SomeComponent prop={array.reduce((acc, item) => [...acc, processItem(item)], [])} /> with const prop = useMemo(
() =>
array.reduce(
(acc, item) => [
...acc,
processItem(item)
],
[]
),
[array]
);
// ...
<SomeComponent prop={prop} /> Disabled this rule for now, waiting for a proper solution. |
This is still present in 3.11.0. |
The minimum conditions to reproduce this linting crash are: So, the minimal reproducible example is the following one:
To fix this issue, you should define the prop before passing it, like so:
|
@VincentJouanne This doesn't work with useCallback hook though 🙁 |
@Xriot Can you post the minimum reproducible example with a useCallback() ? |
Still getting this issue on: eslint 7.14.0 :/ |
Really appreciate the amount of attention this gets from the maintainers. |
no help if I need to pass an arg, sadly |
what do you mean by that? |
ETA: I have worked out a work-around for this - a curried function:
|
I had this problem with the code below <Text>
Something?{' '}
<TouchableOpacity
onPress={() => fun()}
>
<Text>
Something
</Text>
</TouchableOpacity>
</Text> I have no idea why, I just tweaked the text to this and the error went away. <Text>
<Text>Something? </Text>
<TouchableOpacity
onPress={() => fun()}
>
<Text>
Something
</Text>
</TouchableOpacity>
</Text> Might be related to some structure of nested text RN elements in my case. |
#314 should fix this |
@hsource still exists |
That shouldn't be right! What error message are you seeing? If you'd like to test with a build, you can also do |
Thanks! I'll try it out. |
For those interested, here is my brief explanation about this issue: #314 (comment) |
The problem still exists in |
Had the same problem, fixed it by assigning the value to a constant. Simplified example: Didn't work: Works:
Not sure if this is helpful for anyone but worked for me and it is prettier imo. |
Any timeline on the possibility of the PR that fixes it being merged? |
Still present in! eslint: 8.35.0 |
Having this issue as well... My config:
The error:
|
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily understand what the code changes affect. --> ## Summary <!-- Explain the motivation for this PR. Include "Fixes #<number>" if applicable. --> * Rules for whole repo: * '`@typescript-eslint/no-duplicate-type-constituents': 'error'` - means that types like `number|number` are not allowed * `eqeqeq: 'error' - you can't compare with `==`, use `===` instead * `'no-unreachable': 'error'` - no unreachable code, especially inside a function, after return statement. * Rules for examples in folder app: * `'react-native/no-unused-styles': 'error'`, * `'react-native/no-raw-text': 'off'`, - this rule is very convenient, but due to this bug [LINK](Intellicode/eslint-plugin-react-native#270) we can't use it with CI 😠 * `'no-inline-styles/no-inline-styles': 'error'` * `'react-native/no-inline-styles': 'off'`, (this rule does not allow variable styles with ternary operators, so I've used the one above) * `'react-native/no-single-element-style-arrays': 'error'`, * Create separate .eslintrc.js config for tests with separate rules * `'jest/no-disabled-tests': 'warn'`, * `'jest/no-focused-tests': 'error'`, * `'jest/no-identical-title': 'error'`, * `'jest/prefer-to-have-length': 'warn'`, * `'jest/valid-expect': 'error'`, ## Test plan <!-- Provide a minimal but complete code snippet that can be used to test out this change along with instructions how to run it and a description of the expected behavior. --> CI check pass ✅ --------- Co-authored-by: Aleksandra Cynk <aleksandracynk@swmansion.com> Co-authored-by: Tomasz Żelawski <40713406+tjzel@users.noreply.github.com>
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily understand what the code changes affect. --> ## Summary <!-- Explain the motivation for this PR. Include "Fixes #<number>" if applicable. --> * Rules for whole repo: * '`@typescript-eslint/no-duplicate-type-constituents': 'error'` - means that types like `number|number` are not allowed * `eqeqeq: 'error' - you can't compare with `==`, use `===` instead * `'no-unreachable': 'error'` - no unreachable code, especially inside a function, after return statement. * Rules for examples in folder app: * `'react-native/no-unused-styles': 'error'`, * `'react-native/no-raw-text': 'off'`, - this rule is very convenient, but due to this bug [LINK](Intellicode/eslint-plugin-react-native#270) we can't use it with CI 😠 * `'no-inline-styles/no-inline-styles': 'error'` * `'react-native/no-inline-styles': 'off'`, (this rule does not allow variable styles with ternary operators, so I've used the one above) * `'react-native/no-single-element-style-arrays': 'error'`, * Create separate .eslintrc.js config for tests with separate rules * `'jest/no-disabled-tests': 'warn'`, * `'jest/no-focused-tests': 'error'`, * `'jest/no-identical-title': 'error'`, * `'jest/prefer-to-have-length': 'warn'`, * `'jest/valid-expect': 'error'`, ## Test plan <!-- Provide a minimal but complete code snippet that can be used to test out this change along with instructions how to run it and a description of the expected behavior. --> CI check pass ✅ --------- Co-authored-by: Aleksandra Cynk <aleksandracynk@swmansion.com> Co-authored-by: Tomasz Żelawski <40713406+tjzel@users.noreply.github.com>
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily understand what the code changes affect. --> ## Summary <!-- Explain the motivation for this PR. Include "Fixes #<number>" if applicable. --> * Rules for whole repo: * '`@typescript-eslint/no-duplicate-type-constituents': 'error'` - means that types like `number|number` are not allowed * `eqeqeq: 'error' - you can't compare with `==`, use `===` instead * `'no-unreachable': 'error'` - no unreachable code, especially inside a function, after return statement. * Rules for examples in folder app: * `'react-native/no-unused-styles': 'error'`, * `'react-native/no-raw-text': 'off'`, - this rule is very convenient, but due to this bug [LINK](Intellicode/eslint-plugin-react-native#270) we can't use it with CI 😠 * `'no-inline-styles/no-inline-styles': 'error'` * `'react-native/no-inline-styles': 'off'`, (this rule does not allow variable styles with ternary operators, so I've used the one above) * `'react-native/no-single-element-style-arrays': 'error'`, * Create separate .eslintrc.js config for tests with separate rules * `'jest/no-disabled-tests': 'warn'`, * `'jest/no-focused-tests': 'error'`, * `'jest/no-identical-title': 'error'`, * `'jest/prefer-to-have-length': 'warn'`, * `'jest/valid-expect': 'error'`, ## Test plan <!-- Provide a minimal but complete code snippet that can be used to test out this change along with instructions how to run it and a description of the expected behavior. --> CI check pass ✅ --------- Co-authored-by: Aleksandra Cynk <aleksandracynk@swmansion.com> Co-authored-by: Tomasz Żelawski <40713406+tjzel@users.noreply.github.com>
Is this ever going to be fixed? This is a major issue. |
Hey! 👋
I'm getting
Error: Couldn't find a Program
after upgrading this package from 3.8.1 to 3.9.1.Bit of a contrived example below, but seems to reliably trigger the issue and was just about the smallest repro I could manage to find. Not able to post the actual code we're using I'm afraid but it's essentially rendering something like:
Seems to be something to do with nested text that has a function defined somewhere inside. In our case there's a reducer for calculating a total.
Some notes:
arr.reduce(function add(acc, value) { return acc + value }, 0)
arr.reduce('blah', 0)
(obviously invalid code though)const add = (acc, value) => acc + value
andarr.reduce(add, 0)
<- looks like this is a reasonable workaround for now...Repro code:
The text was updated successfully, but these errors were encountered: