@vp-tw/eslint-config 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,25 @@
1
1
  import antfu from "@antfu/eslint-config";
2
2
  import packageJson from "eslint-plugin-package-json/configs/recommended";
3
3
  import * as reactCompilerPlugin from "eslint-plugin-react-compiler";
4
+ import { isPackageExists } from "local-pkg";
4
5
  import { mdx } from "./configs/mdx.mjs";
5
6
  import { prettier } from "./configs/prettier.mjs";
6
- import "./eslint-typegen.d";
7
+ import { storybook } from "./configs/storybook.mjs";
7
8
  const vdustr = (options, ...userConfigs) => {
8
- const mdxOptions = options?.mdx ?? true;
9
+ const typescriptEnabled = isPackageExists("typescript");
9
10
  const jsoncEnabled = Boolean(options?.jsonc ?? true);
11
+ const reactEnabled = Boolean(options?.react ?? false);
12
+ const storybookEnabled = Boolean(options?.storybook ?? false);
13
+ const mdxOptions = options?.mdx ?? true;
10
14
  const defaultConfigs = [
11
15
  ...!jsoncEnabled ? [] : [packageJson],
12
16
  ...!mdxOptions ? [] : mdx({
13
17
  ...typeof mdxOptions !== "object" ? null : mdxOptions
14
18
  }),
19
+ ...!storybookEnabled ? [] : storybook,
15
20
  prettier
16
21
  ];
17
- return antfu(
22
+ let config = antfu(
18
23
  {
19
24
  // We use `prettier`.
20
25
  stylistic: false,
@@ -22,10 +27,11 @@ const vdustr = (options, ...userConfigs) => {
22
27
  },
23
28
  ...defaultConfigs,
24
29
  ...userConfigs
25
- ).override("antfu/javascript/rules", (config) => ({
26
- ...config,
30
+ );
31
+ config = config.override("antfu/javascript/rules", (config2) => ({
32
+ ...config2,
27
33
  rules: {
28
- ...config.rules,
34
+ ...config2.rules,
29
35
  /**
30
36
  * Some callbacks are purposefully named to make the code self-documenting.
31
37
  */
@@ -40,62 +46,103 @@ const vdustr = (options, ...userConfigs) => {
40
46
  "unused-imports/no-unused-vars-ts": "off",
41
47
  "unused-imports/no-unused-imports": "off"
42
48
  }
43
- })).override("antfu/imports/rules", (config) => ({
44
- ...config,
49
+ })).override("antfu/imports/rules", (config2) => ({
50
+ ...config2,
45
51
  rules: {
46
- ...config.rules,
52
+ ...config2.rules,
47
53
  /**
48
54
  * Forbid `import {} from "module"`.
49
55
  */
50
- "import/no-empty-named-blocks": "error"
51
- }
52
- })).override("antfu/typescript/rules", (config) => ({
53
- ...config,
54
- rules: {
55
- ...config.rules,
56
- "ts/array-type": ["error", { default: "generic" }],
56
+ "import/no-empty-named-blocks": "error",
57
57
  /**
58
- * Namespaces are useful for centralizing the management of types. Just avoid
59
- * overusing them with runtime code.
60
- *
61
- * - References:
62
- * - <https://x.com/mattpocockuk/status/1805606072167940167>
58
+ * Wildcard imports can prevent tree shaking and cause name conflicts.
59
+ * Consider using named imports instead.
63
60
  */
64
- "ts/no-namespace": "off",
65
- "ts/no-redeclare": "off",
61
+ "import/no-namespace": "error",
66
62
  /**
67
- * Check for unused variables in TypeScript.
63
+ * Enforcing named exports improves consistency, enhances auto-completion and refactoring, and avoids issues
64
+ * with default export renaming. Additionally, default exports might lead to different behavior when transformed
65
+ * to CJS.
68
66
  */
69
- "ts/no-unused-vars": "off"
67
+ "import/no-default-export": "error"
70
68
  }
71
- })).override("antfu/jsonc/rules", (config) => ({
72
- ...config,
69
+ })).insertAfter("antfu/imports/rules", {
70
+ name: "vdustr/allow-default-export",
73
71
  rules: {
74
- ...config.rules,
75
- "jsonc/sort-keys": "error"
72
+ "import/no-default-export": "off"
76
73
  },
77
- files: [...config.files ?? [], "**/*.code-workspace"],
78
- ignores: [
79
- ...config.ignores ?? [],
80
- /**
81
- * Lint `package.json` files with `eslint-plugin-package-json` instead.
82
- */
83
- "**/package.json"
74
+ files: [
75
+ "**/*.config.*",
76
+ // Single file components
77
+ "**/*.vue",
78
+ "**/*.svelte"
84
79
  ]
85
- })).remove("antfu/sort/package-json").remove("antfu/sort/tsconfig-json").override("antfu/react/rules", (config) => ({
86
- ...config,
87
- plugins: {
88
- ...config.plugins,
89
- "react-compiler": reactCompilerPlugin
90
- },
91
- rules: {
92
- ...config.rules,
93
- "react-compiler/react-compiler": "error",
94
- /**
95
- * Not all destructuring assignments are more readable than their alternatives.
96
- */
97
- "react/prefer-destructuring-assignment": "off"
98
- }
99
- }));
80
+ });
81
+ if (typescriptEnabled) {
82
+ config = config.override("antfu/typescript/rules", (config2) => ({
83
+ ...config2,
84
+ rules: {
85
+ ...config2.rules,
86
+ "ts/array-type": ["error", { default: "generic" }],
87
+ /**
88
+ * Namespaces are useful for centralizing the management of types. Just avoid
89
+ * overusing them with runtime code.
90
+ *
91
+ * - References:
92
+ * - <https://x.com/mattpocockuk/status/1805606072167940167>
93
+ */
94
+ "ts/no-namespace": "off",
95
+ "ts/no-redeclare": "off",
96
+ /**
97
+ * Check for unused variables in TypeScript.
98
+ */
99
+ "ts/no-unused-vars": "off"
100
+ }
101
+ }));
102
+ }
103
+ if (jsoncEnabled) {
104
+ config = config.override("antfu/jsonc/rules", (config2) => ({
105
+ ...config2,
106
+ rules: {
107
+ ...config2.rules,
108
+ "jsonc/sort-keys": "error"
109
+ },
110
+ files: [...config2.files ?? [], "**/*.code-workspace"],
111
+ ignores: [
112
+ ...config2.ignores ?? [],
113
+ /**
114
+ * Lint `package.json` files with `eslint-plugin-package-json` instead.
115
+ */
116
+ "**/package.json"
117
+ ]
118
+ })).remove("antfu/sort/package-json").remove("antfu/sort/tsconfig-json");
119
+ }
120
+ if (reactEnabled) {
121
+ config = config.override("antfu/react/rules", (config2) => ({
122
+ ...config2,
123
+ plugins: {
124
+ ...config2.plugins,
125
+ "react-compiler": reactCompilerPlugin
126
+ },
127
+ rules: {
128
+ ...config2.rules,
129
+ "react-compiler/react-compiler": "error",
130
+ /**
131
+ * Not all destructuring assignments are more readable than their alternatives.
132
+ */
133
+ "react/prefer-destructuring-assignment": "off"
134
+ }
135
+ }));
136
+ }
137
+ if (storybookEnabled) {
138
+ config = config.override("storybook:csf:stories-rules", (config2) => ({
139
+ ...config2,
140
+ rules: {
141
+ ...config2.rules,
142
+ "import/no-default-export": "off"
143
+ }
144
+ }));
145
+ }
146
+ return config;
100
147
  };
101
148
  export { vdustr };
@@ -0,0 +1,3 @@
1
+ import { renameRules } from "@antfu/eslint-config";
2
+ declare function renameRulesInternal(rules: Parameters<typeof renameRules>[0]): Record<string, any>;
3
+ export { renameRulesInternal as renameRules };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renameRules = renameRulesInternal;
7
+ var _eslintConfig = require("@antfu/eslint-config");
8
+ function renameRulesInternal(rules) {
9
+ return (0, _eslintConfig.renameRules)(rules, _eslintConfig.defaultPluginRenaming);
10
+ }
package/dist/vdustr.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { Config } from "./types";
2
2
  import antfu from "@antfu/eslint-config";
3
3
  import { mdx } from "./configs/mdx";
4
- import "./eslint-typegen.d";
5
4
  type Options = NonNullable<Parameters<typeof antfu>[0]> & {
6
5
  mdx?: boolean | mdx.Options;
6
+ storybook?: boolean;
7
7
  };
8
8
  declare const vdustr: (options?: Options, ...userConfigs: Array<Config>) => import("eslint-flat-config-utils/index").FlatConfigComposer<import("@antfu/eslint-config").TypedFlatConfigItem, import("@antfu/eslint-config").ConfigNames>;
9
9
  export { vdustr };
package/dist/vdustr.js CHANGED
@@ -7,26 +7,31 @@ exports.vdustr = void 0;
7
7
  var _eslintConfig = _interopRequireDefault(require("@antfu/eslint-config"));
8
8
  var _recommended = _interopRequireDefault(require("eslint-plugin-package-json/configs/recommended"));
9
9
  var reactCompilerPlugin = _interopRequireWildcard(require("eslint-plugin-react-compiler"));
10
+ var _localPkg = require("local-pkg");
10
11
  var _mdx = require("./configs/mdx");
11
12
  var _prettier = require("./configs/prettier");
12
- require("./eslint-typegen.d");
13
+ var _storybook = require("./configs/storybook");
13
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
17
  const vdustr = (options, ...userConfigs) => {
17
- const mdxOptions = options?.mdx ?? true;
18
+ const typescriptEnabled = (0, _localPkg.isPackageExists)("typescript");
18
19
  const jsoncEnabled = Boolean(options?.jsonc ?? true);
20
+ const reactEnabled = Boolean(options?.react ?? false);
21
+ const storybookEnabled = Boolean(options?.storybook ?? false);
22
+ const mdxOptions = options?.mdx ?? true;
19
23
  const defaultConfigs = [...(!jsoncEnabled ? [] : [_recommended.default]), ...(!mdxOptions ? [] : (0, _mdx.mdx)({
20
24
  ...(typeof mdxOptions !== "object" ? null : mdxOptions)
21
- })), _prettier.prettier];
22
- return (0, _eslintConfig.default)({
25
+ })), ...(!storybookEnabled ? [] : _storybook.storybook), _prettier.prettier];
26
+ let config = (0, _eslintConfig.default)({
23
27
  // We use `prettier`.
24
28
  stylistic: false,
25
29
  ...options
26
- }, ...defaultConfigs, ...userConfigs).override("antfu/javascript/rules", config => ({
27
- ...config,
30
+ }, ...defaultConfigs, ...userConfigs);
31
+ config = config.override("antfu/javascript/rules", config2 => ({
32
+ ...config2,
28
33
  rules: {
29
- ...config.rules,
34
+ ...config2.rules,
30
35
  /**
31
36
  * Some callbacks are purposefully named to make the code self-documenting.
32
37
  */
@@ -41,62 +46,100 @@ const vdustr = (options, ...userConfigs) => {
41
46
  "unused-imports/no-unused-vars-ts": "off",
42
47
  "unused-imports/no-unused-imports": "off"
43
48
  }
44
- })).override("antfu/imports/rules", config => ({
45
- ...config,
49
+ })).override("antfu/imports/rules", config2 => ({
50
+ ...config2,
46
51
  rules: {
47
- ...config.rules,
52
+ ...config2.rules,
48
53
  /**
49
54
  * Forbid `import {} from "module"`.
50
55
  */
51
- "import/no-empty-named-blocks": "error"
52
- }
53
- })).override("antfu/typescript/rules", config => ({
54
- ...config,
55
- rules: {
56
- ...config.rules,
57
- "ts/array-type": ["error", {
58
- default: "generic"
59
- }],
56
+ "import/no-empty-named-blocks": "error",
60
57
  /**
61
- * Namespaces are useful for centralizing the management of types. Just avoid
62
- * overusing them with runtime code.
63
- *
64
- * - References:
65
- * - <https://x.com/mattpocockuk/status/1805606072167940167>
58
+ * Wildcard imports can prevent tree shaking and cause name conflicts.
59
+ * Consider using named imports instead.
66
60
  */
67
- "ts/no-namespace": "off",
68
- "ts/no-redeclare": "off",
61
+ "import/no-namespace": "error",
69
62
  /**
70
- * Check for unused variables in TypeScript.
63
+ * Enforcing named exports improves consistency, enhances auto-completion and refactoring, and avoids issues
64
+ * with default export renaming. Additionally, default exports might lead to different behavior when transformed
65
+ * to CJS.
71
66
  */
72
- "ts/no-unused-vars": "off"
67
+ "import/no-default-export": "error"
73
68
  }
74
- })).override("antfu/jsonc/rules", config => ({
75
- ...config,
69
+ })).insertAfter("antfu/imports/rules", {
70
+ name: "vdustr/allow-default-export",
76
71
  rules: {
77
- ...config.rules,
78
- "jsonc/sort-keys": "error"
72
+ "import/no-default-export": "off"
79
73
  },
80
- files: [...(config.files ?? []), "**/*.code-workspace"],
81
- ignores: [...(config.ignores ?? []),
82
- /**
83
- * Lint `package.json` files with `eslint-plugin-package-json` instead.
84
- */
85
- "**/package.json"]
86
- })).remove("antfu/sort/package-json").remove("antfu/sort/tsconfig-json").override("antfu/react/rules", config => ({
87
- ...config,
88
- plugins: {
89
- ...config.plugins,
90
- "react-compiler": reactCompilerPlugin
91
- },
92
- rules: {
93
- ...config.rules,
94
- "react-compiler/react-compiler": "error",
74
+ files: ["**/*.config.*",
75
+ // Single file components
76
+ "**/*.vue", "**/*.svelte"]
77
+ });
78
+ if (typescriptEnabled) {
79
+ config = config.override("antfu/typescript/rules", config2 => ({
80
+ ...config2,
81
+ rules: {
82
+ ...config2.rules,
83
+ "ts/array-type": ["error", {
84
+ default: "generic"
85
+ }],
86
+ /**
87
+ * Namespaces are useful for centralizing the management of types. Just avoid
88
+ * overusing them with runtime code.
89
+ *
90
+ * - References:
91
+ * - <https://x.com/mattpocockuk/status/1805606072167940167>
92
+ */
93
+ "ts/no-namespace": "off",
94
+ "ts/no-redeclare": "off",
95
+ /**
96
+ * Check for unused variables in TypeScript.
97
+ */
98
+ "ts/no-unused-vars": "off"
99
+ }
100
+ }));
101
+ }
102
+ if (jsoncEnabled) {
103
+ config = config.override("antfu/jsonc/rules", config2 => ({
104
+ ...config2,
105
+ rules: {
106
+ ...config2.rules,
107
+ "jsonc/sort-keys": "error"
108
+ },
109
+ files: [...(config2.files ?? []), "**/*.code-workspace"],
110
+ ignores: [...(config2.ignores ?? []),
95
111
  /**
96
- * Not all destructuring assignments are more readable than their alternatives.
112
+ * Lint `package.json` files with `eslint-plugin-package-json` instead.
97
113
  */
98
- "react/prefer-destructuring-assignment": "off"
99
- }
100
- }));
114
+ "**/package.json"]
115
+ })).remove("antfu/sort/package-json").remove("antfu/sort/tsconfig-json");
116
+ }
117
+ if (reactEnabled) {
118
+ config = config.override("antfu/react/rules", config2 => ({
119
+ ...config2,
120
+ plugins: {
121
+ ...config2.plugins,
122
+ "react-compiler": reactCompilerPlugin
123
+ },
124
+ rules: {
125
+ ...config2.rules,
126
+ "react-compiler/react-compiler": "error",
127
+ /**
128
+ * Not all destructuring assignments are more readable than their alternatives.
129
+ */
130
+ "react/prefer-destructuring-assignment": "off"
131
+ }
132
+ }));
133
+ }
134
+ if (storybookEnabled) {
135
+ config = config.override("storybook:csf:stories-rules", config2 => ({
136
+ ...config2,
137
+ rules: {
138
+ ...config2.rules,
139
+ "import/no-default-export": "off"
140
+ }
141
+ }));
142
+ }
143
+ return config;
101
144
  };
102
145
  exports.vdustr = vdustr;
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@vp-tw/eslint-config",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "ViPro's ESLint configuration",
5
+ "homepage": "https://github.com/vdustr/eslint-config",
6
+ "author": {
7
+ "name": "ViPro",
8
+ "url": "https://vdustr.dev"
9
+ },
5
10
  "exports": {
6
11
  ".": {
7
12
  "import": {
@@ -41,8 +46,9 @@
41
46
  "eslint-flat-config-utils": "^2.0.0",
42
47
  "eslint-plugin-mdx": "^3.1.5",
43
48
  "eslint-plugin-package-json": "^0.21.1",
44
- "eslint-plugin-react": "^7.37.4",
45
- "eslint-plugin-react-compiler": "^19.0.0-beta-27714ef-20250124"
49
+ "eslint-plugin-react-compiler": "^19.0.0-beta-27714ef-20250124",
50
+ "eslint-plugin-storybook": "^0.11.2",
51
+ "local-pkg": "^1.0.0"
46
52
  },
47
53
  "devDependencies": {
48
54
  "eslint-typegen": "^1.0.0",
@@ -53,9 +59,7 @@
53
59
  },
54
60
  "scripts": {
55
61
  "build": "unbuild",
56
- "copy": "run-p copy:*",
57
- "copy:license": "fse copy ../../LICENSE LICENSE",
58
- "copy:readme": "fse copy ../../README.md README.md",
62
+ "copy": "tsx scripts/copy",
59
63
  "typegen": "tsx scripts/typegen.ts"
60
64
  }
61
65
  }
@@ -0,0 +1,23 @@
1
+ import fs from "fs-extra";
2
+ import path from "pathe";
3
+ import { packageDirectory } from "pkg-dir";
4
+
5
+ const filesToCopy = ["README.md", "LICENSE"] satisfies Array<string>;
6
+
7
+ (async () => {
8
+ const pkgDir = await packageDirectory();
9
+ if (!pkgDir) {
10
+ throw new Error("Could not find package directory");
11
+ }
12
+ const rootPkgDir = await packageDirectory({
13
+ cwd: path.resolve(pkgDir, ".."),
14
+ });
15
+
16
+ if (!rootPkgDir) {
17
+ throw new Error("Could not find root package directory");
18
+ }
19
+
20
+ for (const file of filesToCopy) {
21
+ await fs.copyFile(path.join(rootPkgDir, file), path.join(pkgDir, file));
22
+ }
23
+ })();
@@ -1,6 +1,8 @@
1
1
  import type { ESLint } from "eslint";
2
- import { rules } from "eslint-plugin-mdx/lib/rules";
3
- import reactCompiler from "eslint-plugin-react-compiler";
2
+ import { rules as mdxRules } from "eslint-plugin-mdx/lib/rules";
3
+ // eslint-disable-next-line import/no-namespace -- This is a cjs module.
4
+ import * as reactCompiler from "eslint-plugin-react-compiler";
5
+ import storybook from "eslint-plugin-storybook";
4
6
  import { pluginsToRulesDTS } from "eslint-typegen/core";
5
7
  import fs from "fs-extra";
6
8
  import path from "pathe";
@@ -25,9 +27,18 @@ import { packageDirectory } from "pkg-dir";
25
27
  ...definePlugins({ "react-compiler": reactCompiler }),
26
28
  ...definePlugins({
27
29
  mdx: {
28
- rules,
30
+ rules: mdxRules,
29
31
  },
30
32
  }),
33
+ ...definePlugins({
34
+ ...Object.fromEntries(
35
+ storybook.configs["flat/csf-strict"].flatMap((config) =>
36
+ !("plugins" in config) || !config.plugins
37
+ ? []
38
+ : Object.entries(config.plugins),
39
+ ),
40
+ ),
41
+ }),
31
42
  };
32
43
 
33
44
  await fs.writeFile(targetPath, await pluginsToRulesDTS(plugins));
@@ -1,14 +1,15 @@
1
1
  import type { TypedFlatConfigItem } from "@antfu/eslint-config";
2
2
  import type { DistributiveOmit } from "@mui/types";
3
- import type { Config } from "../types";
4
3
 
4
+ // eslint-disable-next-line import/no-namespace -- `mdx` exports the plugin as a namespace.
5
5
  import * as mdxPlugin from "eslint-plugin-mdx";
6
+ import { renameRules } from "../utils/renameRules";
6
7
 
7
8
  namespace mdx {
8
9
  export interface Options
9
10
  extends DistributiveOmit<TypedFlatConfigItem, "processor"> {
10
11
  processorOptions?: mdxPlugin.ProcessorOptions;
11
- flatCodeBlocks?: boolean | Config;
12
+ flatCodeBlocks?: boolean | TypedFlatConfigItem;
12
13
  }
13
14
  }
14
15
 
@@ -16,12 +17,20 @@ const mdx = ({
16
17
  flatCodeBlocks = true,
17
18
  processorOptions,
18
19
  ...options
19
- }: mdx.Options = {}) =>
20
- [
20
+ }: mdx.Options = {}) => {
21
+ const flatCodeBlocksOptions: TypedFlatConfigItem =
22
+ typeof flatCodeBlocks !== "object" ? {} : flatCodeBlocks;
23
+ const configs: Array<TypedFlatConfigItem> = [
21
24
  {
22
25
  name: "vdustr/mdx",
23
26
  ...mdxPlugin.flat,
24
27
  ...options,
28
+ rules: {
29
+ ...renameRules({
30
+ ...mdxPlugin.flat.rules,
31
+ }),
32
+ ...options.rules,
33
+ },
25
34
  processor: mdxPlugin.createRemarkProcessor({
26
35
  lintCodeBlocks: Boolean(flatCodeBlocks),
27
36
  ...processorOptions,
@@ -36,9 +45,17 @@ const mdx = ({
36
45
  {
37
46
  name: "vdustr/mdx/flat-code-blocks",
38
47
  ...mdxPlugin.flatCodeBlocks,
39
- ...(typeof flatCodeBlocks !== "object" ? null : flatCodeBlocks),
40
- } satisfies Config,
48
+ ...flatCodeBlocksOptions,
49
+ rules: {
50
+ ...renameRules({
51
+ ...mdxPlugin.flatCodeBlocks.rules,
52
+ }),
53
+ ...flatCodeBlocksOptions.rules,
54
+ },
55
+ } satisfies TypedFlatConfigItem,
41
56
  ]),
42
- ] satisfies Array<Config>;
57
+ ];
58
+ return configs;
59
+ };
43
60
 
44
61
  export { mdx };
@@ -1,12 +1,12 @@
1
- import type { Config } from "../types";
2
- import { defaultPluginRenaming, renameRules } from "@antfu/eslint-config";
1
+ import type { TypedFlatConfigItem } from "@antfu/eslint-config";
3
2
 
4
3
  import eslintConfigPrettier from "eslint-config-prettier";
4
+ import { renameRules } from "../utils/renameRules";
5
5
 
6
- const prettier: Config = {
6
+ const prettier = {
7
7
  name: "vdustr/prettier",
8
8
  ...eslintConfigPrettier,
9
- rules: renameRules(eslintConfigPrettier.rules, defaultPluginRenaming),
10
- };
9
+ rules: renameRules(eslintConfigPrettier.rules),
10
+ } satisfies TypedFlatConfigItem;
11
11
 
12
12
  export { prettier };
@@ -0,0 +1,20 @@
1
+ import type { TypedFlatConfigItem } from "@antfu/eslint-config";
2
+ import storybookPlugin from "eslint-plugin-storybook";
3
+ import { renameRules } from "../utils/renameRules";
4
+
5
+ const storybook = storybookPlugin.configs["flat/csf-strict"].map((config) => {
6
+ const allConfig = config as TypedFlatConfigItem;
7
+ const { rules, files, plugins, ...rest } = allConfig;
8
+ return {
9
+ ...rest,
10
+ ...(!rules
11
+ ? null
12
+ : {
13
+ rules: renameRules(rules),
14
+ }),
15
+ ...(!files ? null : { files }),
16
+ ...(!plugins ? null : { plugins }),
17
+ } satisfies TypedFlatConfigItem;
18
+ });
19
+
20
+ export { storybook };