@vp-tw/eslint-config 0.0.6 → 0.0.7

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.
@@ -20,28 +20,12 @@ const vdustr = (options, ...userConfigs) => {
20
20
  const mdxFlatCodeBlocksOptions = {
21
21
  ...typeof mdxOptions?.flatCodeBlocks !== "object" ? null : mdxOptions.flatCodeBlocks
22
22
  };
23
- const defaultConfigs = [
24
- ...!jsoncEnabled ? [] : [packageJson],
25
- ...!mdxEnabled ? [] : mdx({
26
- ...mdxOptions,
27
- flatCodeBlocks: !mdxFlatCodeBlocksEnabled ? false : {
28
- ...mdxFlatCodeBlocksOptions,
29
- rules: {
30
- "import/no-default-export": "off",
31
- ...mdxFlatCodeBlocksOptions?.rules
32
- }
33
- }
34
- }),
35
- ...!storybookEnabled ? [] : storybook,
36
- prettier
37
- ];
38
23
  let config = antfu(
39
24
  {
40
25
  // We use `prettier`.
41
26
  stylistic: false,
42
27
  ...options
43
28
  },
44
- ...defaultConfigs,
45
29
  ...userConfigs
46
30
  );
47
31
  config = config.override("antfu/javascript/rules", (config2) => ({
@@ -88,6 +72,7 @@ const vdustr = (options, ...userConfigs) => {
88
72
  "import/no-default-export": "off"
89
73
  },
90
74
  files: [
75
+ // Configuration files
91
76
  "**/*.config.*",
92
77
  // Single file components
93
78
  "**/*.vue",
@@ -131,7 +116,7 @@ const vdustr = (options, ...userConfigs) => {
131
116
  */
132
117
  "**/package.json"
133
118
  ]
134
- })).remove("antfu/sort/package-json").remove("antfu/sort/tsconfig-json");
119
+ })).insertAfter("antfu/jsonc/rules", packageJson).remove("antfu/sort/package-json").remove("antfu/sort/tsconfig-json");
135
120
  }
136
121
  if (reactEnabled) {
137
122
  config = config.override("antfu/react/rules", (config2) => ({
@@ -151,7 +136,7 @@ const vdustr = (options, ...userConfigs) => {
151
136
  }));
152
137
  }
153
138
  if (storybookEnabled) {
154
- config = config.override("storybook:csf:stories-rules", (config2) => ({
139
+ config = config.append(storybook).override("storybook:csf:stories-rules", (config2) => ({
155
140
  ...config2,
156
141
  rules: {
157
142
  ...config2.rules,
@@ -159,6 +144,21 @@ const vdustr = (options, ...userConfigs) => {
159
144
  }
160
145
  }));
161
146
  }
147
+ if (mdxEnabled) {
148
+ config = config.append(
149
+ mdx({
150
+ ...mdxOptions,
151
+ flatCodeBlocks: !mdxFlatCodeBlocksEnabled ? false : {
152
+ ...mdxFlatCodeBlocksOptions,
153
+ rules: {
154
+ "import/no-default-export": "off",
155
+ ...mdxFlatCodeBlocksOptions?.rules
156
+ }
157
+ }
158
+ })
159
+ );
160
+ }
161
+ config = config.append(prettier);
162
162
  return config;
163
163
  };
164
164
  export { vdustr };
package/dist/vdustr.js CHANGED
@@ -25,21 +25,11 @@ const vdustr = (options, ...userConfigs) => {
25
25
  const mdxFlatCodeBlocksOptions = {
26
26
  ...(typeof mdxOptions?.flatCodeBlocks !== "object" ? null : mdxOptions.flatCodeBlocks)
27
27
  };
28
- const defaultConfigs = [...(!jsoncEnabled ? [] : [_recommended.default]), ...(!mdxEnabled ? [] : (0, _mdx.mdx)({
29
- ...mdxOptions,
30
- flatCodeBlocks: !mdxFlatCodeBlocksEnabled ? false : {
31
- ...mdxFlatCodeBlocksOptions,
32
- rules: {
33
- "import/no-default-export": "off",
34
- ...mdxFlatCodeBlocksOptions?.rules
35
- }
36
- }
37
- })), ...(!storybookEnabled ? [] : _storybook.storybook), _prettier.prettier];
38
28
  let config = (0, _eslintConfig.default)({
39
29
  // We use `prettier`.
40
30
  stylistic: false,
41
31
  ...options
42
- }, ...defaultConfigs, ...userConfigs);
32
+ }, ...userConfigs);
43
33
  config = config.override("antfu/javascript/rules", config2 => ({
44
34
  ...config2,
45
35
  rules: {
@@ -83,7 +73,9 @@ const vdustr = (options, ...userConfigs) => {
83
73
  rules: {
84
74
  "import/no-default-export": "off"
85
75
  },
86
- files: ["**/*.config.*",
76
+ files: [
77
+ // Configuration files
78
+ "**/*.config.*",
87
79
  // Single file components
88
80
  "**/*.vue", "**/*.svelte"]
89
81
  });
@@ -124,7 +116,7 @@ const vdustr = (options, ...userConfigs) => {
124
116
  * Lint `package.json` files with `eslint-plugin-package-json` instead.
125
117
  */
126
118
  "**/package.json"]
127
- })).remove("antfu/sort/package-json").remove("antfu/sort/tsconfig-json");
119
+ })).insertAfter("antfu/jsonc/rules", _recommended.default).remove("antfu/sort/package-json").remove("antfu/sort/tsconfig-json");
128
120
  }
129
121
  if (reactEnabled) {
130
122
  config = config.override("antfu/react/rules", config2 => ({
@@ -144,7 +136,7 @@ const vdustr = (options, ...userConfigs) => {
144
136
  }));
145
137
  }
146
138
  if (storybookEnabled) {
147
- config = config.override("storybook:csf:stories-rules", config2 => ({
139
+ config = config.append(_storybook.storybook).override("storybook:csf:stories-rules", config2 => ({
148
140
  ...config2,
149
141
  rules: {
150
142
  ...config2.rules,
@@ -152,6 +144,19 @@ const vdustr = (options, ...userConfigs) => {
152
144
  }
153
145
  }));
154
146
  }
147
+ if (mdxEnabled) {
148
+ config = config.append((0, _mdx.mdx)({
149
+ ...mdxOptions,
150
+ flatCodeBlocks: !mdxFlatCodeBlocksEnabled ? false : {
151
+ ...mdxFlatCodeBlocksOptions,
152
+ rules: {
153
+ "import/no-default-export": "off",
154
+ ...mdxFlatCodeBlocksOptions?.rules
155
+ }
156
+ }
157
+ }));
158
+ }
159
+ config = config.append(_prettier.prettier);
155
160
  return config;
156
161
  };
157
162
  exports.vdustr = vdustr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vp-tw/eslint-config",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "ViPro's ESLint configuration",
5
5
  "homepage": "https://github.com/vdustr/eslint-config",
6
6
  "author": {
package/src/vdustr.ts CHANGED
@@ -36,33 +36,12 @@ const vdustr = (options?: Options, ...userConfigs: Array<Config>) => {
36
36
  ? null
37
37
  : mdxOptions.flatCodeBlocks),
38
38
  };
39
- type Config = NonNullable<Parameters<typeof antfu>[1]>;
40
- const defaultConfigs: Array<Config> = [
41
- ...(!jsoncEnabled ? [] : [packageJson]),
42
- ...(!mdxEnabled
43
- ? []
44
- : mdx({
45
- ...mdxOptions,
46
- flatCodeBlocks: !mdxFlatCodeBlocksEnabled
47
- ? false
48
- : {
49
- ...mdxFlatCodeBlocksOptions,
50
- rules: {
51
- "import/no-default-export": "off",
52
- ...mdxFlatCodeBlocksOptions?.rules,
53
- },
54
- },
55
- })),
56
- ...(!storybookEnabled ? [] : storybook),
57
- prettier,
58
- ];
59
39
  let config = antfu(
60
40
  {
61
41
  // We use `prettier`.
62
42
  stylistic: false,
63
43
  ...options,
64
44
  },
65
- ...defaultConfigs,
66
45
  ...userConfigs,
67
46
  );
68
47
 
@@ -120,7 +99,9 @@ const vdustr = (options?: Options, ...userConfigs: Array<Config>) => {
120
99
  "import/no-default-export": "off",
121
100
  },
122
101
  files: [
102
+ // Configuration files
123
103
  "**/*.config.*",
104
+
124
105
  // Single file components
125
106
  "**/*.vue",
126
107
  "**/*.svelte",
@@ -169,6 +150,7 @@ const vdustr = (options?: Options, ...userConfigs: Array<Config>) => {
169
150
  "**/package.json",
170
151
  ],
171
152
  }))
153
+ .insertAfter("antfu/jsonc/rules", packageJson)
172
154
  .remove("antfu/sort/package-json")
173
155
  .remove("antfu/sort/tsconfig-json");
174
156
  }
@@ -193,15 +175,36 @@ const vdustr = (options?: Options, ...userConfigs: Array<Config>) => {
193
175
  }
194
176
 
195
177
  if (storybookEnabled) {
196
- config = config.override("storybook:csf:stories-rules", (config) => ({
197
- ...config,
198
- rules: {
199
- ...config.rules,
200
- "import/no-default-export": "off",
201
- },
202
- }));
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
+ }));
203
187
  }
204
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
+
205
208
  return config;
206
209
  };
207
210