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

[React Compiler] use filename instead of context.filename in ESLint plugin #29104

Merged

Conversation

kirillzyusko
Copy link
Contributor

@kirillzyusko kirillzyusko commented May 16, 2024

Summary

Use filename instead of context.filename in eslint compiler.

The problem is that in react-native + typescript project the context may not have filename:

image

And eslint will crash with:

TypeError: Error while loading rule 'react-compiler/react-compiler': Cannot read properties of undefined (reading 'endsWith')

But in fact we already derive filename variable earlier so we can simply reuse the variable (I guess).

How did you test this change?

  • add eslint plugin to RN project;
  • run eslint

@kirillzyusko kirillzyusko changed the title fix: use filename instead of context.filename in eslint compiler [React Compiler] use filename instead of context.filename in ESLint compiler May 16, 2024
@kirillzyusko kirillzyusko changed the title [React Compiler] use filename instead of context.filename in ESLint compiler [React Compiler] use filename instead of context.filename in ESLint plugin May 16, 2024
@gsathya gsathya requested a review from poteto May 16, 2024 15:22
Copy link
Member

@poteto poteto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the fix!

@kirillzyusko
Copy link
Contributor Author

thanks for the fix!

My pleasure! 😊

@poteto poteto merged commit e8779a9 into facebook:main May 16, 2024
31 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants