Skip to content

Commit a878b8f

Browse files
authored
refactor: refine plugin configuration types (#1209)
1 parent 211c610 commit a878b8f

File tree

43 files changed

+123
-149
lines changed

Some content is hidden

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

43 files changed

+123
-149
lines changed

examples/react-dom/eslint.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// @ts-check
2+
13
import eslintReact from "@eslint-react/eslint-plugin";
24
import eslintJs from "@eslint/js";
35
import eslintPluginReactHooks from "eslint-plugin-react-hooks";

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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type { RulePreset } from "@eslint-react/kit";
2-
import type { CompatibleConfig } from "@eslint-react/shared";
1+
import type { CompatibleConfig } from "@eslint-react/kit";
32

43
import * as allConfig from "./configs/all";
54
import { plugin } from "./plugin";
@@ -13,7 +12,7 @@ function toFlatConfig(config: CompatibleConfig) {
1312
};
1413
}
1514

16-
function toLegacyConfig({ rules }: { rules: RulePreset }) {
15+
function toLegacyConfig({ rules }: CompatibleConfig) {
1716
return {
1817
plugins: ["react-debug"],
1918
rules,

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";
@@ -20,7 +20,7 @@ export const rules = {
2020
"react-dom/no-unsafe-target-blank": "warn",
2121
"react-dom/no-use-form-state": "error",
2222
"react-dom/no-void-elements-with-children": "error",
23-
} as const satisfies RulePreset;
23+
} as const satisfies Record<string, RuleConfig>;
2424

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

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

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

43
import * as recommendedConfig from "./configs/recommended";
54
import { plugin } from "./plugin";
@@ -13,7 +12,7 @@ function toFlatConfig(config: CompatibleConfig) {
1312
};
1413
}
1514

16-
function toLegacyConfig({ rules }: { rules: RulePreset }) {
15+
function toLegacyConfig({ rules }: CompatibleConfig) {
1716
return {
1817
plugins: ["react-dom"],
1918
rules,

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,7 +1,7 @@
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",
7-
} as const satisfies RulePreset;
7+
} as const satisfies Record<string, RuleConfig>;

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

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

44
import * as recommendedConfig from "./configs/recommended";
55
import { plugin } from "./plugin";
@@ -13,7 +13,7 @@ function toFlatConfig(config: CompatibleConfig) {
1313
};
1414
}
1515

16-
function toLegacyConfig({ rules }: { rules: RulePreset }) {
16+
function toLegacyConfig({ rules }: CompatibleConfig) {
1717
return {
1818
plugins: ["react-hooks-extra"],
1919
rules,

packages/plugins/eslint-plugin-react-hooks-extra/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

0 commit comments

Comments
 (0)