Commit 1332041
committed
[eprh] Fix
Previously, the `recommended` config used the legacy ESLint format
(plugins as an array of strings). This causes errors when used with
ESLint v9's `defineConfig()` helper. This was following [eslint's own
docs](https://eslint.org/docs/latest/extend/plugins#backwards-compatibility-for-legacy-configs):
> With this approach, both configuration systems recognize
"recommended". The old config system uses the recommended key while the
current config system uses the flat/recommended key. The defineConfig()
helper first looks at the recommended key, and if that is not in the
correct format, it looks for the flat/recommended key. This allows you
an upgrade path if you’d later like to rename flat/recommended to
recommended when you no longer need to support the old config system.
However,
[`isLegacyConfig()`](https://github.com/eslint/rewrite/blob/main/packages/config-helpers/src/define-config.js#L73-L81)
(also see
[`eslintrcKeys`](https://github.com/eslint/rewrite/blob/main/packages/config-helpers/src/define-config.js#L24-L35))
function doesn't check for the `plugins` key, so our config was
incorrectly treated as flat config despite being in legacy format.
This PR fixes the issue, along with a few other fixes combined:
1. Convert `recommended` to flat config format
2. Separate basic rules (exhaustive-deps, rules-of-hooks) from compiler
rules
3. Add `recommended-latest-legacy` config for non-flat config users who
want all recommended rules (including compiler rules)
4. Adding more types for the exported config
Our shipped presets in 6.x.x will essentially be:
- `recommended-legacy`: legacy (non-flat), with basic rules only
- `recommended-latest-legacy`: legacy (non-flat), all rules (basic +
compiler)
- `flat/recommended`: flat, basic rules only (now the same as
recommended, but to avoid making a breaking change we'll just keep it
around in 6.x.x)
- `recommended-latest`: flat, all rules (basic + compiler)
- `recommended`: flat, basic rules only
In the next breaking release 7.x.x, we will collapse down the presets
into three:
- `recommended-legacy`: all recommended rules
- `recommended`: all recommended rules
- `recommended-experimental`: all recommended rules + new bleeding edge
experimental rules
Closes #34679
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/34700).
* #34703
* __->__ #34700
DiffTrain build for [26b177b](26b177b)recommended config for flat config compatibility (#34700)1 parent ebb0c7f commit 1332041
35 files changed
Lines changed: 110 additions & 97 deletions
File tree
- compiled
- eslint-plugin-react-hooks
- facebook-www
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57810 | 57810 | | |
57811 | 57811 | | |
57812 | 57812 | | |
57813 | | - | |
| 57813 | + | |
| 57814 | + | |
| 57815 | + | |
| 57816 | + | |
| 57817 | + | |
57814 | 57818 | | |
57815 | | - | |
| 57819 | + | |
57816 | 57820 | | |
57817 | 57821 | | |
57818 | | - | |
| 57822 | + | |
| 57823 | + | |
57819 | 57824 | | |
57820 | 57825 | | |
57821 | 57826 | | |
57822 | 57827 | | |
57823 | | - | |
57824 | 57828 | | |
| 57829 | + | |
57825 | 57830 | | |
57826 | 57831 | | |
57827 | 57832 | | |
57828 | 57833 | | |
57829 | | - | |
| 57834 | + | |
| 57835 | + | |
| 57836 | + | |
| 57837 | + | |
| 57838 | + | |
57830 | 57839 | | |
57831 | 57840 | | |
57832 | 57841 | | |
57833 | 57842 | | |
57834 | 57843 | | |
57835 | 57844 | | |
57836 | | - | |
| 57845 | + | |
57837 | 57846 | | |
57838 | 57847 | | |
57839 | 57848 | | |
57840 | 57849 | | |
57841 | 57850 | | |
57842 | 57851 | | |
57843 | 57852 | | |
57844 | | - | |
| 57853 | + | |
| 57854 | + | |
| 57855 | + | |
| 57856 | + | |
| 57857 | + | |
| 57858 | + | |
| 57859 | + | |
| 57860 | + | |
| 57861 | + | |
57845 | 57862 | | |
57846 | 57863 | | |
57847 | | - | |
57848 | | - | |
57849 | | - | |
57850 | | - | |
57851 | 57864 | | |
57852 | 57865 | | |
57853 | 57866 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1458 | 1458 | | |
1459 | 1459 | | |
1460 | 1460 | | |
1461 | | - | |
| 1461 | + | |
1462 | 1462 | | |
1463 | 1463 | | |
1464 | 1464 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1458 | 1458 | | |
1459 | 1459 | | |
1460 | 1460 | | |
1461 | | - | |
| 1461 | + | |
1462 | 1462 | | |
1463 | 1463 | | |
1464 | 1464 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
| 607 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
| 607 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
611 | | - | |
| 611 | + | |
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
611 | | - | |
| 611 | + | |
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20303 | 20303 | | |
20304 | 20304 | | |
20305 | 20305 | | |
20306 | | - | |
| 20306 | + | |
20307 | 20307 | | |
20308 | 20308 | | |
20309 | | - | |
| 20309 | + | |
20310 | 20310 | | |
20311 | 20311 | | |
20312 | 20312 | | |
| |||
20341 | 20341 | | |
20342 | 20342 | | |
20343 | 20343 | | |
20344 | | - | |
| 20344 | + | |
20345 | 20345 | | |
20346 | 20346 | | |
20347 | 20347 | | |
| |||
0 commit comments