Skip to content

Commit 145ce73

Browse files
committed
refactor: refine compatible types
1 parent b9042d7 commit 145ce73

File tree

44 files changed

+386
-388
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+386
-388
lines changed

apps/website/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
"@eslint-react/eff": "workspace:*",
1515
"bsky-react-post": "^0.1.7",
1616
"clsx": "^2.1.1",
17-
"fumadocs-core": "15.7.4",
17+
"fumadocs-core": "15.7.7",
1818
"fumadocs-docgen": "3.0.0",
19-
"fumadocs-mdx": "11.8.1",
20-
"fumadocs-twoslash": "3.1.6",
19+
"fumadocs-mdx": "11.8.2",
20+
"fumadocs-twoslash": "3.1.7",
2121
"fumadocs-typescript": "4.0.6",
22-
"fumadocs-ui": "15.7.4",
22+
"fumadocs-ui": "15.7.7",
2323
"lucide-react": "^0.542.0",
2424
"next": "^15.5.2",
2525
"next-view-transitions": "^0.3.4",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"@typescript-eslint/rule-tester": "^8.41.0",
7171
"@typescript-eslint/types": "^8.41.0",
7272
"ansis": "^4.1.0",
73-
"cspell": "^9.2.0",
73+
"cspell": "^9.2.1",
7474
"dedent": "^1.6.0",
7575
"dprint": "^0.50.1",
7676
"effect": "^3.17.9",

packages/plugins/eslint-plugin-react-debug/src/configs/all.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { RulePreset } from "@eslint-react/kit";
1+
import type { RuleConfig } from "@eslint-react/kit";
22
import { DEFAULT_ESLINT_REACT_SETTINGS } from "@eslint-react/shared";
33

44
export const name = "react-debug/all";
@@ -9,7 +9,7 @@ export const rules = {
99
"react-debug/hook": "warn",
1010
"react-debug/is-from-react": "warn",
1111
"react-debug/jsx": "warn",
12-
} as const satisfies RulePreset;
12+
} as const satisfies Record<string, RuleConfig>;
1313

1414
export const settings = {
1515
"react-x": DEFAULT_ESLINT_REACT_SETTINGS,

packages/plugins/eslint-plugin-react-debug/src/index.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
1-
import type { RulePreset } from "@eslint-react/kit";
2-
import type { CompatibleConfig } from "@eslint-react/shared";
1+
import { getConfigAdapters } from "@eslint-react/shared";
32

43
import * as allConfig from "./configs/all";
54
import { plugin } from "./plugin";
65

7-
function toFlatConfig(config: CompatibleConfig) {
8-
return {
9-
...config,
10-
plugins: {
11-
"react-debug": plugin,
12-
},
13-
};
14-
}
15-
16-
function toLegacyConfig({ rules }: { rules: RulePreset }) {
17-
return {
18-
plugins: ["react-debug"],
19-
rules,
20-
};
21-
}
6+
const { toFlatConfig, toLegacyConfig } = getConfigAdapters("react-debug", plugin);
227

238
export default {
249
...plugin,

packages/plugins/eslint-plugin-react-debug/src/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CompatiblePlugin } from "@eslint-react/shared";
1+
import type { CompatiblePlugin } from "@eslint-react/kit";
22

33
import { name, version } from "../package.json";
44

packages/plugins/eslint-plugin-react-dom/src/configs/recommended.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { RulePreset } from "@eslint-react/kit";
1+
import type { RuleConfig } from "@eslint-react/kit";
22
import { DEFAULT_ESLINT_REACT_SETTINGS } from "@eslint-react/shared";
33

44
export const name = "react-dom/recommended";
@@ -19,7 +19,7 @@ export const rules = {
1919
"react-dom/no-unsafe-target-blank": "warn",
2020
"react-dom/no-use-form-state": "error",
2121
"react-dom/no-void-elements-with-children": "error",
22-
} as const satisfies RulePreset;
22+
} as const satisfies Record<string, RuleConfig>;
2323

2424
export const settings = {
2525
"react-x": DEFAULT_ESLINT_REACT_SETTINGS,

packages/plugins/eslint-plugin-react-dom/src/index.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
1-
import type { RulePreset } from "@eslint-react/kit";
2-
import type { CompatibleConfig } from "@eslint-react/shared";
1+
import { getConfigAdapters } from "@eslint-react/shared";
32

43
import * as recommendedConfig from "./configs/recommended";
54
import { plugin } from "./plugin";
65

7-
function toFlatConfig(config: CompatibleConfig) {
8-
return {
9-
...config,
10-
plugins: {
11-
"react-dom": plugin,
12-
},
13-
};
14-
}
15-
16-
function toLegacyConfig({ rules }: { rules: RulePreset }) {
17-
return {
18-
plugins: ["react-dom"],
19-
rules,
20-
};
21-
}
6+
const { toFlatConfig, toLegacyConfig } = getConfigAdapters("react-dom", plugin);
227

238
export default {
249
...plugin,

packages/plugins/eslint-plugin-react-dom/src/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CompatiblePlugin } from "@eslint-react/shared";
1+
import type { CompatiblePlugin } from "@eslint-react/kit";
22

33
import { name, version } from "../package.json";
44

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { RulePreset } from "@eslint-react/kit";
1+
import type { RuleConfig } from "@eslint-react/kit";
22

33
export const name = "react-hooks-extra/recommended";
44

55
export const rules = {
66
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
77
"react-hooks-extra/no-unnecessary-use-prefix": "warn",
88
"react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
9-
} as const satisfies RulePreset;
9+
} as const satisfies Record<string, RuleConfig>;

packages/plugins/eslint-plugin-react-hooks-extra/src/index.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
1-
import type { RulePreset } from "@eslint-react/kit";
2-
import type { CompatibleConfig } from "@eslint-react/shared";
1+
import { getConfigAdapters } from "@eslint-react/shared";
32

43
import * as recommendedConfig from "./configs/recommended";
54
import { plugin } from "./plugin";
65

7-
function toFlatConfig(config: CompatibleConfig) {
8-
return {
9-
...config,
10-
plugins: {
11-
"react-hooks-extra": plugin,
12-
},
13-
};
14-
}
15-
16-
function toLegacyConfig({ rules }: { rules: RulePreset }) {
17-
return {
18-
plugins: ["react-hooks-extra"],
19-
rules,
20-
};
21-
}
6+
const { toFlatConfig, toLegacyConfig } = getConfigAdapters("react-hooks-extra", plugin);
227

238
export default {
249
...plugin,

0 commit comments

Comments
 (0)