react
react copied to clipboard
[React Compiler] use `filename` instead of `context.filename` in ESLint plugin
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
:
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