@vp-tw/eslint-config 0.0.4 → 0.0.5

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/vdustr.ts +26 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vp-tw/eslint-config",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "ViPro's ESLint configuration",
5
5
  "homepage": "https://github.com/vdustr/eslint-config",
6
6
  "author": {
package/src/vdustr.ts CHANGED
@@ -21,14 +21,37 @@ const vdustr = (options?: Options, ...userConfigs: Array<Config>) => {
21
21
  const jsoncEnabled: boolean = Boolean(options?.jsonc ?? true);
22
22
  const reactEnabled: boolean = Boolean(options?.react ?? false);
23
23
  const storybookEnabled: boolean = Boolean(options?.storybook ?? false);
24
- const mdxOptions = options?.mdx ?? true;
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
+ };
25
39
  type Config = NonNullable<Parameters<typeof antfu>[1]>;
26
40
  const defaultConfigs: Array<Config> = [
27
41
  ...(!jsoncEnabled ? [] : [packageJson]),
28
- ...(!mdxOptions
42
+ ...(!mdxEnabled
29
43
  ? []
30
44
  : mdx({
31
- ...(typeof mdxOptions !== "object" ? null : mdxOptions),
45
+ ...mdxOptions,
46
+ flatCodeBlocks: !mdxFlatCodeBlocksEnabled
47
+ ? false
48
+ : {
49
+ ...mdxFlatCodeBlocksOptions,
50
+ rules: {
51
+ "import/no-default-export": "off",
52
+ ...mdxFlatCodeBlocksOptions?.rules,
53
+ },
54
+ },
32
55
  })),
33
56
  ...(!storybookEnabled ? [] : storybook),
34
57
  prettier,