@vp-tw/eslint-config 0.0.7 → 0.0.9

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.
Files changed (39) hide show
  1. package/README.md +2 -2
  2. package/dist/configs/mdx.d.ts +2 -3
  3. package/dist/configs/mdx.js +4 -4
  4. package/dist/configs/prettier.d.ts +2 -1
  5. package/dist/configs/prettier.js +10 -5
  6. package/dist/configs/storybook.d.ts +2 -1
  7. package/dist/configs/storybook.js +27 -23
  8. package/dist/eslint-typegen.js +2 -0
  9. package/dist/esm/configs/mdx.d.ts +2 -3
  10. package/dist/esm/configs/mdx.mjs +4 -2
  11. package/dist/esm/configs/prettier.d.ts +2 -1
  12. package/dist/esm/configs/prettier.mjs +8 -4
  13. package/dist/esm/configs/storybook.d.ts +2 -1
  14. package/dist/esm/configs/storybook.mjs +19 -13
  15. package/dist/esm/eslint-typegen.mjs +1 -0
  16. package/dist/esm/lib/eslint-plugin-react-compiler.d.ts +2 -2
  17. package/dist/esm/lib/eslint-plugin-react-compiler.mjs +12 -3
  18. package/dist/esm/vdustr.d.ts +1 -0
  19. package/dist/esm/vdustr.mjs +35 -28
  20. package/dist/lib/eslint-plugin-react-compiler.d.ts +2 -2
  21. package/dist/lib/eslint-plugin-react-compiler.js +7 -4
  22. package/dist/vdustr.d.ts +1 -0
  23. package/dist/vdustr.js +31 -28
  24. package/package.json +8 -8
  25. package/build.config.ts +0 -31
  26. package/global.d.ts +0 -1
  27. package/scripts/copy.ts +0 -23
  28. package/scripts/typegen.ts +0 -45
  29. package/src/configs/mdx.ts +0 -61
  30. package/src/configs/prettier.ts +0 -12
  31. package/src/configs/storybook.ts +0 -20
  32. package/src/eslint-typegen.d.ts +0 -106
  33. package/src/index.ts +0 -1
  34. package/src/lib/eslint-plugin-react-compiler.ts +0 -16
  35. package/src/tsconfig.json +0 -3
  36. package/src/types.ts +0 -5
  37. package/src/utils/renameRules.ts +0 -7
  38. package/src/vdustr.ts +0 -211
  39. package/tsconfig.json +0 -4
package/README.md CHANGED
@@ -5,7 +5,7 @@ ViPro's ESLint configuration.
5
5
  - Built on top of [antfu/eslint-config](https://github.com/antfu/eslint-config).
6
6
  - Integrates with:
7
7
  - [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier)
8
- - [eslint-mdx](https://github.com/mdx-js/eslint-mdx).
8
+ - [eslint-mdx](https://github.com/mdx-js/eslint-mdx)
9
9
  - [eslint-plugin-storybook](https://github.com/storybookjs/eslint-plugin-storybook)
10
10
  - [eslint-plugin-react-compiler](https://www.npmjs.com/package/eslint-plugin-react-compiler)
11
11
  - Fine-tuned to provide an opinionated, optimal DX. Please copy the VSCode settings from [eslint-config.code-workspace](https://github.com/VdustR/eslint-config/blob/main/eslint-config.code-workspace).
@@ -15,7 +15,7 @@ Check [here](https://vdustr.dev/eslint-config) to preview the ESLint inspection.
15
15
  ## Installation
16
16
 
17
17
  ```bash
18
- pnpm i -D @vp-tw/eslint-config
18
+ pnpm i -D eslint @antfu/eslint-config @vp-tw/eslint-config
19
19
  ```
20
20
 
21
21
  ## Usage
@@ -1,11 +1,10 @@
1
1
  import type { TypedFlatConfigItem } from "@antfu/eslint-config";
2
2
  import type { DistributiveOmit } from "@mui/types";
3
- import * as mdxPlugin from "eslint-plugin-mdx";
4
3
  declare namespace mdx {
5
4
  interface Options extends DistributiveOmit<TypedFlatConfigItem, "processor"> {
6
- processorOptions?: mdxPlugin.ProcessorOptions;
5
+ processorOptions?: import("eslint-plugin-mdx").ProcessorOptions;
7
6
  flatCodeBlocks?: boolean | TypedFlatConfigItem;
8
7
  }
9
8
  }
10
- declare const mdx: ({ flatCodeBlocks, processorOptions, ...options }?: mdx.Options) => TypedFlatConfigItem[];
9
+ declare const mdx: ({ flatCodeBlocks, processorOptions, ...options }?: mdx.Options) => Promise<Array<TypedFlatConfigItem>>;
11
10
  export { mdx };
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.mdx = void 0;
7
- var mdxPlugin = _interopRequireWildcard(require("eslint-plugin-mdx"));
7
+ var _eslintConfig = require("@antfu/eslint-config");
8
8
  var _renameRules = require("../utils/renameRules");
9
- 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); }
10
- 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; }
11
- const mdx = ({
9
+ const mdx = async ({
12
10
  flatCodeBlocks = true,
13
11
  processorOptions,
14
12
  ...options
15
13
  } = {}) => {
14
+ await (0, _eslintConfig.ensurePackages)(["eslint-plugin-mdx"]);
15
+ const mdxPlugin = await (0, _eslintConfig.interopDefault)(await Promise.resolve().then(() => require("eslint-plugin-mdx")));
16
16
  const flatCodeBlocksOptions = typeof flatCodeBlocks !== "object" ? {} : flatCodeBlocks;
17
17
  const configs = [{
18
18
  name: "vdustr/mdx",
@@ -1,2 +1,3 @@
1
- declare const prettier: any;
1
+ import type { TypedFlatConfigItem } from "@antfu/eslint-config";
2
+ declare const prettier: () => Promise<TypedFlatConfigItem>;
2
3
  export { prettier };
@@ -4,11 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.prettier = void 0;
7
+ var _eslintConfig = require("@antfu/eslint-config");
7
8
  var _eslintConfigPrettier = _interopRequireDefault(require("eslint-config-prettier"));
8
9
  var _renameRules = require("../utils/renameRules");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- const prettier = exports.prettier = {
11
- name: "vdustr/prettier",
12
- ..._eslintConfigPrettier.default,
13
- rules: (0, _renameRules.renameRules)(_eslintConfigPrettier.default.rules)
14
- };
11
+ const prettier = async () => {
12
+ await (0, _eslintConfig.ensurePackages)(["eslint-config-prettier"]);
13
+ return {
14
+ name: "vdustr/prettier",
15
+ ..._eslintConfigPrettier.default,
16
+ rules: (0, _renameRules.renameRules)(_eslintConfigPrettier.default.rules)
17
+ };
18
+ };
19
+ exports.prettier = prettier;
@@ -1,2 +1,3 @@
1
- declare const storybook: any;
1
+ import type { TypedFlatConfigItem } from "@antfu/eslint-config";
2
+ declare const storybook: () => Promise<Array<TypedFlatConfigItem>>;
2
3
  export { storybook };
@@ -4,27 +4,31 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.storybook = void 0;
7
- var _eslintPluginStorybook = _interopRequireDefault(require("eslint-plugin-storybook"));
7
+ var _eslintConfig = require("@antfu/eslint-config");
8
8
  var _renameRules = require("../utils/renameRules");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- const storybook = exports.storybook = _eslintPluginStorybook.default.configs["flat/csf-strict"].map(config => {
11
- const allConfig = config;
12
- const {
13
- rules,
14
- files,
15
- plugins,
16
- ...rest
17
- } = allConfig;
18
- return {
19
- ...rest,
20
- ...(!rules ? null : {
21
- rules: (0, _renameRules.renameRules)(rules)
22
- }),
23
- ...(!files ? null : {
24
- files
25
- }),
26
- ...(!plugins ? null : {
27
- plugins
28
- })
29
- };
30
- });
9
+ const storybook = async () => {
10
+ await (0, _eslintConfig.ensurePackages)(["eslint-plugin-storybook"]);
11
+ const storybookPlugin = await (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("eslint-plugin-storybook")));
12
+ return storybookPlugin.configs["flat/csf-strict"].map(config => {
13
+ const allConfig = config;
14
+ const {
15
+ rules,
16
+ files,
17
+ plugins,
18
+ ...rest
19
+ } = allConfig;
20
+ return {
21
+ ...rest,
22
+ ...(!rules ? null : {
23
+ rules: (0, _renameRules.renameRules)(rules)
24
+ }),
25
+ ...(!files ? null : {
26
+ files
27
+ }),
28
+ ...(!plugins ? null : {
29
+ plugins
30
+ })
31
+ };
32
+ });
33
+ };
34
+ exports.storybook = storybook;
@@ -0,0 +1,2 @@
1
+ // This is a placeholder for `eslint-typegen.d.ts`.
2
+ "use strict";
@@ -1,11 +1,10 @@
1
1
  import type { TypedFlatConfigItem } from "@antfu/eslint-config";
2
2
  import type { DistributiveOmit } from "@mui/types";
3
- import * as mdxPlugin from "eslint-plugin-mdx";
4
3
  declare namespace mdx {
5
4
  interface Options extends DistributiveOmit<TypedFlatConfigItem, "processor"> {
6
- processorOptions?: mdxPlugin.ProcessorOptions;
5
+ processorOptions?: import("eslint-plugin-mdx").ProcessorOptions;
7
6
  flatCodeBlocks?: boolean | TypedFlatConfigItem;
8
7
  }
9
8
  }
10
- declare const mdx: ({ flatCodeBlocks, processorOptions, ...options }?: mdx.Options) => TypedFlatConfigItem[];
9
+ declare const mdx: ({ flatCodeBlocks, processorOptions, ...options }?: mdx.Options) => Promise<Array<TypedFlatConfigItem>>;
11
10
  export { mdx };
@@ -1,10 +1,12 @@
1
- import * as mdxPlugin from "eslint-plugin-mdx";
1
+ import { ensurePackages, interopDefault } from "@antfu/eslint-config";
2
2
  import { renameRules } from "../utils/renameRules.mjs";
3
- const mdx = ({
3
+ const mdx = async ({
4
4
  flatCodeBlocks = true,
5
5
  processorOptions,
6
6
  ...options
7
7
  } = {}) => {
8
+ await ensurePackages(["eslint-plugin-mdx"]);
9
+ const mdxPlugin = await interopDefault(await import("eslint-plugin-mdx"));
8
10
  const flatCodeBlocksOptions = typeof flatCodeBlocks !== "object" ? {} : flatCodeBlocks;
9
11
  const configs = [
10
12
  {
@@ -1,2 +1,3 @@
1
- declare const prettier: any;
1
+ import type { TypedFlatConfigItem } from "@antfu/eslint-config";
2
+ declare const prettier: () => Promise<TypedFlatConfigItem>;
2
3
  export { prettier };
@@ -1,8 +1,12 @@
1
+ import { ensurePackages } from "@antfu/eslint-config";
1
2
  import eslintConfigPrettier from "eslint-config-prettier";
2
3
  import { renameRules } from "../utils/renameRules.mjs";
3
- const prettier = {
4
- name: "vdustr/prettier",
5
- ...eslintConfigPrettier,
6
- rules: renameRules(eslintConfigPrettier.rules)
4
+ const prettier = async () => {
5
+ await ensurePackages(["eslint-config-prettier"]);
6
+ return {
7
+ name: "vdustr/prettier",
8
+ ...eslintConfigPrettier,
9
+ rules: renameRules(eslintConfigPrettier.rules)
10
+ };
7
11
  };
8
12
  export { prettier };
@@ -1,2 +1,3 @@
1
- declare const storybook: any;
1
+ import type { TypedFlatConfigItem } from "@antfu/eslint-config";
2
+ declare const storybook: () => Promise<Array<TypedFlatConfigItem>>;
2
3
  export { storybook };
@@ -1,15 +1,21 @@
1
- import storybookPlugin from "eslint-plugin-storybook";
1
+ import { ensurePackages, interopDefault } from "@antfu/eslint-config";
2
2
  import { renameRules } from "../utils/renameRules.mjs";
3
- const storybook = storybookPlugin.configs["flat/csf-strict"].map((config) => {
4
- const allConfig = config;
5
- const { rules, files, plugins, ...rest } = allConfig;
6
- return {
7
- ...rest,
8
- ...!rules ? null : {
9
- rules: renameRules(rules)
10
- },
11
- ...!files ? null : { files },
12
- ...!plugins ? null : { plugins }
13
- };
14
- });
3
+ const storybook = async () => {
4
+ await ensurePackages(["eslint-plugin-storybook"]);
5
+ const storybookPlugin = await interopDefault(
6
+ import("eslint-plugin-storybook")
7
+ );
8
+ return storybookPlugin.configs["flat/csf-strict"].map((config) => {
9
+ const allConfig = config;
10
+ const { rules, files, plugins, ...rest } = allConfig;
11
+ return {
12
+ ...rest,
13
+ ...!rules ? null : {
14
+ rules: renameRules(rules)
15
+ },
16
+ ...!files ? null : { files },
17
+ ...!plugins ? null : { plugins }
18
+ };
19
+ });
20
+ };
15
21
  export { storybook };
@@ -0,0 +1 @@
1
+ // This is a placeholder for `eslint-typegen.d.ts`.
@@ -5,5 +5,5 @@ interface ReactCompiler extends ESLint.Plugin {
5
5
  recommended: Linter.LegacyConfig;
6
6
  };
7
7
  }
8
- declare const reactCompilerInternal: ReactCompiler;
9
- export { reactCompilerInternal as reactCompiler };
8
+ declare const reactCompiler: () => Promise<ReactCompiler>;
9
+ export { reactCompiler };
@@ -1,3 +1,12 @@
1
- import * as reactCompiler from "eslint-plugin-react-compiler";
2
- const reactCompilerInternal = reactCompiler.default ?? reactCompiler;
3
- export { reactCompilerInternal as reactCompiler };
1
+ import { ensurePackages, interopDefault } from "@antfu/eslint-config";
2
+ const reactCompiler = async () => {
3
+ await ensurePackages(["eslint-plugin-react-compiler"]);
4
+ const reactCompiler2 = await interopDefault(
5
+ import(
6
+ // @ts-expect-error -- Untyped library.
7
+ "eslint-plugin-react-compiler"
8
+ )
9
+ );
10
+ return reactCompiler2;
11
+ };
12
+ export { reactCompiler };
@@ -1,6 +1,7 @@
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";
4
5
  type Options = Omit<NonNullable<Parameters<typeof antfu>[0]>, "stylistic"> & {
5
6
  mdx?: boolean | mdx.Options;
6
7
  storybook?: boolean;
@@ -1,10 +1,17 @@
1
- import antfu from "@antfu/eslint-config";
1
+ import antfu, {
2
+ GLOB_ASTRO_TS,
3
+ GLOB_JS,
4
+ GLOB_JSX,
5
+ GLOB_TS,
6
+ GLOB_TSX
7
+ } from "@antfu/eslint-config";
2
8
  import packageJson from "eslint-plugin-package-json/configs/recommended";
3
9
  import { isPackageExists } from "local-pkg";
4
10
  import { mdx } from "./configs/mdx.mjs";
5
11
  import { prettier } from "./configs/prettier.mjs";
6
12
  import { storybook } from "./configs/storybook.mjs";
7
13
  import { reactCompiler } from "./lib/eslint-plugin-react-compiler.mjs";
14
+ import "./eslint-typegen";
8
15
  const vdustr = (options, ...userConfigs) => {
9
16
  const typescriptEnabled = isPackageExists("typescript");
10
17
  const jsoncEnabled = Boolean(options?.jsonc ?? true);
@@ -58,25 +65,23 @@ const vdustr = (options, ...userConfigs) => {
58
65
  * Wildcard imports can prevent tree shaking and cause name conflicts.
59
66
  * Consider using named imports instead.
60
67
  */
61
- "import/no-namespace": "error",
68
+ "import/no-namespace": "error"
69
+ }
70
+ })).insertAfter("antfu/imports/rules", {
71
+ name: "vdustr/no-default-export",
72
+ rules: {
62
73
  /**
63
74
  * Enforcing named exports improves consistency, enhances auto-completion and refactoring, and avoids issues
64
75
  * with default export renaming. Additionally, default exports might lead to different behavior when transformed
65
76
  * to CJS.
66
77
  */
67
78
  "import/no-default-export": "error"
68
- }
69
- })).insertAfter("antfu/imports/rules", {
70
- name: "vdustr/allow-default-export",
71
- rules: {
72
- "import/no-default-export": "off"
73
79
  },
74
- files: [
80
+ files: [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
81
+ ignores: [
75
82
  // Configuration files
76
83
  "**/*.config.*",
77
- // Single file components
78
- "**/*.vue",
79
- "**/*.svelte"
84
+ GLOB_ASTRO_TS
80
85
  ]
81
86
  });
82
87
  if (typescriptEnabled) {
@@ -119,24 +124,26 @@ const vdustr = (options, ...userConfigs) => {
119
124
  })).insertAfter("antfu/jsonc/rules", packageJson).remove("antfu/sort/package-json").remove("antfu/sort/tsconfig-json");
120
125
  }
121
126
  if (reactEnabled) {
122
- config = config.override("antfu/react/rules", (config2) => ({
123
- ...config2,
124
- plugins: {
125
- ...config2.plugins,
126
- "react-compiler": reactCompiler
127
- },
128
- rules: {
129
- ...config2.rules,
130
- "react-compiler/react-compiler": "error",
131
- /**
132
- * Not all destructuring assignments are more readable than their alternatives.
133
- */
134
- "react/prefer-destructuring-assignment": "off"
135
- }
136
- }));
127
+ config = config.override("antfu/react/rules", async (config2) => {
128
+ return {
129
+ ...config2,
130
+ plugins: {
131
+ ...config2.plugins,
132
+ "react-compiler": await reactCompiler()
133
+ },
134
+ rules: {
135
+ ...config2.rules,
136
+ "react-compiler/react-compiler": "error",
137
+ /**
138
+ * Not all destructuring assignments are more readable than their alternatives.
139
+ */
140
+ "react/prefer-destructuring-assignment": "off"
141
+ }
142
+ };
143
+ });
137
144
  }
138
145
  if (storybookEnabled) {
139
- config = config.append(storybook).override("storybook:csf:stories-rules", (config2) => ({
146
+ config = config.append(storybook()).override("storybook:csf:stories-rules", (config2) => ({
140
147
  ...config2,
141
148
  rules: {
142
149
  ...config2.rules,
@@ -158,7 +165,7 @@ const vdustr = (options, ...userConfigs) => {
158
165
  })
159
166
  );
160
167
  }
161
- config = config.append(prettier);
168
+ config = config.append(prettier());
162
169
  return config;
163
170
  };
164
171
  export { vdustr };
@@ -5,5 +5,5 @@ interface ReactCompiler extends ESLint.Plugin {
5
5
  recommended: Linter.LegacyConfig;
6
6
  };
7
7
  }
8
- declare const reactCompilerInternal: ReactCompiler;
9
- export { reactCompilerInternal as reactCompiler };
8
+ declare const reactCompiler: () => Promise<ReactCompiler>;
9
+ export { reactCompiler };
@@ -4,7 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.reactCompiler = void 0;
7
- var reactCompiler = _interopRequireWildcard(require("eslint-plugin-react-compiler"));
8
- 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); }
9
- 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; }
10
- const reactCompilerInternal = exports.reactCompiler = reactCompiler.default ?? reactCompiler;
7
+ var _eslintConfig = require("@antfu/eslint-config");
8
+ const reactCompiler = async () => {
9
+ await (0, _eslintConfig.ensurePackages)(["eslint-plugin-react-compiler"]);
10
+ const reactCompiler2 = await (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("eslint-plugin-react-compiler")));
11
+ return reactCompiler2;
12
+ };
13
+ exports.reactCompiler = reactCompiler;
package/dist/vdustr.d.ts CHANGED
@@ -1,6 +1,7 @@
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";
4
5
  type Options = Omit<NonNullable<Parameters<typeof antfu>[0]>, "stylistic"> & {
5
6
  mdx?: boolean | mdx.Options;
6
7
  storybook?: boolean;
package/dist/vdustr.js CHANGED
@@ -4,14 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.vdustr = void 0;
7
- var _eslintConfig = _interopRequireDefault(require("@antfu/eslint-config"));
7
+ var _eslintConfig = _interopRequireWildcard(require("@antfu/eslint-config"));
8
8
  var _recommended = _interopRequireDefault(require("eslint-plugin-package-json/configs/recommended"));
9
9
  var _localPkg = require("local-pkg");
10
10
  var _mdx = require("./configs/mdx");
11
11
  var _prettier = require("./configs/prettier");
12
12
  var _storybook = require("./configs/storybook");
13
13
  var _eslintPluginReactCompiler = require("./lib/eslint-plugin-react-compiler");
14
+ require("./eslint-typegen");
14
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
+ 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); }
17
+ 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
18
  const vdustr = (options, ...userConfigs) => {
16
19
  const typescriptEnabled = (0, _localPkg.isPackageExists)("typescript");
17
20
  const jsoncEnabled = Boolean(options?.jsonc ?? true);
@@ -60,24 +63,22 @@ const vdustr = (options, ...userConfigs) => {
60
63
  * Wildcard imports can prevent tree shaking and cause name conflicts.
61
64
  * Consider using named imports instead.
62
65
  */
63
- "import/no-namespace": "error",
66
+ "import/no-namespace": "error"
67
+ }
68
+ })).insertAfter("antfu/imports/rules", {
69
+ name: "vdustr/no-default-export",
70
+ rules: {
64
71
  /**
65
72
  * Enforcing named exports improves consistency, enhances auto-completion and refactoring, and avoids issues
66
73
  * with default export renaming. Additionally, default exports might lead to different behavior when transformed
67
74
  * to CJS.
68
75
  */
69
76
  "import/no-default-export": "error"
70
- }
71
- })).insertAfter("antfu/imports/rules", {
72
- name: "vdustr/allow-default-export",
73
- rules: {
74
- "import/no-default-export": "off"
75
77
  },
76
- files: [
78
+ files: [_eslintConfig.GLOB_JS, _eslintConfig.GLOB_JSX, _eslintConfig.GLOB_TS, _eslintConfig.GLOB_TSX],
79
+ ignores: [
77
80
  // Configuration files
78
- "**/*.config.*",
79
- // Single file components
80
- "**/*.vue", "**/*.svelte"]
81
+ "**/*.config.*", _eslintConfig.GLOB_ASTRO_TS]
81
82
  });
82
83
  if (typescriptEnabled) {
83
84
  config = config.override("antfu/typescript/rules", config2 => ({
@@ -119,24 +120,26 @@ const vdustr = (options, ...userConfigs) => {
119
120
  })).insertAfter("antfu/jsonc/rules", _recommended.default).remove("antfu/sort/package-json").remove("antfu/sort/tsconfig-json");
120
121
  }
121
122
  if (reactEnabled) {
122
- config = config.override("antfu/react/rules", config2 => ({
123
- ...config2,
124
- plugins: {
125
- ...config2.plugins,
126
- "react-compiler": _eslintPluginReactCompiler.reactCompiler
127
- },
128
- rules: {
129
- ...config2.rules,
130
- "react-compiler/react-compiler": "error",
131
- /**
132
- * Not all destructuring assignments are more readable than their alternatives.
133
- */
134
- "react/prefer-destructuring-assignment": "off"
135
- }
136
- }));
123
+ config = config.override("antfu/react/rules", async config2 => {
124
+ return {
125
+ ...config2,
126
+ plugins: {
127
+ ...config2.plugins,
128
+ "react-compiler": await (0, _eslintPluginReactCompiler.reactCompiler)()
129
+ },
130
+ rules: {
131
+ ...config2.rules,
132
+ "react-compiler/react-compiler": "error",
133
+ /**
134
+ * Not all destructuring assignments are more readable than their alternatives.
135
+ */
136
+ "react/prefer-destructuring-assignment": "off"
137
+ }
138
+ };
139
+ });
137
140
  }
138
141
  if (storybookEnabled) {
139
- config = config.append(_storybook.storybook).override("storybook:csf:stories-rules", config2 => ({
142
+ config = config.append((0, _storybook.storybook)()).override("storybook:csf:stories-rules", config2 => ({
140
143
  ...config2,
141
144
  rules: {
142
145
  ...config2.rules,
@@ -156,7 +159,7 @@ const vdustr = (options, ...userConfigs) => {
156
159
  }
157
160
  }));
158
161
  }
159
- config = config.append(_prettier.prettier);
162
+ config = config.append((0, _prettier.prettier)());
160
163
  return config;
161
164
  };
162
165
  exports.vdustr = vdustr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vp-tw/eslint-config",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "ViPro's ESLint configuration",
5
5
  "homepage": "https://github.com/vdustr/eslint-config",
6
6
  "author": {
@@ -35,25 +35,25 @@
35
35
  "main": "./dist/index.js",
36
36
  "module": "./dist/esm/index.mjs",
37
37
  "types": "./dist/index.d.ts",
38
+ "files": [
39
+ "dist"
40
+ ],
38
41
  "dependencies": {
39
- "@antfu/eslint-config": "^4.1.0",
40
- "@eslint-react/eslint-plugin": "^1.25.0",
41
- "@eslint/compat": "^1.2.5",
42
42
  "@mui/types": "^7.2.21",
43
43
  "@types/eslint-config-prettier": "^6.11.3",
44
- "@types/eslint__eslintrc": "^2.1.2",
45
44
  "eslint-config-prettier": "^10.0.1",
46
45
  "eslint-flat-config-utils": "^2.0.0",
47
- "eslint-plugin-mdx": "^3.1.5",
48
46
  "eslint-plugin-package-json": "^0.21.1",
49
- "eslint-plugin-react-compiler": "^19.0.0-beta-27714ef-20250124",
50
- "eslint-plugin-storybook": "^0.11.2",
51
47
  "local-pkg": "^1.0.0"
52
48
  },
53
49
  "devDependencies": {
50
+ "@antfu/eslint-config": "^4.1.0",
54
51
  "eslint-typegen": "^1.0.0",
55
52
  "unbuild": "^3.3.1"
56
53
  },
54
+ "peerDependencies": {
55
+ "@antfu/eslint-config": "^4.1.0"
56
+ },
57
57
  "publishConfig": {
58
58
  "access": "public"
59
59
  },
package/build.config.ts DELETED
@@ -1,31 +0,0 @@
1
- import type { BuildConfig } from "unbuild";
2
- import { defineBuildConfig } from "unbuild";
3
-
4
- const basicEntry = {
5
- builder: "mkdist",
6
- input: "./src/",
7
- pattern: [
8
- "**/*.ts",
9
- "!**/*.test.ts",
10
- "!**/*.test-d.ts",
11
- "!**/spec/**",
12
- "!**/test/**",
13
- "!**/node_modules/**",
14
- ],
15
- } satisfies NonNullable<BuildConfig["entries"]>[number];
16
-
17
- export default defineBuildConfig({
18
- entries: [
19
- {
20
- ...basicEntry,
21
- outDir: "./dist",
22
- format: "cjs",
23
- },
24
- {
25
- ...basicEntry,
26
- outDir: "./dist/esm",
27
- format: "esm",
28
- },
29
- ],
30
- declaration: true,
31
- });
package/global.d.ts DELETED
@@ -1 +0,0 @@
1
- /// <reference types="@total-typescript/ts-reset" />
package/scripts/copy.ts DELETED
@@ -1,23 +0,0 @@
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,45 +0,0 @@
1
- import type { ESLint } from "eslint";
2
- import { rules as mdxRules } from "eslint-plugin-mdx/lib/rules";
3
-
4
- import storybook from "eslint-plugin-storybook";
5
- import { pluginsToRulesDTS } from "eslint-typegen/core";
6
- import fs from "fs-extra";
7
- import path from "pathe";
8
- import { packageDirectory } from "pkg-dir";
9
- import { reactCompiler } from "../src/lib/eslint-plugin-react-compiler";
10
-
11
- (async () => {
12
- const pkgDir = await packageDirectory();
13
- if (!pkgDir) {
14
- throw new Error("Could not find package directory");
15
- }
16
- const distDir = path.join(pkgDir, "src");
17
- const targetPath = path.join(distDir, "eslint-typegen.d.ts");
18
- await fs.ensureDir(path.dirname(targetPath));
19
-
20
- type Plugins = Record<string, ESLint.Plugin>;
21
-
22
- function definePlugins<T extends Plugins>(plugins: T): T {
23
- return plugins;
24
- }
25
-
26
- const plugins: Plugins = {
27
- ...definePlugins({ "react-compiler": reactCompiler }),
28
- ...definePlugins({
29
- mdx: {
30
- rules: mdxRules,
31
- },
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
- }),
42
- };
43
-
44
- await fs.writeFile(targetPath, await pluginsToRulesDTS(plugins));
45
- })();
@@ -1,61 +0,0 @@
1
- import type { TypedFlatConfigItem } from "@antfu/eslint-config";
2
- import type { DistributiveOmit } from "@mui/types";
3
-
4
- // eslint-disable-next-line import/no-namespace -- `mdx` exports the plugin as a namespace.
5
- import * as mdxPlugin from "eslint-plugin-mdx";
6
- import { renameRules } from "../utils/renameRules";
7
-
8
- namespace mdx {
9
- export interface Options
10
- extends DistributiveOmit<TypedFlatConfigItem, "processor"> {
11
- processorOptions?: mdxPlugin.ProcessorOptions;
12
- flatCodeBlocks?: boolean | TypedFlatConfigItem;
13
- }
14
- }
15
-
16
- const mdx = ({
17
- flatCodeBlocks = true,
18
- processorOptions,
19
- ...options
20
- }: mdx.Options = {}) => {
21
- const flatCodeBlocksOptions: TypedFlatConfigItem =
22
- typeof flatCodeBlocks !== "object" ? {} : flatCodeBlocks;
23
- const configs: Array<TypedFlatConfigItem> = [
24
- {
25
- name: "vdustr/mdx",
26
- ...mdxPlugin.flat,
27
- ...options,
28
- rules: {
29
- ...renameRules({
30
- ...mdxPlugin.flat.rules,
31
- }),
32
- ...options.rules,
33
- },
34
- processor: mdxPlugin.createRemarkProcessor({
35
- lintCodeBlocks: Boolean(flatCodeBlocks),
36
- ...processorOptions,
37
- languageMapper: {
38
- ...processorOptions?.languageMapper,
39
- },
40
- }),
41
- },
42
- ...(!flatCodeBlocks
43
- ? []
44
- : [
45
- {
46
- name: "vdustr/mdx/flat-code-blocks",
47
- ...mdxPlugin.flatCodeBlocks,
48
- ...flatCodeBlocksOptions,
49
- rules: {
50
- ...renameRules({
51
- ...mdxPlugin.flatCodeBlocks.rules,
52
- }),
53
- ...flatCodeBlocksOptions.rules,
54
- },
55
- } satisfies TypedFlatConfigItem,
56
- ]),
57
- ];
58
- return configs;
59
- };
60
-
61
- export { mdx };
@@ -1,12 +0,0 @@
1
- import type { TypedFlatConfigItem } from "@antfu/eslint-config";
2
-
3
- import eslintConfigPrettier from "eslint-config-prettier";
4
- import { renameRules } from "../utils/renameRules";
5
-
6
- const prettier = {
7
- name: "vdustr/prettier",
8
- ...eslintConfigPrettier,
9
- rules: renameRules(eslintConfigPrettier.rules),
10
- } satisfies TypedFlatConfigItem;
11
-
12
- export { prettier };
@@ -1,20 +0,0 @@
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 };
@@ -1,106 +0,0 @@
1
- /* eslint-disable */
2
- /* prettier-ignore */
3
- import type { Linter } from 'eslint'
4
-
5
- declare module 'eslint' {
6
- namespace Linter {
7
- interface RulesRecord extends RuleOptions {}
8
- }
9
- }
10
-
11
- export interface RuleOptions {
12
- /**
13
- * Linter integration with remark plugins
14
- */
15
- 'mdx/remark'?: Linter.RuleEntry<[]>
16
- /**
17
- * Surfaces diagnostics from React Forget
18
- */
19
- 'react-compiler/react-compiler'?: Linter.RuleEntry<ReactCompilerReactCompiler>
20
- /**
21
- * Interactions should be awaited
22
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/await-interactions.md
23
- */
24
- 'storybook/await-interactions'?: Linter.RuleEntry<[]>
25
- /**
26
- * Pass a context when invoking play function of another story
27
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/context-in-play-function.md
28
- */
29
- 'storybook/context-in-play-function'?: Linter.RuleEntry<[]>
30
- /**
31
- * The component property should be set
32
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/csf-component.md
33
- */
34
- 'storybook/csf-component'?: Linter.RuleEntry<[]>
35
- /**
36
- * Story files should have a default export
37
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/default-exports.md
38
- */
39
- 'storybook/default-exports'?: Linter.RuleEntry<[]>
40
- /**
41
- * Deprecated hierarchy separator in title property
42
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/hierarchy-separator.md
43
- */
44
- 'storybook/hierarchy-separator'?: Linter.RuleEntry<[]>
45
- /**
46
- * Meta should only have inline properties
47
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/meta-inline-properties.md
48
- */
49
- 'storybook/meta-inline-properties'?: Linter.RuleEntry<StorybookMetaInlineProperties>
50
- /**
51
- * A story should not have a redundant name property
52
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-redundant-story-name.md
53
- */
54
- 'storybook/no-redundant-story-name'?: Linter.RuleEntry<[]>
55
- /**
56
- * storiesOf is deprecated and should not be used
57
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-stories-of.md
58
- */
59
- 'storybook/no-stories-of'?: Linter.RuleEntry<[]>
60
- /**
61
- * Do not define a title in meta
62
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-title-property-in-meta.md
63
- */
64
- 'storybook/no-title-property-in-meta'?: Linter.RuleEntry<[]>
65
- /**
66
- * This rule identifies storybook addons that are invalid because they are either not installed or contain a typo in their name.
67
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-uninstalled-addons.md
68
- */
69
- 'storybook/no-uninstalled-addons'?: Linter.RuleEntry<StorybookNoUninstalledAddons>
70
- /**
71
- * Stories should use PascalCase
72
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/prefer-pascal-case.md
73
- */
74
- 'storybook/prefer-pascal-case'?: Linter.RuleEntry<[]>
75
- /**
76
- * A story file must contain at least one story export
77
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/story-exports.md
78
- */
79
- 'storybook/story-exports'?: Linter.RuleEntry<[]>
80
- /**
81
- * Use expect from `@storybook/test` or `@storybook/jest`
82
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/use-storybook-expect.md
83
- */
84
- 'storybook/use-storybook-expect'?: Linter.RuleEntry<[]>
85
- /**
86
- * Do not use testing-library directly on stories
87
- * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/use-storybook-testing-library.md
88
- */
89
- 'storybook/use-storybook-testing-library'?: Linter.RuleEntry<[]>
90
- }
91
-
92
- /* ======= Declarations ======= */
93
- // ----- react-compiler/react-compiler -----
94
- type ReactCompilerReactCompiler = []|[{
95
- [k: string]: unknown | undefined
96
- }]
97
- // ----- storybook/meta-inline-properties -----
98
- type StorybookMetaInlineProperties = []|[{
99
- csfVersion?: number
100
- }]
101
- // ----- storybook/no-uninstalled-addons -----
102
- type StorybookNoUninstalledAddons = []|[{
103
- packageJsonLocation?: string
104
- ignore?: string[]
105
- [k: string]: unknown | undefined
106
- }]
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./vdustr";
@@ -1,16 +0,0 @@
1
- import type { ESLint, Linter } from "eslint";
2
- // @ts-expect-error -- Untyped library.
3
- // eslint-disable-next-line import/no-namespace -- `react-compiler` exports the plugin as a namespace.
4
- import * as reactCompiler from "eslint-plugin-react-compiler";
5
-
6
- interface ReactCompiler extends ESLint.Plugin {
7
- rules: NonNullable<ESLint.Plugin["rules"]>;
8
- configs: {
9
- recommended: Linter.LegacyConfig;
10
- };
11
- }
12
-
13
- const reactCompilerInternal: ReactCompiler =
14
- reactCompiler.default ?? reactCompiler;
15
-
16
- export { reactCompilerInternal as reactCompiler };
package/src/tsconfig.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": ["@vp-tw/tsconfig/base/bundler/tsconfig"]
3
- }
package/src/types.ts DELETED
@@ -1,5 +0,0 @@
1
- import type antfu from "@antfu/eslint-config";
2
-
3
- type Config = NonNullable<Parameters<typeof antfu>[1]>;
4
-
5
- export type { Config };
@@ -1,7 +0,0 @@
1
- import { defaultPluginRenaming, renameRules } from "@antfu/eslint-config";
2
-
3
- function renameRulesInternal(rules: Parameters<typeof renameRules>[0]) {
4
- return renameRules(rules, defaultPluginRenaming);
5
- }
6
-
7
- export { renameRulesInternal as renameRules };
package/src/vdustr.ts DELETED
@@ -1,211 +0,0 @@
1
- // eslint-disable-next-line import/no-empty-named-blocks -- Type only import.
2
- import type {} from "./eslint-typegen";
3
- import type { Config } from "./types";
4
- import antfu from "@antfu/eslint-config";
5
-
6
- import packageJson from "eslint-plugin-package-json/configs/recommended";
7
-
8
- import { isPackageExists } from "local-pkg";
9
- import { mdx } from "./configs/mdx";
10
- import { prettier } from "./configs/prettier";
11
- import { storybook } from "./configs/storybook";
12
- import { reactCompiler } from "./lib/eslint-plugin-react-compiler";
13
-
14
- type Options = Omit<NonNullable<Parameters<typeof antfu>[0]>, "stylistic"> & {
15
- mdx?: boolean | mdx.Options;
16
- storybook?: boolean;
17
- };
18
-
19
- const vdustr = (options?: Options, ...userConfigs: Array<Config>) => {
20
- const typescriptEnabled = isPackageExists("typescript");
21
- const jsoncEnabled: boolean = Boolean(options?.jsonc ?? true);
22
- const reactEnabled: boolean = Boolean(options?.react ?? false);
23
- const storybookEnabled: boolean = Boolean(options?.storybook ?? false);
24
- const mdxEnabled: boolean = Boolean(options?.mdx ?? false);
25
- const mdxOptions: Extract<Options["mdx"], Record<PropertyKey, any>> = {
26
- ...(typeof options?.mdx !== "object" ? null : options.mdx),
27
- };
28
- const mdxFlatCodeBlocksEnabled: boolean = Boolean(
29
- mdxOptions?.flatCodeBlocks ?? true,
30
- );
31
- const mdxFlatCodeBlocksOptions: Extract<
32
- (typeof mdxOptions)["flatCodeBlocks"],
33
- Record<PropertyKey, any>
34
- > = {
35
- ...(typeof mdxOptions?.flatCodeBlocks !== "object"
36
- ? null
37
- : mdxOptions.flatCodeBlocks),
38
- };
39
- let config = antfu(
40
- {
41
- // We use `prettier`.
42
- stylistic: false,
43
- ...options,
44
- },
45
- ...userConfigs,
46
- );
47
-
48
- config = config
49
- .override("antfu/javascript/rules", (config) => ({
50
- ...config,
51
- rules: {
52
- ...config.rules,
53
- /**
54
- * Some callbacks are purposefully named to make the code self-documenting.
55
- */
56
- "prefer-arrow-callback": "off",
57
-
58
- /**
59
- * This rule does not integrate well with JSDoc `@link` tags. It's advised
60
- * to verify its behavior with TypeScript instead.
61
- */
62
- "no-unused-vars": "off",
63
- "unused-imports/no-unused-vars": "off",
64
- "unused-imports/no-unused-imports-ts": "off",
65
- "unused-imports/no-unused-vars-ts": "off",
66
- "unused-imports/no-unused-imports": "off",
67
- },
68
- }))
69
- .override("antfu/imports/rules", (config) => ({
70
- ...config,
71
- rules: {
72
- ...config.rules,
73
- /**
74
- * Forbid `import {} from "module"`.
75
- */
76
- "import/no-empty-named-blocks": "error",
77
-
78
- /**
79
- * Wildcard imports can prevent tree shaking and cause name conflicts.
80
- * Consider using named imports instead.
81
- */
82
- "import/no-namespace": "error",
83
-
84
- /**
85
- * Enforcing named exports improves consistency, enhances auto-completion and refactoring, and avoids issues
86
- * with default export renaming. Additionally, default exports might lead to different behavior when transformed
87
- * to CJS.
88
- */
89
- "import/no-default-export": "error",
90
- },
91
- }))
92
-
93
- /**
94
- * Allow default exports in certain files.
95
- */
96
- .insertAfter("antfu/imports/rules", {
97
- name: "vdustr/allow-default-export",
98
- rules: {
99
- "import/no-default-export": "off",
100
- },
101
- files: [
102
- // Configuration files
103
- "**/*.config.*",
104
-
105
- // Single file components
106
- "**/*.vue",
107
- "**/*.svelte",
108
- ],
109
- });
110
-
111
- if (typescriptEnabled) {
112
- config = config.override("antfu/typescript/rules", (config) => ({
113
- ...config,
114
- rules: {
115
- ...config.rules,
116
- "ts/array-type": ["error", { default: "generic" }],
117
-
118
- /**
119
- * Namespaces are useful for centralizing the management of types. Just avoid
120
- * overusing them with runtime code.
121
- *
122
- * - References:
123
- * - <https://x.com/mattpocockuk/status/1805606072167940167>
124
- */
125
- "ts/no-namespace": "off",
126
- "ts/no-redeclare": "off",
127
-
128
- /**
129
- * Check for unused variables in TypeScript.
130
- */
131
- "ts/no-unused-vars": "off",
132
- },
133
- }));
134
- }
135
-
136
- if (jsoncEnabled) {
137
- config = config
138
- .override("antfu/jsonc/rules", (config) => ({
139
- ...config,
140
- rules: {
141
- ...config.rules,
142
- "jsonc/sort-keys": "error",
143
- },
144
- files: [...(config.files ?? []), "**/*.code-workspace"],
145
- ignores: [
146
- ...(config.ignores ?? []),
147
- /**
148
- * Lint `package.json` files with `eslint-plugin-package-json` instead.
149
- */
150
- "**/package.json",
151
- ],
152
- }))
153
- .insertAfter("antfu/jsonc/rules", packageJson)
154
- .remove("antfu/sort/package-json")
155
- .remove("antfu/sort/tsconfig-json");
156
- }
157
-
158
- if (reactEnabled) {
159
- config = config.override("antfu/react/rules", (config) => ({
160
- ...config,
161
- plugins: {
162
- ...config.plugins,
163
- "react-compiler": reactCompiler,
164
- },
165
- rules: {
166
- ...config.rules,
167
- "react-compiler/react-compiler": "error",
168
-
169
- /**
170
- * Not all destructuring assignments are more readable than their alternatives.
171
- */
172
- "react/prefer-destructuring-assignment": "off",
173
- },
174
- }));
175
- }
176
-
177
- if (storybookEnabled) {
178
- config = config
179
- .append(storybook)
180
- .override("storybook:csf:stories-rules", (config) => ({
181
- ...config,
182
- rules: {
183
- ...config.rules,
184
- "import/no-default-export": "off",
185
- },
186
- }));
187
- }
188
-
189
- if (mdxEnabled) {
190
- config = config.append(
191
- mdx({
192
- ...mdxOptions,
193
- flatCodeBlocks: !mdxFlatCodeBlocksEnabled
194
- ? false
195
- : {
196
- ...mdxFlatCodeBlocksOptions,
197
- rules: {
198
- "import/no-default-export": "off",
199
- ...mdxFlatCodeBlocksOptions?.rules,
200
- },
201
- },
202
- }),
203
- );
204
- }
205
-
206
- config = config.append(prettier);
207
-
208
- return config;
209
- };
210
-
211
- export { vdustr };
package/tsconfig.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "exclude": ["scripts", "./*.ts", "src/lib"],
3
- "extends": ["@vp-tw/tsconfig/base/bundler/tsconfig"]
4
- }