1- import type { RulePreset } from "@eslint-react/shared" ;
1+ import { toLegacyConfig } from "@eslint-react/shared" ;
22import reactDebug from "eslint-plugin-react-debug" ;
33import reactDom from "eslint-plugin-react-dom" ;
44import reactHooksExtra from "eslint-plugin-react-hooks-extra" ;
@@ -21,19 +21,7 @@ import * as recommendedTypeCheckedConfig from "./configs/recommended-type-checke
2121import * as recommendedTypeScriptConfig from "./configs/recommended-typescript" ;
2222import { padKeysLeft } from "./utils" ;
2323
24- type Config = {
25- name : string ;
26- rules : RulePreset ;
27- } ;
28-
29- function makeLegacyConfig < A extends Config > ( config : A ) {
30- // eslint-disable-next-line @typescript-eslint/no-unused-vars
31- const { name : drop , ...rest } = config ;
32- return {
33- ...rest ,
34- plugins : [ "@eslint-react" ] ,
35- } ;
36- }
24+ const toLegacy = toLegacyConfig ( [ "@eslint-react" ] ) ;
3725
3826export default {
3927 meta : {
@@ -54,23 +42,23 @@ export default {
5442 [ "recommended-type-checked" ] : recommendedTypeCheckedConfig ,
5543 [ "recommended-typescript" ] : recommendedTypeScriptConfig ,
5644 // Part: legacy presets
57- [ "all-legacy" ] : makeLegacyConfig ( allConfig ) ,
58- [ "core-legacy" ] : makeLegacyConfig ( coreConfig ) ,
59- [ "debug-legacy" ] : makeLegacyConfig ( debugConfig ) ,
60- [ "disable-debug-legacy" ] : makeLegacyConfig ( disableDebugConfig ) ,
61- [ "disable-dom-legacy" ] : makeLegacyConfig ( disableDomConfig ) ,
62- [ "disable-type-checked-legacy" ] : makeLegacyConfig ( disableTypeCheckedConfig ) ,
63- [ "disable-web-api-legacy" ] : makeLegacyConfig ( disableWebApiConfig ) ,
64- [ "dom-legacy" ] : makeLegacyConfig ( domConfig ) ,
65- [ "off-legacy" ] : makeLegacyConfig ( offConfig ) ,
66- [ "recommended-legacy" ] : makeLegacyConfig ( recommendedConfig ) ,
67- [ "recommended-type-checked-legacy" ] : makeLegacyConfig ( recommendedTypeCheckedConfig ) ,
68- [ "recommended-typescript-legacy" ] : makeLegacyConfig ( recommendedTypeScriptConfig ) ,
45+ [ "all-legacy" ] : toLegacy ( allConfig ) ,
46+ [ "core-legacy" ] : toLegacy ( coreConfig ) ,
47+ [ "debug-legacy" ] : toLegacy ( debugConfig ) ,
48+ [ "disable-debug-legacy" ] : toLegacy ( disableDebugConfig ) ,
49+ [ "disable-dom-legacy" ] : toLegacy ( disableDomConfig ) ,
50+ [ "disable-type-checked-legacy" ] : toLegacy ( disableTypeCheckedConfig ) ,
51+ [ "disable-web-api-legacy" ] : toLegacy ( disableWebApiConfig ) ,
52+ [ "dom-legacy" ] : toLegacy ( domConfig ) ,
53+ [ "off-legacy" ] : toLegacy ( offConfig ) ,
54+ [ "recommended-legacy" ] : toLegacy ( recommendedConfig ) ,
55+ [ "recommended-type-checked-legacy" ] : toLegacy ( recommendedTypeCheckedConfig ) ,
56+ [ "recommended-typescript-legacy" ] : toLegacy ( recommendedTypeScriptConfig ) ,
6957 // Part: deprecated presets
7058 /** @deprecated Use `disable-dom` instead */
7159 [ "off-dom" ] : disableDomConfig ,
7260 /** @deprecated Use `disable-dom-legacy` instead */
73- [ "off-dom-legacy" ] : makeLegacyConfig ( disableDomConfig ) ,
61+ [ "off-dom-legacy" ] : toLegacy ( disableDomConfig ) ,
7462 } ,
7563 rules : {
7664 ...react . rules ,
0 commit comments