@vp-tw/eslint-config 0.0.20 → 0.0.22

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.
package/README.md CHANGED
@@ -46,6 +46,16 @@ export default vdustr(
46
46
  );
47
47
  ```
48
48
 
49
+ ## Release
50
+
51
+ ```bash
52
+ pnpm -w v:patch # or
53
+ pnpm -w v:minor # or
54
+ pnpm -w v:major
55
+
56
+ pnpm -r publish
57
+ ```
58
+
49
59
  ## License
50
60
 
51
61
  MIT © ViPro <vdustr@gmail.com> (<http://vdustr.dev>)
@@ -29,24 +29,33 @@ const mdx = async ({
29
29
  name: "vdustr/mdx/processor"
30
30
  };
31
31
  const rulesConfig = (0, _defu.default)(options.mdx, {
32
- ...(0, _esToolkit.omit)(mdxPlugin.flat, ["plugins", "processor"]),
33
- name: "vdustr/mdx/rules",
34
- rules: (0, _renameRules.renameRules)(mdxPlugin.flat.rules ?? {}),
32
+ ignores: [
35
33
  /**
36
34
  * Handled by `@eslint/markdown`.
37
35
  */
38
- ignores: [...(mdxPlugin.flat.ignores ?? []), _eslintConfig.GLOB_MARKDOWN]
36
+ _eslintConfig.GLOB_MARKDOWN]
37
+ }, {
38
+ ...(0, _esToolkit.omit)(mdxPlugin.flat, ["plugins", "processor"]),
39
+ name: "vdustr/mdx/rules",
40
+ rules: (0, _renameRules.renameRules)(mdxPlugin.flat.rules ?? {}),
41
+ ignores: mdxPlugin.flat.ignores ?? []
39
42
  });
40
43
  const configs = [setupConfig, processorConfig, rulesConfig];
41
44
  if (codeBlocks) {
42
45
  const codeBlocksConfig = (0, _defu.default)(codeBlocksOptions, {
43
- ...mdxPlugin.flatCodeBlocks,
44
- name: "vdustr/mdx/code-blocks",
45
- rules: (0, _renameRules.renameRules)(mdxPlugin.flatCodeBlocks.rules ?? {}),
46
+ rules: {
47
+ "import/no-default-export": "off"
48
+ },
49
+ ignores: [
46
50
  /**
47
51
  * Handled by `@eslint/markdown`.
48
52
  */
49
- ignores: [...(mdxPlugin.flatCodeBlocks.ignores ?? []), _eslintConfig.GLOB_MARKDOWN_CODE]
53
+ _eslintConfig.GLOB_MARKDOWN_CODE]
54
+ }, {
55
+ ...mdxPlugin.flatCodeBlocks,
56
+ name: "vdustr/mdx/code-blocks",
57
+ rules: (0, _renameRules.renameRules)(mdxPlugin.flatCodeBlocks.rules ?? {}),
58
+ ignores: mdxPlugin.flatCodeBlocks.ignores ?? []
50
59
  });
51
60
  configs.push(codeBlocksConfig);
52
61
  }
@@ -28,30 +28,43 @@ const mdx = async ({
28
28
  };
29
29
  const rulesConfig = defu(
30
30
  options.mdx,
31
+ {
32
+ ignores: [
33
+ /**
34
+ * Handled by `@eslint/markdown`.
35
+ */
36
+ GLOB_MARKDOWN
37
+ ]
38
+ },
31
39
  {
32
40
  ...omit(mdxPlugin.flat, ["plugins", "processor"]),
33
41
  name: "vdustr/mdx/rules",
34
42
  rules: renameRules(mdxPlugin.flat.rules ?? {}),
35
- /**
36
- * Handled by `@eslint/markdown`.
37
- */
38
- ignores: [...mdxPlugin.flat.ignores ?? [], GLOB_MARKDOWN]
43
+ ignores: mdxPlugin.flat.ignores ?? []
39
44
  }
40
45
  );
41
46
  const configs = [setupConfig, processorConfig, rulesConfig];
42
47
  if (codeBlocks) {
43
- const codeBlocksConfig = defu(codeBlocksOptions, {
44
- ...mdxPlugin.flatCodeBlocks,
45
- name: "vdustr/mdx/code-blocks",
46
- rules: renameRules(mdxPlugin.flatCodeBlocks.rules ?? {}),
47
- /**
48
- * Handled by `@eslint/markdown`.
49
- */
50
- ignores: [
51
- ...mdxPlugin.flatCodeBlocks.ignores ?? [],
52
- GLOB_MARKDOWN_CODE
53
- ]
54
- });
48
+ const codeBlocksConfig = defu(
49
+ codeBlocksOptions,
50
+ {
51
+ rules: {
52
+ "import/no-default-export": "off"
53
+ },
54
+ ignores: [
55
+ /**
56
+ * Handled by `@eslint/markdown`.
57
+ */
58
+ GLOB_MARKDOWN_CODE
59
+ ]
60
+ },
61
+ {
62
+ ...mdxPlugin.flatCodeBlocks,
63
+ name: "vdustr/mdx/code-blocks",
64
+ rules: renameRules(mdxPlugin.flatCodeBlocks.rules ?? {}),
65
+ ignores: mdxPlugin.flatCodeBlocks.ignores ?? []
66
+ }
67
+ );
55
68
  configs.push(codeBlocksConfig);
56
69
  }
57
70
  return configs;
@@ -21,8 +21,6 @@ const javascript = (composer, options) => {
21
21
  */
22
22
  "no-unused-vars": "off",
23
23
  "unused-imports/no-unused-vars": "off",
24
- "unused-imports/no-unused-imports-ts": "off",
25
- "unused-imports/no-unused-vars-ts": "off",
26
24
  "unused-imports/no-unused-imports": "off"
27
25
  }
28
26
  },
@@ -4,7 +4,12 @@ import type { DistributiveOmit } from "@mui/types";
4
4
  import type { Linter } from "eslint";
5
5
  import type { FlatConfigComposer } from "eslint-flat-config-utils";
6
6
  import type { RuleOptions, ConfigNames as VpEslintConfigNames } from "./eslint-typegen";
7
- type Config = NonNullable<Parameters<typeof antfu>[1]>;
7
+ type AnyObject = Record<PropertyKey, any>;
8
+ type ObjectReplaceAntfuEslintRulesWithRulesDeeply<T extends AnyObject> = (Extract<T, AntfuEslintRules> extends never ? never : Rules) | {
9
+ [K in keyof T]: ReplaceAntfuEslintRulesWithVpRulesDeeply<T[K]>;
10
+ };
11
+ type ReplaceAntfuEslintRulesWithVpRulesDeeply<T> = (Extract<T, AntfuEslintRules> extends never ? never : Rules) | (ObjectReplaceAntfuEslintRulesWithRulesDeeply<Extract<T, AnyObject>> | Exclude<T, AnyObject>);
12
+ type Config = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<typeof antfu>[1]>>;
8
13
  type Rules = RuleOptions & AntfuEslintRules;
9
14
  type ConfigNames = VpEslintConfigNames | AntfuEslintConfigNames;
10
15
  /**
@@ -19,4 +24,4 @@ interface ConfigOverrides extends DistributiveOmit<TypedFlatConfigItem, "process
19
24
  * Typed composer.
20
25
  */
21
26
  type VpComposer = FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
22
- export type { Config, ConfigNames, ConfigOverrides, TypedFlatConfigItem, VpComposer, };
27
+ export type { AnyObject, Config, ConfigNames, ConfigOverrides, ReplaceAntfuEslintRulesWithVpRulesDeeply, TypedFlatConfigItem, VpComposer, };
@@ -1,4 +1,4 @@
1
- import type { Config, VpComposer } from "./types";
1
+ import type { Config, ReplaceAntfuEslintRulesWithVpRulesDeeply, VpComposer } from "./types";
2
2
  import antfu from "@antfu/eslint-config";
3
3
  import { mdx } from "./configs/mdx";
4
4
  import { prettier } from "./configs/prettier";
@@ -9,7 +9,7 @@ import { jsonc } from "./extends/jsonc";
9
9
  import { react } from "./extends/react";
10
10
  import { typescript } from "./extends/typescript";
11
11
  import { yaml } from "./extends/yaml";
12
- type Options = NonNullable<Parameters<typeof antfu>[0]> & {
12
+ type Options = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<typeof antfu>[0]>> & {
13
13
  javascriptExtends?: javascript.Options;
14
14
  importsExtends?: imports.Options;
15
15
  typescriptExtends?: typescript.Options;
@@ -41,13 +41,7 @@ const vdustr = (options, ...userConfigs) => {
41
41
  config = config.append(
42
42
  mdx({
43
43
  ...mdxOptions,
44
- codeBlocks: !mdxFlatCodeBlocksEnabled ? false : {
45
- ...mdxFlatCodeBlocksOptions,
46
- rules: {
47
- "import/no-default-export": "off",
48
- ...mdxFlatCodeBlocksOptions?.rules
49
- }
50
- }
44
+ codeBlocks: !mdxFlatCodeBlocksEnabled ? false : mdxFlatCodeBlocksOptions
51
45
  })
52
46
  );
53
47
  }
@@ -26,8 +26,6 @@ const javascript = (composer, options) => {
26
26
  */
27
27
  "no-unused-vars": "off",
28
28
  "unused-imports/no-unused-vars": "off",
29
- "unused-imports/no-unused-imports-ts": "off",
30
- "unused-imports/no-unused-vars-ts": "off",
31
29
  "unused-imports/no-unused-imports": "off"
32
30
  }
33
31
  }, omittedConfig);
package/dist/types.d.ts CHANGED
@@ -4,7 +4,12 @@ import type { DistributiveOmit } from "@mui/types";
4
4
  import type { Linter } from "eslint";
5
5
  import type { FlatConfigComposer } from "eslint-flat-config-utils";
6
6
  import type { RuleOptions, ConfigNames as VpEslintConfigNames } from "./eslint-typegen";
7
- type Config = NonNullable<Parameters<typeof antfu>[1]>;
7
+ type AnyObject = Record<PropertyKey, any>;
8
+ type ObjectReplaceAntfuEslintRulesWithRulesDeeply<T extends AnyObject> = (Extract<T, AntfuEslintRules> extends never ? never : Rules) | {
9
+ [K in keyof T]: ReplaceAntfuEslintRulesWithVpRulesDeeply<T[K]>;
10
+ };
11
+ type ReplaceAntfuEslintRulesWithVpRulesDeeply<T> = (Extract<T, AntfuEslintRules> extends never ? never : Rules) | (ObjectReplaceAntfuEslintRulesWithRulesDeeply<Extract<T, AnyObject>> | Exclude<T, AnyObject>);
12
+ type Config = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<typeof antfu>[1]>>;
8
13
  type Rules = RuleOptions & AntfuEslintRules;
9
14
  type ConfigNames = VpEslintConfigNames | AntfuEslintConfigNames;
10
15
  /**
@@ -19,4 +24,4 @@ interface ConfigOverrides extends DistributiveOmit<TypedFlatConfigItem, "process
19
24
  * Typed composer.
20
25
  */
21
26
  type VpComposer = FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
22
- export type { Config, ConfigNames, ConfigOverrides, TypedFlatConfigItem, VpComposer, };
27
+ export type { AnyObject, Config, ConfigNames, ConfigOverrides, ReplaceAntfuEslintRulesWithVpRulesDeeply, TypedFlatConfigItem, VpComposer, };
package/dist/vdustr.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Config, VpComposer } from "./types";
1
+ import type { Config, ReplaceAntfuEslintRulesWithVpRulesDeeply, VpComposer } from "./types";
2
2
  import antfu from "@antfu/eslint-config";
3
3
  import { mdx } from "./configs/mdx";
4
4
  import { prettier } from "./configs/prettier";
@@ -9,7 +9,7 @@ import { jsonc } from "./extends/jsonc";
9
9
  import { react } from "./extends/react";
10
10
  import { typescript } from "./extends/typescript";
11
11
  import { yaml } from "./extends/yaml";
12
- type Options = NonNullable<Parameters<typeof antfu>[0]> & {
12
+ type Options = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<typeof antfu>[0]>> & {
13
13
  javascriptExtends?: javascript.Options;
14
14
  importsExtends?: imports.Options;
15
15
  typescriptExtends?: typescript.Options;
package/dist/vdustr.js CHANGED
@@ -43,13 +43,7 @@ const vdustr = (options, ...userConfigs) => {
43
43
  };
44
44
  config = config.append((0, _mdx.mdx)({
45
45
  ...mdxOptions,
46
- codeBlocks: !mdxFlatCodeBlocksEnabled ? false : {
47
- ...mdxFlatCodeBlocksOptions,
48
- rules: {
49
- "import/no-default-export": "off",
50
- ...mdxFlatCodeBlocksOptions?.rules
51
- }
52
- }
46
+ codeBlocks: !mdxFlatCodeBlocksEnabled ? false : mdxFlatCodeBlocksOptions
53
47
  }));
54
48
  }
55
49
  const prettierEnabled = Boolean(options?.prettier ?? true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vp-tw/eslint-config",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "description": "ViPro's ESLint configuration",
5
5
  "homepage": "https://github.com/vdustr/eslint-config",
6
6
  "author": {