react-native
react-native copied to clipboard
Updating eslint packages to flat config file
Summary:
Implements eslint flat config file support
Changelog:
[GENERAL] [ADDED] - Adding support for Flat Config files
Test Plan:
Run lint
on a reproducer with the eslint config changes
Reproducer example: https://github.com/MCanhisares/eslint-flat-upgrade
Platform | Engine | Arch | Size (bytes) | Diff |
---|---|---|---|---|
android | hermes | arm64-v8a | 19,558,636 | +0 |
android | hermes | armeabi-v7a | n/a | -- |
android | hermes | x86 | n/a | -- |
android | hermes | x86_64 | n/a | -- |
android | jsc | arm64-v8a | 22,928,758 | -4 |
android | jsc | armeabi-v7a | n/a | -- |
android | jsc | x86 | n/a | -- |
android | jsc | x86_64 | n/a | -- |
Base commit: 3f17c8b5f04cd80517d7ba3943745f37dce7f5dd Branch: main
@MCanhisares Is there any chance that this will be merged soon ?
@cortinico what do we have to do to get this ready for merge?
Edit: To add more context, the JS tasks are failing because the eslint server is using the latest version of this package which should be ready for the new config format. Should we fix these issues in this PR? Or open another PR to handle the changes to the main proj?
Any update on this?
LGTM on the face of it, importing to test inside the FB monorepo.
We should bump the template devDependency
to ^8.23.0 as well though - I'll add that.
@robhogan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
Hi @MCanhisares - thanks for this and sorry it's been in review for so long. Having had a closer look, this seems to break support for legacy config - this is actually the error CI is correctly reporting, and also came up importing to the internal monorepo - it requires users to update their projects to use flat config.
I think that's too much upgrade friction, and also presumably unintentional from the PR description - we should be able to support flat config without breaking legacy just yet, as eg jsx-eslint/eslint-plugin-react#3429 did.
Hi @robhogan, sorry this took a while to get back to, but I made the changes to support both legacy and new flat config formats
In order for this to work though, we need to change our approach for the configs, and export one that supports legacy .eslintrc projects and one for projects that use the new format (confirmed by one of the core eslint maintainers ).
Another problem arises from this, where eslint reads the package name to create an alias to the config itself, so we have two alternatives:
- Move away from the current package structure, and distribute the configs on the
react-native-eslint-plugin
package (seems like the better option, and is what the react, angular, solid and many others do) - Create a new package
eslint-config-react-native-flat
and publish it so other projects can use the new config format.
The current code is uses approach 1, but I can easily migrate to 2 if you think it makes more sense
Let me know what you think, and also the tests might need to be updated to correctly read the new eslint configs. Where should I make those changes?