@pengzhanbo/eslint-config 1.2.5 → 1.3.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 pengzhanbo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs CHANGED
@@ -43,16 +43,20 @@ __export(src_exports, {
43
43
  GLOB_LESS: () => GLOB_LESS,
44
44
  GLOB_MARKDOWN: () => GLOB_MARKDOWN,
45
45
  GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
46
+ GLOB_MARKDOWN_IN_MARKDOWN: () => GLOB_MARKDOWN_IN_MARKDOWN,
47
+ GLOB_POSTCSS: () => GLOB_POSTCSS,
46
48
  GLOB_SCSS: () => GLOB_SCSS,
47
49
  GLOB_SRC: () => GLOB_SRC,
48
50
  GLOB_SRC_EXT: () => GLOB_SRC_EXT,
49
51
  GLOB_STYLE: () => GLOB_STYLE,
50
52
  GLOB_SVELTE: () => GLOB_SVELTE,
51
53
  GLOB_TESTS: () => GLOB_TESTS,
54
+ GLOB_TOML: () => GLOB_TOML,
52
55
  GLOB_TS: () => GLOB_TS,
53
56
  GLOB_TSX: () => GLOB_TSX,
54
57
  GLOB_VUE: () => GLOB_VUE,
55
58
  GLOB_YAML: () => GLOB_YAML,
59
+ StylisticConfigDefaults: () => StylisticConfigDefaults,
56
60
  combine: () => combine,
57
61
  comments: () => comments,
58
62
  createConfig: () => createConfig,
@@ -82,6 +86,7 @@ __export(src_exports, {
82
86
  tailwindcss: () => tailwindcss,
83
87
  test: () => test,
84
88
  toArray: () => toArray,
89
+ toml: () => toml,
85
90
  typescript: () => typescript,
86
91
  unicorn: () => unicorn,
87
92
  unocss: () => unocss,
@@ -150,14 +155,17 @@ var GLOB_TS = "**/*.?([cm])ts";
150
155
  var GLOB_TSX = "**/*.?([cm])tsx";
151
156
  var GLOB_STYLE = "**/*.{c,le,sc}ss";
152
157
  var GLOB_CSS = "**/*.css";
158
+ var GLOB_POSTCSS = "**/*.{p,post}css";
153
159
  var GLOB_LESS = "**/*.less";
154
160
  var GLOB_SCSS = "**/*.scss";
155
161
  var GLOB_JSON = "**/*.json";
156
162
  var GLOB_JSON5 = "**/*.json5";
157
163
  var GLOB_JSONC = "**/*.jsonc";
158
164
  var GLOB_MARKDOWN = "**/*.md";
165
+ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
159
166
  var GLOB_VUE = "**/*.vue";
160
167
  var GLOB_YAML = "**/*.y?(a)ml";
168
+ var GLOB_TOML = "**/*.toml";
161
169
  var GLOB_HTML = "**/*.htm?(l)";
162
170
  var GLOB_ASTRO = "**/*.astro";
163
171
  var GLOB_SVELTE = "**/*.svelte";
@@ -587,12 +595,12 @@ async function markdown(options = {}) {
587
595
  files = [GLOB_MARKDOWN],
588
596
  overrides = {}
589
597
  } = options;
598
+ const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
590
599
  return [
591
600
  {
592
601
  name: "config:markdown:setup",
593
602
  plugins: {
594
- // @ts-expect-error missing types
595
- markdown: await interopDefault(import("eslint-plugin-markdown"))
603
+ markdown: markdown2
596
604
  }
597
605
  },
598
606
  {
@@ -612,9 +620,8 @@ async function markdown(options = {}) {
612
620
  }
613
621
  }
614
622
  },
615
- name: "config:markdown:rules",
623
+ name: "config:markdown:disables",
616
624
  rules: {
617
- "antfu/no-ts-export-equal": "off",
618
625
  "import/newline-after-import": "off",
619
626
  "no-alert": "off",
620
627
  "no-console": "off",
@@ -902,13 +909,22 @@ function sortTsconfig() {
902
909
  }
903
910
 
904
911
  // src/configs/stylistic.ts
912
+ var StylisticConfigDefaults = {
913
+ indent: 2,
914
+ jsx: true,
915
+ quotes: "single",
916
+ semi: false
917
+ };
905
918
  async function stylistic(options = {}) {
906
919
  const {
907
- indent = 2,
908
- jsx = true,
909
- quotes = "single",
910
- semi = false
911
- } = options;
920
+ indent,
921
+ jsx,
922
+ quotes,
923
+ semi
924
+ } = {
925
+ ...StylisticConfigDefaults,
926
+ ...options
927
+ };
912
928
  const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
913
929
  const config = pluginStylistic.configs.customize({
914
930
  flat: true,
@@ -929,7 +945,6 @@ async function stylistic(options = {}) {
929
945
  ...config.rules,
930
946
  "antfu/consistent-list-newline": "error",
931
947
  "antfu/if-newline": "error",
932
- "antfu/indent-binary-ops": ["error", { indent }],
933
948
  "antfu/top-level-function": "error",
934
949
  "curly": ["error", "multi-or-nest", "consistent"]
935
950
  }
@@ -1013,8 +1028,6 @@ async function typescript(options = {}) {
1013
1028
  "@typescript-eslint/",
1014
1029
  "ts/"
1015
1030
  ),
1016
- "antfu/generic-spacing": "error",
1017
- "antfu/named-tuple-spacing": "error",
1018
1031
  "no-dupe-class-members": "off",
1019
1032
  "no-loss-of-precision": "off",
1020
1033
  "no-redeclare": "off",
@@ -1366,6 +1379,49 @@ async function html(options = {}) {
1366
1379
  ];
1367
1380
  }
1368
1381
 
1382
+ // src/configs/toml.ts
1383
+ async function toml(options = {}) {
1384
+ const {
1385
+ files = [GLOB_TOML],
1386
+ overrides = {},
1387
+ stylistic: stylistic2 = true
1388
+ } = options;
1389
+ const {
1390
+ indent = 2
1391
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1392
+ const [
1393
+ pluginToml,
1394
+ parserToml
1395
+ ] = await Promise.all([
1396
+ interopDefault(import("eslint-plugin-toml")),
1397
+ interopDefault(import("toml-eslint-parser"))
1398
+ ]);
1399
+ return [
1400
+ {
1401
+ name: "config:toml:setup",
1402
+ plugins: {
1403
+ toml: pluginToml
1404
+ }
1405
+ },
1406
+ {
1407
+ files,
1408
+ languageOptions: {
1409
+ parser: parserToml
1410
+ },
1411
+ name: "config:toml:rules",
1412
+ rules: {
1413
+ ...pluginToml.configs.standard.rules,
1414
+ ...pluginToml.configs.recommended.rules,
1415
+ "style/spaced-comment": "off",
1416
+ ...stylistic2 ? {
1417
+ "toml/indent": ["error", indent === "tab" ? 2 : indent]
1418
+ } : {},
1419
+ ...overrides
1420
+ }
1421
+ }
1422
+ ];
1423
+ }
1424
+
1369
1425
  // src/preset.ts
1370
1426
  var defaultPreset = (options) => {
1371
1427
  const {
@@ -1433,27 +1489,35 @@ var defaultPreset = (options) => {
1433
1489
  sortTsconfig()
1434
1490
  );
1435
1491
  }
1436
- if (options.html) {
1437
- configs.push(html({
1438
- overrides: overrides.html,
1439
- stylistic: stylisticOptions
1440
- }));
1441
- }
1442
1492
  if (options.yaml) {
1443
1493
  configs.push(yaml({
1444
1494
  overrides: overrides.yaml,
1445
1495
  stylistic: stylisticOptions
1446
1496
  }));
1447
1497
  }
1498
+ if (options.toml) {
1499
+ configs.push(toml({
1500
+ overrides: overrides.toml,
1501
+ stylistic: stylisticOptions
1502
+ }));
1503
+ }
1504
+ if (options.html) {
1505
+ configs.push(html({
1506
+ overrides: overrides.html,
1507
+ stylistic: stylisticOptions
1508
+ }));
1509
+ }
1448
1510
  if (options.unocss)
1449
1511
  configs.push(unocss(options.unocss === true ? {} : options.unocss));
1450
1512
  if (options.tailwindcss)
1451
1513
  configs.push(tailwindcss(options.tailwindcss === true ? {} : options.tailwindcss));
1452
1514
  if (options.markdown) {
1453
- configs.push(markdown({
1454
- componentExts,
1455
- overrides: overrides.markdown
1456
- }));
1515
+ configs.push(
1516
+ markdown({
1517
+ componentExts,
1518
+ overrides: overrides.markdown
1519
+ })
1520
+ );
1457
1521
  }
1458
1522
  return configs;
1459
1523
  };
@@ -1479,6 +1543,7 @@ function resolveOptions(options = {}) {
1479
1543
  test: test2 = true,
1480
1544
  jsonc: jsonc2 = true,
1481
1545
  yaml: yaml2 = true,
1546
+ toml: toml2 = true,
1482
1547
  markdown: markdown2 = true,
1483
1548
  html: html2 = true,
1484
1549
  unocss: enableUnocss = false,
@@ -1507,6 +1572,7 @@ function resolveOptions(options = {}) {
1507
1572
  jsx,
1508
1573
  test: test2,
1509
1574
  jsonc: jsonc2,
1575
+ toml: toml2,
1510
1576
  yaml: yaml2,
1511
1577
  markdown: markdown2,
1512
1578
  unocss: unocss2,
@@ -1572,16 +1638,20 @@ var src_default = eslintFlatConfig;
1572
1638
  GLOB_LESS,
1573
1639
  GLOB_MARKDOWN,
1574
1640
  GLOB_MARKDOWN_CODE,
1641
+ GLOB_MARKDOWN_IN_MARKDOWN,
1642
+ GLOB_POSTCSS,
1575
1643
  GLOB_SCSS,
1576
1644
  GLOB_SRC,
1577
1645
  GLOB_SRC_EXT,
1578
1646
  GLOB_STYLE,
1579
1647
  GLOB_SVELTE,
1580
1648
  GLOB_TESTS,
1649
+ GLOB_TOML,
1581
1650
  GLOB_TS,
1582
1651
  GLOB_TSX,
1583
1652
  GLOB_VUE,
1584
1653
  GLOB_YAML,
1654
+ StylisticConfigDefaults,
1585
1655
  combine,
1586
1656
  comments,
1587
1657
  createConfig,
@@ -1610,6 +1680,7 @@ var src_default = eslintFlatConfig;
1610
1680
  tailwindcss,
1611
1681
  test,
1612
1682
  toArray,
1683
+ toml,
1613
1684
  typescript,
1614
1685
  unicorn,
1615
1686
  unocss,
package/dist/index.d.cts CHANGED
@@ -141,10 +141,6 @@ interface OptionsConfig extends OptionsComponentExts {
141
141
  * @default auto-detect based on the dependencies
142
142
  */
143
143
  typescript?: boolean | OptionsTypeScriptWithTypes | OptionsTypeScriptParserOptions;
144
- /**
145
- * Enable HTML support.
146
- */
147
- html?: boolean;
148
144
  /**
149
145
  * Enable JSX related rules.
150
146
  *
@@ -165,6 +161,10 @@ interface OptionsConfig extends OptionsComponentExts {
165
161
  * @default true
166
162
  */
167
163
  jsonc?: boolean;
164
+ /**
165
+ * Enable TOML support.
166
+ */
167
+ toml?: boolean;
168
168
  /**
169
169
  * Enable YAML support.
170
170
  *
@@ -174,9 +174,14 @@ interface OptionsConfig extends OptionsComponentExts {
174
174
  /**
175
175
  * Enable Markdown support.
176
176
  *
177
+ *
177
178
  * @default true
178
179
  */
179
180
  markdown?: boolean;
181
+ /**
182
+ * Enable HTML support.
183
+ */
184
+ html?: boolean;
180
185
  /**
181
186
  * Enable stylistic rules.
182
187
  *
@@ -215,6 +220,7 @@ interface OptionsConfig extends OptionsComponentExts {
215
220
  jsonc?: FlatConfigItem['rules'];
216
221
  markdown?: FlatConfigItem['rules'];
217
222
  yaml?: FlatConfigItem['rules'];
223
+ toml?: FlatConfigItem['rules'];
218
224
  vue?: FlatConfigItem['rules'];
219
225
  react?: FlatConfigItem['rules'];
220
226
  nextjs?: FlatConfigItem['rules'];
@@ -247,14 +253,17 @@ declare const GLOB_TS = "**/*.?([cm])ts";
247
253
  declare const GLOB_TSX = "**/*.?([cm])tsx";
248
254
  declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
249
255
  declare const GLOB_CSS = "**/*.css";
256
+ declare const GLOB_POSTCSS = "**/*.{p,post}css";
250
257
  declare const GLOB_LESS = "**/*.less";
251
258
  declare const GLOB_SCSS = "**/*.scss";
252
259
  declare const GLOB_JSON = "**/*.json";
253
260
  declare const GLOB_JSON5 = "**/*.json5";
254
261
  declare const GLOB_JSONC = "**/*.jsonc";
255
262
  declare const GLOB_MARKDOWN = "**/*.md";
263
+ declare const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
256
264
  declare const GLOB_VUE = "**/*.vue";
257
265
  declare const GLOB_YAML = "**/*.y?(a)ml";
266
+ declare const GLOB_TOML = "**/*.toml";
258
267
  declare const GLOB_HTML = "**/*.htm?(l)";
259
268
  declare const GLOB_ASTRO = "**/*.astro";
260
269
  declare const GLOB_SVELTE = "**/*.svelte";
@@ -292,6 +301,7 @@ declare function sortPackageJson(): Promise<FlatConfigItem[]>;
292
301
  */
293
302
  declare function sortTsconfig(): FlatConfigItem[];
294
303
 
304
+ declare const StylisticConfigDefaults: StylisticConfig;
295
305
  declare function stylistic(options?: StylisticConfig): Promise<FlatConfigItem[]>;
296
306
 
297
307
  declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
@@ -315,6 +325,8 @@ declare function tailwindcss(options?: OptionsTailwindCSS): Promise<FlatConfigIt
315
325
 
316
326
  declare function html(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
317
327
 
328
+ declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
329
+
318
330
  declare const defaultPreset: PresetItem;
319
331
 
320
- export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTailwindCSS, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type PresetItem, type Rules, type StylisticConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, createConfig, eslintFlatConfig as default, defaultPreset, html, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, tailwindcss, test, toArray, typescript, unicorn, unocss, yaml };
332
+ export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTailwindCSS, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type PresetItem, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, createConfig, eslintFlatConfig as default, defaultPreset, html, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, yaml };
package/dist/index.d.ts CHANGED
@@ -141,10 +141,6 @@ interface OptionsConfig extends OptionsComponentExts {
141
141
  * @default auto-detect based on the dependencies
142
142
  */
143
143
  typescript?: boolean | OptionsTypeScriptWithTypes | OptionsTypeScriptParserOptions;
144
- /**
145
- * Enable HTML support.
146
- */
147
- html?: boolean;
148
144
  /**
149
145
  * Enable JSX related rules.
150
146
  *
@@ -165,6 +161,10 @@ interface OptionsConfig extends OptionsComponentExts {
165
161
  * @default true
166
162
  */
167
163
  jsonc?: boolean;
164
+ /**
165
+ * Enable TOML support.
166
+ */
167
+ toml?: boolean;
168
168
  /**
169
169
  * Enable YAML support.
170
170
  *
@@ -174,9 +174,14 @@ interface OptionsConfig extends OptionsComponentExts {
174
174
  /**
175
175
  * Enable Markdown support.
176
176
  *
177
+ *
177
178
  * @default true
178
179
  */
179
180
  markdown?: boolean;
181
+ /**
182
+ * Enable HTML support.
183
+ */
184
+ html?: boolean;
180
185
  /**
181
186
  * Enable stylistic rules.
182
187
  *
@@ -215,6 +220,7 @@ interface OptionsConfig extends OptionsComponentExts {
215
220
  jsonc?: FlatConfigItem['rules'];
216
221
  markdown?: FlatConfigItem['rules'];
217
222
  yaml?: FlatConfigItem['rules'];
223
+ toml?: FlatConfigItem['rules'];
218
224
  vue?: FlatConfigItem['rules'];
219
225
  react?: FlatConfigItem['rules'];
220
226
  nextjs?: FlatConfigItem['rules'];
@@ -247,14 +253,17 @@ declare const GLOB_TS = "**/*.?([cm])ts";
247
253
  declare const GLOB_TSX = "**/*.?([cm])tsx";
248
254
  declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
249
255
  declare const GLOB_CSS = "**/*.css";
256
+ declare const GLOB_POSTCSS = "**/*.{p,post}css";
250
257
  declare const GLOB_LESS = "**/*.less";
251
258
  declare const GLOB_SCSS = "**/*.scss";
252
259
  declare const GLOB_JSON = "**/*.json";
253
260
  declare const GLOB_JSON5 = "**/*.json5";
254
261
  declare const GLOB_JSONC = "**/*.jsonc";
255
262
  declare const GLOB_MARKDOWN = "**/*.md";
263
+ declare const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
256
264
  declare const GLOB_VUE = "**/*.vue";
257
265
  declare const GLOB_YAML = "**/*.y?(a)ml";
266
+ declare const GLOB_TOML = "**/*.toml";
258
267
  declare const GLOB_HTML = "**/*.htm?(l)";
259
268
  declare const GLOB_ASTRO = "**/*.astro";
260
269
  declare const GLOB_SVELTE = "**/*.svelte";
@@ -292,6 +301,7 @@ declare function sortPackageJson(): Promise<FlatConfigItem[]>;
292
301
  */
293
302
  declare function sortTsconfig(): FlatConfigItem[];
294
303
 
304
+ declare const StylisticConfigDefaults: StylisticConfig;
295
305
  declare function stylistic(options?: StylisticConfig): Promise<FlatConfigItem[]>;
296
306
 
297
307
  declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
@@ -315,6 +325,8 @@ declare function tailwindcss(options?: OptionsTailwindCSS): Promise<FlatConfigIt
315
325
 
316
326
  declare function html(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
317
327
 
328
+ declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
329
+
318
330
  declare const defaultPreset: PresetItem;
319
331
 
320
- export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTailwindCSS, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type PresetItem, type Rules, type StylisticConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, createConfig, eslintFlatConfig as default, defaultPreset, html, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, tailwindcss, test, toArray, typescript, unicorn, unocss, yaml };
332
+ export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTailwindCSS, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type PresetItem, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, createConfig, eslintFlatConfig as default, defaultPreset, html, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, yaml };
package/dist/index.js CHANGED
@@ -59,14 +59,17 @@ var GLOB_TS = "**/*.?([cm])ts";
59
59
  var GLOB_TSX = "**/*.?([cm])tsx";
60
60
  var GLOB_STYLE = "**/*.{c,le,sc}ss";
61
61
  var GLOB_CSS = "**/*.css";
62
+ var GLOB_POSTCSS = "**/*.{p,post}css";
62
63
  var GLOB_LESS = "**/*.less";
63
64
  var GLOB_SCSS = "**/*.scss";
64
65
  var GLOB_JSON = "**/*.json";
65
66
  var GLOB_JSON5 = "**/*.json5";
66
67
  var GLOB_JSONC = "**/*.jsonc";
67
68
  var GLOB_MARKDOWN = "**/*.md";
69
+ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
68
70
  var GLOB_VUE = "**/*.vue";
69
71
  var GLOB_YAML = "**/*.y?(a)ml";
72
+ var GLOB_TOML = "**/*.toml";
70
73
  var GLOB_HTML = "**/*.htm?(l)";
71
74
  var GLOB_ASTRO = "**/*.astro";
72
75
  var GLOB_SVELTE = "**/*.svelte";
@@ -496,12 +499,12 @@ async function markdown(options = {}) {
496
499
  files = [GLOB_MARKDOWN],
497
500
  overrides = {}
498
501
  } = options;
502
+ const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
499
503
  return [
500
504
  {
501
505
  name: "config:markdown:setup",
502
506
  plugins: {
503
- // @ts-expect-error missing types
504
- markdown: await interopDefault(import("eslint-plugin-markdown"))
507
+ markdown: markdown2
505
508
  }
506
509
  },
507
510
  {
@@ -521,9 +524,8 @@ async function markdown(options = {}) {
521
524
  }
522
525
  }
523
526
  },
524
- name: "config:markdown:rules",
527
+ name: "config:markdown:disables",
525
528
  rules: {
526
- "antfu/no-ts-export-equal": "off",
527
529
  "import/newline-after-import": "off",
528
530
  "no-alert": "off",
529
531
  "no-console": "off",
@@ -811,13 +813,22 @@ function sortTsconfig() {
811
813
  }
812
814
 
813
815
  // src/configs/stylistic.ts
816
+ var StylisticConfigDefaults = {
817
+ indent: 2,
818
+ jsx: true,
819
+ quotes: "single",
820
+ semi: false
821
+ };
814
822
  async function stylistic(options = {}) {
815
823
  const {
816
- indent = 2,
817
- jsx = true,
818
- quotes = "single",
819
- semi = false
820
- } = options;
824
+ indent,
825
+ jsx,
826
+ quotes,
827
+ semi
828
+ } = {
829
+ ...StylisticConfigDefaults,
830
+ ...options
831
+ };
821
832
  const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
822
833
  const config = pluginStylistic.configs.customize({
823
834
  flat: true,
@@ -838,7 +849,6 @@ async function stylistic(options = {}) {
838
849
  ...config.rules,
839
850
  "antfu/consistent-list-newline": "error",
840
851
  "antfu/if-newline": "error",
841
- "antfu/indent-binary-ops": ["error", { indent }],
842
852
  "antfu/top-level-function": "error",
843
853
  "curly": ["error", "multi-or-nest", "consistent"]
844
854
  }
@@ -922,8 +932,6 @@ async function typescript(options = {}) {
922
932
  "@typescript-eslint/",
923
933
  "ts/"
924
934
  ),
925
- "antfu/generic-spacing": "error",
926
- "antfu/named-tuple-spacing": "error",
927
935
  "no-dupe-class-members": "off",
928
936
  "no-loss-of-precision": "off",
929
937
  "no-redeclare": "off",
@@ -1275,6 +1283,49 @@ async function html(options = {}) {
1275
1283
  ];
1276
1284
  }
1277
1285
 
1286
+ // src/configs/toml.ts
1287
+ async function toml(options = {}) {
1288
+ const {
1289
+ files = [GLOB_TOML],
1290
+ overrides = {},
1291
+ stylistic: stylistic2 = true
1292
+ } = options;
1293
+ const {
1294
+ indent = 2
1295
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1296
+ const [
1297
+ pluginToml,
1298
+ parserToml
1299
+ ] = await Promise.all([
1300
+ interopDefault(import("eslint-plugin-toml")),
1301
+ interopDefault(import("toml-eslint-parser"))
1302
+ ]);
1303
+ return [
1304
+ {
1305
+ name: "config:toml:setup",
1306
+ plugins: {
1307
+ toml: pluginToml
1308
+ }
1309
+ },
1310
+ {
1311
+ files,
1312
+ languageOptions: {
1313
+ parser: parserToml
1314
+ },
1315
+ name: "config:toml:rules",
1316
+ rules: {
1317
+ ...pluginToml.configs.standard.rules,
1318
+ ...pluginToml.configs.recommended.rules,
1319
+ "style/spaced-comment": "off",
1320
+ ...stylistic2 ? {
1321
+ "toml/indent": ["error", indent === "tab" ? 2 : indent]
1322
+ } : {},
1323
+ ...overrides
1324
+ }
1325
+ }
1326
+ ];
1327
+ }
1328
+
1278
1329
  // src/preset.ts
1279
1330
  var defaultPreset = (options) => {
1280
1331
  const {
@@ -1342,27 +1393,35 @@ var defaultPreset = (options) => {
1342
1393
  sortTsconfig()
1343
1394
  );
1344
1395
  }
1345
- if (options.html) {
1346
- configs.push(html({
1347
- overrides: overrides.html,
1348
- stylistic: stylisticOptions
1349
- }));
1350
- }
1351
1396
  if (options.yaml) {
1352
1397
  configs.push(yaml({
1353
1398
  overrides: overrides.yaml,
1354
1399
  stylistic: stylisticOptions
1355
1400
  }));
1356
1401
  }
1402
+ if (options.toml) {
1403
+ configs.push(toml({
1404
+ overrides: overrides.toml,
1405
+ stylistic: stylisticOptions
1406
+ }));
1407
+ }
1408
+ if (options.html) {
1409
+ configs.push(html({
1410
+ overrides: overrides.html,
1411
+ stylistic: stylisticOptions
1412
+ }));
1413
+ }
1357
1414
  if (options.unocss)
1358
1415
  configs.push(unocss(options.unocss === true ? {} : options.unocss));
1359
1416
  if (options.tailwindcss)
1360
1417
  configs.push(tailwindcss(options.tailwindcss === true ? {} : options.tailwindcss));
1361
1418
  if (options.markdown) {
1362
- configs.push(markdown({
1363
- componentExts,
1364
- overrides: overrides.markdown
1365
- }));
1419
+ configs.push(
1420
+ markdown({
1421
+ componentExts,
1422
+ overrides: overrides.markdown
1423
+ })
1424
+ );
1366
1425
  }
1367
1426
  return configs;
1368
1427
  };
@@ -1388,6 +1447,7 @@ function resolveOptions(options = {}) {
1388
1447
  test: test2 = true,
1389
1448
  jsonc: jsonc2 = true,
1390
1449
  yaml: yaml2 = true,
1450
+ toml: toml2 = true,
1391
1451
  markdown: markdown2 = true,
1392
1452
  html: html2 = true,
1393
1453
  unocss: enableUnocss = false,
@@ -1416,6 +1476,7 @@ function resolveOptions(options = {}) {
1416
1476
  jsx,
1417
1477
  test: test2,
1418
1478
  jsonc: jsonc2,
1479
+ toml: toml2,
1419
1480
  yaml: yaml2,
1420
1481
  markdown: markdown2,
1421
1482
  unocss: unocss2,
@@ -1480,16 +1541,20 @@ export {
1480
1541
  GLOB_LESS,
1481
1542
  GLOB_MARKDOWN,
1482
1543
  GLOB_MARKDOWN_CODE,
1544
+ GLOB_MARKDOWN_IN_MARKDOWN,
1545
+ GLOB_POSTCSS,
1483
1546
  GLOB_SCSS,
1484
1547
  GLOB_SRC,
1485
1548
  GLOB_SRC_EXT,
1486
1549
  GLOB_STYLE,
1487
1550
  GLOB_SVELTE,
1488
1551
  GLOB_TESTS,
1552
+ GLOB_TOML,
1489
1553
  GLOB_TS,
1490
1554
  GLOB_TSX,
1491
1555
  GLOB_VUE,
1492
1556
  GLOB_YAML,
1557
+ StylisticConfigDefaults,
1493
1558
  combine,
1494
1559
  comments,
1495
1560
  createConfig,
@@ -1519,6 +1584,7 @@ export {
1519
1584
  tailwindcss,
1520
1585
  test,
1521
1586
  toArray,
1587
+ toml,
1522
1588
  typescript,
1523
1589
  unicorn,
1524
1590
  unocss,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pengzhanbo/eslint-config",
3
3
  "type": "module",
4
- "version": "1.2.5",
4
+ "version": "1.3.1",
5
5
  "author": "pengzhanbo <q942450674@outlook.com> (https://github/pengzhanbo/)",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/pengzhanbo/configs#readme",
@@ -20,7 +20,7 @@
20
20
  "default": "./dist/index.js"
21
21
  },
22
22
  "require": {
23
- "types": "./dist/index.d.ts",
23
+ "types": "./dist/index.d.cts",
24
24
  "default": "./dist/index.cjs"
25
25
  }
26
26
  },
@@ -51,11 +51,11 @@
51
51
  "@eslint-types/unicorn": "^49.0.0",
52
52
  "@html-eslint/eslint-plugin": "^0.21.0",
53
53
  "@html-eslint/parser": "^0.21.0",
54
- "@stylistic/eslint-plugin": "^1.4.1",
55
- "@typescript-eslint/eslint-plugin": "^6.13.1",
56
- "@typescript-eslint/parser": "^6.13.1",
54
+ "@stylistic/eslint-plugin": "^1.5.0",
55
+ "@typescript-eslint/eslint-plugin": "^6.13.2",
56
+ "@typescript-eslint/parser": "^6.13.2",
57
57
  "eslint-config-flat-gitignore": "^0.1.2",
58
- "eslint-plugin-antfu": "^1.0.13",
58
+ "eslint-plugin-antfu": "^2.0.0",
59
59
  "eslint-plugin-eslint-comments": "^3.2.0",
60
60
  "eslint-plugin-i": "^2.29.0",
61
61
  "eslint-plugin-jsdoc": "^46.9.0",
@@ -64,6 +64,7 @@
64
64
  "eslint-plugin-n": "^16.3.1",
65
65
  "eslint-plugin-no-only-tests": "^3.1.0",
66
66
  "eslint-plugin-perfectionist": "^2.5.0",
67
+ "eslint-plugin-toml": "^0.7.1",
67
68
  "eslint-plugin-unicorn": "^49.0.0",
68
69
  "eslint-plugin-unused-imports": "^3.0.0",
69
70
  "eslint-plugin-vitest": "^0.3.10",
@@ -72,6 +73,7 @@
72
73
  "jsonc-eslint-parser": "^2.4.0",
73
74
  "local-pkg": "^0.5.0",
74
75
  "parse-gitignore": "^2.0.0",
76
+ "toml-eslint-parser": "^0.9.3",
75
77
  "yaml-eslint-parser": "^1.2.2"
76
78
  },
77
79
  "devDependencies": {