-
Notifications
You must be signed in to change notification settings - Fork 25k
Updating eslint packages to flat config file #43959
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
Conversation
Base commit: 3f17c8b |
|
@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 |
|
@robhogan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
robhogan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
…nstructions for flat config files
c16e55c to
fa9fccd
Compare
|
|
||
| | Eslint version | `.eslintrc` support | `eslint.config.js` support | | ||
| | :------------------- | :-----------------: | :------------------------: | | ||
| | `>= 9.0.0` | ❌ | ❌ | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
green check in eslint.config.js column here?
10afaf3 to
e2badfd
Compare
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:
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? |
|
Hi, can we merge this soon? We can't use eslint 9 for now. Thanks 🙏🏻 |
My suggestion is to create a new package called |
|
It's been almost a year, guess we‘ll never get there. 😂 |
| const reactNative = require('@react-native/eslint-plugin'); | ||
| const myplugin = require('my-plugin'); | ||
|
|
||
| module.exports = [ | ||
| ...reactNative.configs.flat, | ||
| { | ||
| plugins: { | ||
| myplugin | ||
| }, | ||
| ... | ||
| }, | ||
| ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this example use ESM?
|
I would love to see this PR get some more 💙 and attention. @MCanhisares I know it's been a while, but I have a few clarifying questions towards your last comment.
Does the PR in it's current state reflect this? Or is that an outstanding task?
When is this an issue?
Do you need any help with this? |
|
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
I created the PR for Flat Config support because this PR is stale and doesn't seem likely to move forward |
Glad you were able to figure out a solution and the maintainers responded to the PR - as soon as it's merged I'll close this one |
Summary:
Implements eslint flat config file support
Changelog:
[GENERAL] [ADDED] - Adding support for Flat Config files
Test Plan:
Run
linton a reproducer with the eslint config changesReproducer example: https://github.com/MCanhisares/eslint-flat-upgrade