@vinicunca/eslint-config 2.0.9 → 2.0.12

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/dist/index.js CHANGED
@@ -1,58 +1,4 @@
1
- // src/base.ts
2
- import { isPackageExists } from "local-pkg";
3
- import process3 from "process";
4
-
5
- // src/flags.ts
6
- var ERROR = "error";
7
- var OFF = "off";
8
- var WARN = "warn";
9
- var CONSISTENT = "consistent";
10
- var NEVER = "never";
11
- var ALWAYS = "always";
12
-
13
- // src/plugins.ts
14
- import { default as default2 } from "@stylistic/eslint-plugin";
15
- import { default as default3 } from "@typescript-eslint/eslint-plugin";
16
- import * as parserTs from "@typescript-eslint/parser";
17
- import { default as default4 } from "@vinicunca/eslint-plugin-vinicunca";
18
- import { default as default5 } from "eslint-plugin-eslint-comments";
19
- import * as pluginImport from "eslint-plugin-i";
20
- import { default as default6 } from "eslint-plugin-jsdoc";
21
- import * as pluginJsonc from "eslint-plugin-jsonc";
22
- import { default as default7 } from "eslint-plugin-markdown";
23
- import { default as default8 } from "eslint-plugin-n";
24
- import { default as default9 } from "eslint-plugin-no-only-tests";
25
- import { default as default10 } from "eslint-plugin-perfectionist";
26
- import { default as default11 } from "eslint-plugin-react";
27
- import { default as default12 } from "eslint-plugin-react-hooks";
28
- import { default as default13 } from "eslint-plugin-unicorn";
29
- import { default as default14 } from "eslint-plugin-unused-imports";
30
- import { default as default15 } from "eslint-plugin-vitest";
31
- import { default as default16 } from "eslint-plugin-vue";
32
- import * as pluginYaml from "eslint-plugin-yml";
33
- import { default as default17 } from "jsonc-eslint-parser";
34
- import { default as default18 } from "vue-eslint-parser";
35
- import { default as default19 } from "yaml-eslint-parser";
36
-
37
- // src/configs/comments.ts
38
- function comments() {
39
- return [
40
- {
41
- name: "vinicunca:eslint-comments",
42
- plugins: {
43
- "eslint-comments": default5
44
- },
45
- rules: {
46
- "eslint-comments/no-aggregating-enable": ERROR,
47
- "eslint-comments/no-duplicate-disable": ERROR,
48
- "eslint-comments/no-unlimited-disable": ERROR,
49
- "eslint-comments/no-unused-enable": ERROR
50
- }
51
- }
52
- ];
53
- }
54
-
55
- // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.10/node_modules/@vinicunca/perkakas/dist/index.js
1
+ // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.11/node_modules/@vinicunca/perkakas/dist/index.js
56
2
  function purry(fn, args, lazy) {
57
3
  const diff = fn.length - args.length;
58
4
  const arrayArgs = Array.from(args);
@@ -72,6 +18,9 @@ function purry(fn, args, lazy) {
72
18
  function isArray(data) {
73
19
  return Array.isArray(data);
74
20
  }
21
+ function isBoolean(data) {
22
+ return typeof data === "boolean";
23
+ }
75
24
  function isDefined(data) {
76
25
  return typeof data !== "undefined" && data !== null;
77
26
  }
@@ -1026,6 +975,45 @@ function toPairs(object) {
1026
975
  toPairs2.strict = strict;
1027
976
  })(toPairs || (toPairs = {}));
1028
977
 
978
+ // src/base.ts
979
+ import { isPackageExists } from "local-pkg";
980
+ import process3 from "process";
981
+
982
+ // src/flags.ts
983
+ var ERROR = "error";
984
+ var OFF = "off";
985
+ var WARN = "warn";
986
+ var CONSISTENT = "consistent";
987
+ var NEVER = "never";
988
+ var ALWAYS = "always";
989
+
990
+ // src/plugins.ts
991
+ import { default as default2 } from "@vinicunca/eslint-plugin-vinicunca";
992
+ import { default as default3 } from "eslint-plugin-eslint-comments";
993
+ import * as pluginImport from "eslint-plugin-i";
994
+ import { default as default4 } from "eslint-plugin-n";
995
+ import { default as default5 } from "eslint-plugin-perfectionist";
996
+ import { default as default6 } from "eslint-plugin-unicorn";
997
+ import { default as default7 } from "eslint-plugin-unused-imports";
998
+
999
+ // src/configs/comments.ts
1000
+ async function comments() {
1001
+ return [
1002
+ {
1003
+ name: "vinicunca:eslint-comments",
1004
+ plugins: {
1005
+ "eslint-comments": default3
1006
+ },
1007
+ rules: {
1008
+ "eslint-comments/no-aggregating-enable": ERROR,
1009
+ "eslint-comments/no-duplicate-disable": ERROR,
1010
+ "eslint-comments/no-unlimited-disable": ERROR,
1011
+ "eslint-comments/no-unused-enable": ERROR
1012
+ }
1013
+ }
1014
+ ];
1015
+ }
1016
+
1029
1017
  // src/configs/ignores.ts
1030
1018
  import fs from "fs";
1031
1019
  import parseGitignore from "parse-gitignore";
@@ -1044,6 +1032,10 @@ var GLOB_EXCLUDE = [
1044
1032
  "**/output",
1045
1033
  "**/coverage",
1046
1034
  "**/temp",
1035
+ "**/.temp",
1036
+ "**/tmp",
1037
+ "**/.tmp",
1038
+ "**/.history",
1047
1039
  "**/.vitepress/cache",
1048
1040
  "**/.nuxt",
1049
1041
  "**/.next",
@@ -1075,10 +1067,11 @@ var GLOB_JSON5 = "**/*.json5";
1075
1067
  var GLOB_JSONC = "**/*.jsonc";
1076
1068
  var GLOB_YAML = "**/*.y?(a)ml";
1077
1069
  var GLOB_MARKDOWN = "**/*.md";
1070
+ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
1078
1071
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
1079
1072
 
1080
1073
  // src/configs/ignores.ts
1081
- function ignores({
1074
+ async function ignores({
1082
1075
  enableGitignore = true,
1083
1076
  items = [],
1084
1077
  replace = false
@@ -1110,13 +1103,13 @@ function ignores({
1110
1103
  }
1111
1104
 
1112
1105
  // src/configs/imports.ts
1113
- function imports() {
1106
+ async function imports() {
1114
1107
  return [
1115
1108
  {
1116
1109
  name: "vinicunca:imports",
1117
1110
  plugins: {
1118
1111
  import: pluginImport,
1119
- vinicunca: default4
1112
+ vinicunca: default2
1120
1113
  },
1121
1114
  rules: {
1122
1115
  "import/export": ERROR,
@@ -1141,7 +1134,7 @@ function imports() {
1141
1134
 
1142
1135
  // src/configs/javascript.ts
1143
1136
  import globals from "globals";
1144
- function javascript(options = {}) {
1137
+ async function javascript(options = {}) {
1145
1138
  const {
1146
1139
  isInEditor = false,
1147
1140
  overrides = {}
@@ -1158,7 +1151,9 @@ function javascript(options = {}) {
1158
1151
  window: "readonly"
1159
1152
  },
1160
1153
  parserOptions: {
1161
- ecmaFeatures: { jsx: true },
1154
+ ecmaFeatures: {
1155
+ jsx: true
1156
+ },
1162
1157
  ecmaVersion: 2022,
1163
1158
  sourceType: "module"
1164
1159
  },
@@ -1169,9 +1164,9 @@ function javascript(options = {}) {
1169
1164
  },
1170
1165
  name: "vinicunca:javascript",
1171
1166
  plugins: {
1172
- "perfectionist": default10,
1173
- "unused-imports": default14,
1174
- "vinicunca": default4
1167
+ "perfectionist": default5,
1168
+ "unused-imports": default7,
1169
+ "vinicunca": default2
1175
1170
  },
1176
1171
  rules: {
1177
1172
  "accessor-pairs": [ERROR, {
@@ -1179,7 +1174,6 @@ function javascript(options = {}) {
1179
1174
  setWithoutGet: true
1180
1175
  }],
1181
1176
  "array-callback-return": [ERROR, { checkForEach: true }],
1182
- "arrow-parens": [ERROR, ALWAYS],
1183
1177
  "block-scoped-var": ERROR,
1184
1178
  "camelcase": [ERROR, {
1185
1179
  allow: ["^UNSAFE_"],
@@ -1392,8 +1386,8 @@ function javascript(options = {}) {
1392
1386
  }],
1393
1387
  "vars-on-top": ERROR,
1394
1388
  "yoda": [ERROR, NEVER],
1395
- ...default4.configs.recommended.rules,
1396
- ...default10.configs["recommended-natural"].rules,
1389
+ ...default2.configs.recommended.rules,
1390
+ ...default5.configs["recommended-natural"].rules,
1397
1391
  "perfectionist/sort-imports": [
1398
1392
  ERROR,
1399
1393
  {
@@ -1430,13 +1424,35 @@ function javascript(options = {}) {
1430
1424
  ];
1431
1425
  }
1432
1426
 
1427
+ // src/utils.ts
1428
+ async function combineConfigs(...configs) {
1429
+ const resolvedConfigs = await Promise.all(configs);
1430
+ return resolvedConfigs.flatMap((config) => Array.isArray(config) ? config : [config]);
1431
+ }
1432
+ function renameRules(rules, from, to) {
1433
+ return Object.fromEntries(
1434
+ Object.entries(rules).map(([key, value]) => {
1435
+ if (key.startsWith(from)) {
1436
+ return [to + key.slice(from.length), value];
1437
+ }
1438
+ ;
1439
+ return [key, value];
1440
+ })
1441
+ );
1442
+ }
1443
+ async function interopDefault(m) {
1444
+ const resolved = await m;
1445
+ return resolved.default || resolved;
1446
+ }
1447
+
1433
1448
  // src/configs/jsdoc.ts
1434
- function jsdoc() {
1449
+ async function jsdoc() {
1435
1450
  return [
1436
1451
  {
1437
1452
  name: "vinicunca:jsdoc",
1438
1453
  plugins: {
1439
- jsdoc: default6
1454
+ // @ts-expect-error missing types
1455
+ jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
1440
1456
  },
1441
1457
  rules: {
1442
1458
  "jsdoc/check-access": WARN,
@@ -1464,10 +1480,22 @@ function jsdoc() {
1464
1480
  }
1465
1481
 
1466
1482
  // src/configs/jsonc.ts
1467
- function jsonc(options = {}) {
1483
+ async function jsonc(options = {}) {
1468
1484
  const {
1469
- overrides = {}
1485
+ files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1486
+ overrides = {},
1487
+ stylistic: stylistic2 = true
1470
1488
  } = options;
1489
+ const {
1490
+ indent = 2
1491
+ } = isBoolean(stylistic2) ? {} : stylistic2;
1492
+ const [
1493
+ pluginJsonc,
1494
+ parserJsonc
1495
+ ] = await Promise.all([
1496
+ interopDefault(import("eslint-plugin-jsonc")),
1497
+ interopDefault(import("jsonc-eslint-parser"))
1498
+ ]);
1471
1499
  return [
1472
1500
  {
1473
1501
  name: "vinicunca:jsonc:setup",
@@ -1476,17 +1504,12 @@ function jsonc(options = {}) {
1476
1504
  }
1477
1505
  },
1478
1506
  {
1479
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1507
+ files,
1480
1508
  languageOptions: {
1481
- parser: default17
1509
+ parser: parserJsonc
1482
1510
  },
1483
1511
  name: "vinicunca:jsonc:rules",
1484
1512
  rules: {
1485
- "jsonc/array-bracket-spacing": [ERROR, NEVER],
1486
- "jsonc/comma-dangle": [ERROR, NEVER],
1487
- "jsonc/comma-style": [ERROR, "last"],
1488
- "jsonc/indent": [ERROR, 2],
1489
- "jsonc/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
1490
1513
  "jsonc/no-bigint-literals": ERROR,
1491
1514
  "jsonc/no-binary-expression": ERROR,
1492
1515
  "jsonc/no-binary-numeric-literals": ERROR,
@@ -1510,14 +1533,21 @@ function jsonc(options = {}) {
1510
1533
  "jsonc/no-undefined-value": ERROR,
1511
1534
  "jsonc/no-unicode-codepoint-escapes": ERROR,
1512
1535
  "jsonc/no-useless-escape": ERROR,
1513
- "jsonc/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
1514
- "jsonc/object-curly-spacing": [ERROR, "always"],
1515
- "jsonc/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
1516
- "jsonc/quote-props": ERROR,
1517
- "jsonc/quotes": ERROR,
1518
1536
  "jsonc/space-unary-ops": ERROR,
1519
1537
  "jsonc/valid-json-number": ERROR,
1520
1538
  "jsonc/vue-custom-block/no-parsing-error": ERROR,
1539
+ ...stylistic2 ? {
1540
+ "jsonc/array-bracket-spacing": [ERROR, NEVER],
1541
+ "jsonc/comma-dangle": [ERROR, NEVER],
1542
+ "jsonc/comma-style": [ERROR, "last"],
1543
+ "jsonc/indent": [ERROR, indent],
1544
+ "jsonc/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
1545
+ "jsonc/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
1546
+ "jsonc/object-curly-spacing": [ERROR, "always"],
1547
+ "jsonc/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
1548
+ "jsonc/quote-props": ERROR,
1549
+ "jsonc/quotes": ERROR
1550
+ } : {},
1521
1551
  ...overrides
1522
1552
  }
1523
1553
  }
@@ -1525,18 +1555,26 @@ function jsonc(options = {}) {
1525
1555
  }
1526
1556
 
1527
1557
  // src/configs/markdown.ts
1528
- function markdown(options = {}) {
1558
+ async function markdown(options = {}) {
1529
1559
  const {
1530
1560
  componentExts = [],
1561
+ files = [GLOB_MARKDOWN],
1531
1562
  overrides = {}
1532
1563
  } = options;
1533
1564
  return [
1534
1565
  {
1535
1566
  name: "vinicunca:markdown:setup",
1536
1567
  plugins: {
1537
- markdown: default7
1568
+ // @ts-expect-error missing types
1569
+ markdown: await interopDefault(import("eslint-plugin-markdown"))
1538
1570
  }
1539
1571
  },
1572
+ {
1573
+ files,
1574
+ ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
1575
+ name: "vinicunca:markdown:processor",
1576
+ processor: "markdown/markdown"
1577
+ },
1540
1578
  {
1541
1579
  files: [GLOB_MARKDOWN],
1542
1580
  name: "vinicunca:markdown:processor",
@@ -1554,8 +1592,9 @@ function markdown(options = {}) {
1554
1592
  }
1555
1593
  }
1556
1594
  },
1557
- name: "vinicunca:markdown:rules",
1595
+ name: "vinicunca:markdown:disables",
1558
1596
  rules: {
1597
+ "import/newline-after-import": OFF,
1559
1598
  "no-alert": OFF,
1560
1599
  "no-console": OFF,
1561
1600
  "no-undef": OFF,
@@ -1602,12 +1641,12 @@ function markdown(options = {}) {
1602
1641
  }
1603
1642
 
1604
1643
  // src/configs/node.ts
1605
- function node() {
1644
+ async function node() {
1606
1645
  return [
1607
1646
  {
1608
1647
  name: "vinicunca:node",
1609
1648
  plugins: {
1610
- node: default8
1649
+ node: default4
1611
1650
  },
1612
1651
  rules: {
1613
1652
  "node/handle-callback-err": [ERROR, "^(err|error)$"],
@@ -1626,23 +1665,46 @@ function node() {
1626
1665
 
1627
1666
  // src/configs/react.ts
1628
1667
  var STR_PARENS_NEW_LINE = "parens-new-line";
1629
- function react(options = {}) {
1668
+ async function react(options = {}) {
1630
1669
  const {
1670
+ files = [GLOB_JSX, GLOB_TSX],
1631
1671
  overrides = {}
1632
1672
  } = options;
1673
+ const [
1674
+ pluginReact,
1675
+ pluginReactHooks
1676
+ ] = await Promise.all([
1677
+ // @ts-expect-error missing types
1678
+ interopDefault(import("eslint-plugin-react")),
1679
+ // @ts-expect-error missing types
1680
+ interopDefault(import("eslint-plugin-react-hooks"))
1681
+ ]);
1633
1682
  return [
1634
1683
  {
1635
1684
  name: "vinicunca:react:setup",
1636
1685
  plugins: {
1637
- "react": default11,
1638
- "react-hooks": default12
1686
+ "react": pluginReact,
1687
+ "react-hooks": pluginReactHooks
1688
+ },
1689
+ settings: {
1690
+ react: {
1691
+ version: "detect"
1692
+ }
1639
1693
  }
1640
1694
  },
1641
1695
  {
1696
+ files,
1697
+ languageOptions: {
1698
+ parserOptions: {
1699
+ ecmaFeatures: {
1700
+ jsx: true
1701
+ }
1702
+ }
1703
+ },
1642
1704
  name: "vinicunca:react:rules",
1643
1705
  rules: {
1644
- ...default11.configs.recommended.rules,
1645
- ...default12.configs.recommended.rules,
1706
+ ...pluginReact.configs.recommended.rules,
1707
+ ...pluginReactHooks.configs.recommended.rules,
1646
1708
  "react/boolean-prop-naming": [OFF, {
1647
1709
  message: "",
1648
1710
  propTypeNames: ["bool", "mutuallyExclusiveTrueProps"],
@@ -1702,24 +1764,19 @@ function react(options = {}) {
1702
1764
  return: STR_PARENS_NEW_LINE
1703
1765
  }],
1704
1766
  "react/no-danger": WARN,
1767
+ "react/no-unescaped-entities": OFF,
1705
1768
  "react/prop-types": OFF,
1706
1769
  "react/react-in-jsx-scope": OFF,
1707
1770
  "react/self-closing-comp": ERROR,
1708
1771
  "react/style-prop-object": ERROR,
1709
- "style/jsx-quotes": [ERROR, "prefer-double"],
1710
1772
  ...overrides
1711
- },
1712
- settings: {
1713
- react: {
1714
- version: "detect"
1715
- }
1716
1773
  }
1717
1774
  }
1718
1775
  ];
1719
1776
  }
1720
1777
 
1721
1778
  // src/configs/sort-package-json.ts
1722
- function sortPackageJson() {
1779
+ async function sortPackageJson() {
1723
1780
  return [
1724
1781
  {
1725
1782
  files: ["**/package.json"],
@@ -1935,19 +1992,35 @@ function sortTsconfig() {
1935
1992
  }
1936
1993
 
1937
1994
  // src/configs/stylistic.ts
1938
- function stylistic() {
1995
+ var STYLISTIC_CONFIG_DEFAULTS = {
1996
+ indent: 2,
1997
+ jsx: true,
1998
+ quotes: "single",
1999
+ semi: true
2000
+ };
2001
+ async function stylistic(options = {}) {
2002
+ const {
2003
+ indent,
2004
+ quotes,
2005
+ semi
2006
+ } = {
2007
+ ...STYLISTIC_CONFIG_DEFAULTS,
2008
+ ...options
2009
+ };
2010
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
1939
2011
  return [
1940
2012
  {
1941
2013
  name: "vinicunca:stylistic",
1942
2014
  plugins: {
1943
- style: default2,
1944
- vinicunca: default4
2015
+ style: pluginStylistic,
2016
+ vinicunca: default2
1945
2017
  },
1946
2018
  rules: {
1947
2019
  "curly": [ERROR, "all"],
1948
2020
  "style/array-bracket-newline": [ERROR, CONSISTENT],
1949
2021
  "style/array-bracket-spacing": [ERROR, NEVER],
1950
2022
  "style/array-element-newline": [ERROR, CONSISTENT],
2023
+ "style/arrow-parens": [ERROR, ALWAYS],
1951
2024
  "style/arrow-spacing": [ERROR, { after: true, before: true }],
1952
2025
  "style/block-spacing": [ERROR, ALWAYS],
1953
2026
  "style/brace-style": [ERROR],
@@ -1958,7 +2031,7 @@ function stylistic() {
1958
2031
  "style/dot-location": [ERROR, "property"],
1959
2032
  "style/eol-last": ERROR,
1960
2033
  "style/func-call-spacing": [ERROR, NEVER],
1961
- "style/indent": [ERROR, 2, {
2034
+ "style/indent": [ERROR, indent, {
1962
2035
  ArrayExpression: 1,
1963
2036
  CallExpression: { arguments: 1 },
1964
2037
  FunctionDeclaration: { body: 1, parameters: 1 },
@@ -1996,6 +2069,7 @@ function stylistic() {
1996
2069
  offsetTernaryExpressions: true,
1997
2070
  outerIIFEBody: 1
1998
2071
  }],
2072
+ "style/indent-binary-ops": [ERROR, indent],
1999
2073
  "style/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
2000
2074
  "style/keyword-spacing": [ERROR, { after: true, before: true }],
2001
2075
  "style/lines-between-class-members": [ERROR, ALWAYS, { exceptAfterSingleLine: true }],
@@ -2025,9 +2099,9 @@ function stylistic() {
2025
2099
  "style/operator-linebreak": [ERROR, "before"],
2026
2100
  "style/padded-blocks": [ERROR, { blocks: NEVER, classes: NEVER, switches: NEVER }],
2027
2101
  "style/quote-props": [ERROR, "consistent-as-needed"],
2028
- "style/quotes": [ERROR, "single"],
2102
+ "style/quotes": [ERROR, quotes],
2029
2103
  "style/rest-spread-spacing": [ERROR, NEVER],
2030
- "style/semi": [ERROR, ALWAYS],
2104
+ "style/semi": [ERROR, semi ? ALWAYS : NEVER],
2031
2105
  "style/semi-spacing": [ERROR, { after: true, before: false }],
2032
2106
  "style/space-before-blocks": [ERROR, ALWAYS],
2033
2107
  "style/space-before-function-paren": [ERROR, {
@@ -2071,27 +2145,36 @@ function stylistic() {
2071
2145
  }
2072
2146
 
2073
2147
  // src/configs/test.ts
2074
- function test(options = {}) {
2148
+ async function test(options = {}) {
2075
2149
  const {
2150
+ files = GLOB_TESTS,
2076
2151
  isInEditor = false,
2077
2152
  overrides = {}
2078
2153
  } = options;
2154
+ const [
2155
+ pluginVitest,
2156
+ pluginNoOnlyTests
2157
+ ] = await Promise.all([
2158
+ interopDefault(import("eslint-plugin-vitest")),
2159
+ // @ts-expect-error missing types
2160
+ interopDefault(import("eslint-plugin-no-only-tests"))
2161
+ ]);
2079
2162
  return [
2080
2163
  {
2081
2164
  name: "vinicunca:test:setup",
2082
2165
  plugins: {
2083
2166
  test: {
2084
- ...default15,
2167
+ ...pluginVitest,
2085
2168
  rules: {
2086
- ...default15.rules,
2169
+ ...pluginVitest.rules,
2087
2170
  // extend `test/no-only-tests` rule
2088
- ...default9.rules
2171
+ ...pluginNoOnlyTests.rules
2089
2172
  }
2090
2173
  }
2091
2174
  }
2092
2175
  },
2093
2176
  {
2094
- files: GLOB_TESTS,
2177
+ files,
2095
2178
  name: "vinicunca:test:rules",
2096
2179
  rules: {
2097
2180
  "test/consistent-test-it": [ERROR, { fn: "it", withinDescribe: "it" }],
@@ -2107,31 +2190,17 @@ function test(options = {}) {
2107
2190
 
2108
2191
  // src/configs/typescript.ts
2109
2192
  import process from "process";
2110
-
2111
- // src/utils.ts
2112
- function combineConfigs(...configs) {
2113
- return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
2114
- }
2115
- function renameRules(rules, from, to) {
2116
- return Object.fromEntries(
2117
- Object.entries(rules).map(([key, value]) => {
2118
- if (key.startsWith(from)) {
2119
- return [to + key.slice(from.length), value];
2120
- }
2121
- ;
2122
- return [key, value];
2123
- })
2124
- );
2125
- }
2126
-
2127
- // src/configs/typescript.ts
2128
- function typescript(options) {
2193
+ async function typescript(options = {}) {
2129
2194
  const {
2130
2195
  componentExts = [],
2131
2196
  overrides = {},
2132
2197
  parserOptions = {},
2133
2198
  tsconfigPath = []
2134
2199
  } = options ?? {};
2200
+ const files = options.files ?? [
2201
+ GLOB_SRC,
2202
+ ...componentExts.map((ext) => `**/*.${ext}`)
2203
+ ];
2135
2204
  const typeAwareRules = {
2136
2205
  "dot-notation": OFF,
2137
2206
  "no-implied-eval": OFF,
@@ -2156,21 +2225,28 @@ function typescript(options) {
2156
2225
  };
2157
2226
  additionalTypeAwareRules = typeAwareRules;
2158
2227
  }
2228
+ const [
2229
+ pluginTs,
2230
+ parserTs,
2231
+ pluginStylistic
2232
+ ] = await Promise.all([
2233
+ interopDefault(import("@typescript-eslint/eslint-plugin")),
2234
+ interopDefault(import("@typescript-eslint/parser")),
2235
+ interopDefault(import("@stylistic/eslint-plugin"))
2236
+ ]);
2159
2237
  return [
2160
2238
  {
2161
2239
  // Install the plugins without globs, so they can be configured separately.
2162
2240
  name: "vinicunca:typescript:setup",
2163
2241
  plugins: {
2164
2242
  import: pluginImport,
2165
- ts: default3,
2166
- vinicunca: default4
2243
+ style: pluginStylistic,
2244
+ ts: pluginTs,
2245
+ vinicunca: default2
2167
2246
  }
2168
2247
  },
2169
2248
  {
2170
- files: [
2171
- GLOB_SRC,
2172
- ...componentExts.map((ext) => `**/*.${ext}`)
2173
- ],
2249
+ files,
2174
2250
  languageOptions: {
2175
2251
  parser: parserTs,
2176
2252
  parserOptions: {
@@ -2183,12 +2259,12 @@ function typescript(options) {
2183
2259
  name: "vinicunca:typescript:rules",
2184
2260
  rules: {
2185
2261
  ...renameRules(
2186
- default3.configs["eslint-recommended"].overrides[0].rules,
2262
+ pluginTs.configs["eslint-recommended"].overrides[0].rules,
2187
2263
  "@typescript-eslint/",
2188
2264
  "ts/"
2189
2265
  ),
2190
2266
  ...renameRules(
2191
- default3.configs.strict.rules,
2267
+ pluginTs.configs.strict.rules,
2192
2268
  "@typescript-eslint/",
2193
2269
  "ts/"
2194
2270
  ),
@@ -2199,6 +2275,8 @@ function typescript(options) {
2199
2275
  "no-unused-vars": OFF,
2200
2276
  "no-use-before-define": OFF,
2201
2277
  "no-useless-constructor": OFF,
2278
+ "style/type-generic-spacing": ERROR,
2279
+ "style/type-named-tuple-spacing": ERROR,
2202
2280
  "ts/ban-ts-comment": [ERROR, { "ts-ignore": "allow-with-description" }],
2203
2281
  "ts/ban-types": [ERROR, { types: { Function: false } }],
2204
2282
  "ts/consistent-type-definitions": [ERROR, "interface"],
@@ -2227,8 +2305,6 @@ function typescript(options) {
2227
2305
  "ts/parameter-properties": OFF,
2228
2306
  "ts/prefer-ts-expect-error": ERROR,
2229
2307
  "ts/triple-slash-reference": OFF,
2230
- "vinicunca/generic-spacing": ERROR,
2231
- "vinicunca/named-tuple-spacing": ERROR,
2232
2308
  "vinicunca/no-cjs-exports": ERROR,
2233
2309
  "vinicunca/no-ts-export-equal": ERROR,
2234
2310
  ...additionalTypeAwareRules,
@@ -2263,7 +2339,7 @@ function typescript(options) {
2263
2339
  }
2264
2340
 
2265
2341
  // src/configs/unicorn.ts
2266
- function unicorn(options = {}) {
2342
+ async function unicorn(options = {}) {
2267
2343
  const {
2268
2344
  overrides = {}
2269
2345
  } = options;
@@ -2271,7 +2347,7 @@ function unicorn(options = {}) {
2271
2347
  {
2272
2348
  name: "vinicunca:unicorn",
2273
2349
  plugins: {
2274
- unicorn: default13
2350
+ unicorn: default6
2275
2351
  },
2276
2352
  rules: {
2277
2353
  "unicorn/error-message": ERROR,
@@ -2293,13 +2369,48 @@ function unicorn(options = {}) {
2293
2369
  ];
2294
2370
  }
2295
2371
 
2372
+ // src/configs/unocss.ts
2373
+ async function unocss(options = {}) {
2374
+ const {
2375
+ attributify = false,
2376
+ strict = false
2377
+ } = options;
2378
+ const [
2379
+ pluginUnoCSS
2380
+ ] = await Promise.all([
2381
+ interopDefault(import("@unocss/eslint-plugin"))
2382
+ ]);
2383
+ return [
2384
+ {
2385
+ name: "vinicunca:unocss",
2386
+ plugins: {
2387
+ unocss: pluginUnoCSS
2388
+ },
2389
+ rules: {
2390
+ "unocss/order": "warn",
2391
+ ...attributify ? {
2392
+ "unocss/order-attributify": "warn"
2393
+ } : {},
2394
+ ...strict ? {
2395
+ "unocss/blocklist": "error"
2396
+ } : {}
2397
+ }
2398
+ }
2399
+ ];
2400
+ }
2401
+
2296
2402
  // src/configs/vue.ts
2297
2403
  import process2 from "process";
2298
- function vue(options = {}) {
2404
+ async function vue(options = {}) {
2299
2405
  const {
2406
+ files = [GLOB_VUE],
2300
2407
  overrides = {},
2408
+ stylistic: stylistic2 = true,
2301
2409
  typescript: typescript2 = {}
2302
2410
  } = options;
2411
+ const {
2412
+ indent = 2
2413
+ } = isBoolean(stylistic2) ? {} : stylistic2;
2303
2414
  let tsConfigOptions = {};
2304
2415
  const tsconfigPath = typescript2.tsconfigPath ?? [];
2305
2416
  if (!isEmpty(tsconfigPath)) {
@@ -2308,34 +2419,42 @@ function vue(options = {}) {
2308
2419
  tsconfigRootDir: process2.cwd()
2309
2420
  };
2310
2421
  }
2422
+ const [
2423
+ pluginVue,
2424
+ parserVue
2425
+ ] = await Promise.all([
2426
+ // @ts-expect-error missing types
2427
+ interopDefault(import("eslint-plugin-vue")),
2428
+ interopDefault(import("vue-eslint-parser"))
2429
+ ]);
2311
2430
  return [
2312
2431
  {
2313
2432
  name: "vinicunca:vue:setup",
2314
2433
  plugins: {
2315
- vue: default16
2434
+ vue: pluginVue
2316
2435
  }
2317
2436
  },
2318
2437
  {
2319
- files: [GLOB_VUE],
2438
+ files,
2320
2439
  languageOptions: {
2321
- parser: default18,
2440
+ parser: parserVue,
2322
2441
  parserOptions: {
2323
2442
  ecmaFeatures: {
2324
2443
  jsx: true
2325
2444
  },
2326
2445
  extraFileExtensions: [".vue"],
2327
- parser: typescript2.enabled ? parserTs : void 0,
2446
+ parser: typescript2.enabled ? await interopDefault(import("@typescript-eslint/parser")) : null,
2328
2447
  sourceType: "module",
2329
2448
  ...tsConfigOptions
2330
2449
  }
2331
2450
  },
2332
2451
  name: "vinicunca:vue:rules",
2333
- processor: default16.processors[".vue"],
2452
+ processor: pluginVue.processors[".vue"],
2334
2453
  rules: {
2335
- ...default16.configs.base.rules,
2336
- ...default16.configs["vue3-essential"].rules,
2337
- ...default16.configs["vue3-strongly-recommended"].rules,
2338
- ...default16.configs["vue3-recommended"].rules,
2454
+ ...pluginVue.configs.base.rules,
2455
+ ...pluginVue.configs["vue3-essential"].rules,
2456
+ ...pluginVue.configs["vue3-strongly-recommended"].rules,
2457
+ ...pluginVue.configs["vue3-recommended"].rules,
2339
2458
  "node/prefer-global/process": OFF,
2340
2459
  "vue/array-bracket-spacing": [ERROR, NEVER],
2341
2460
  "vue/arrow-spacing": [ERROR, {
@@ -2369,6 +2488,7 @@ function vue(options = {}) {
2369
2488
  "vue/html-comment-content-spacing": [ERROR, ALWAYS, {
2370
2489
  exceptions: ["-"]
2371
2490
  }],
2491
+ "vue/html-indent": [ERROR, indent],
2372
2492
  "vue/key-spacing": [ERROR, {
2373
2493
  afterColon: true,
2374
2494
  beforeColon: false
@@ -2428,10 +2548,23 @@ function vue(options = {}) {
2428
2548
  }
2429
2549
 
2430
2550
  // src/configs/yaml.ts
2431
- function yaml(options = {}) {
2551
+ async function yaml(options = {}) {
2432
2552
  const {
2433
- overrides = {}
2553
+ files = [GLOB_YAML],
2554
+ overrides = {},
2555
+ stylistic: stylistic2 = true
2434
2556
  } = options;
2557
+ const {
2558
+ indent = 2,
2559
+ quotes = "single"
2560
+ } = isBoolean(stylistic2) ? {} : stylistic2;
2561
+ const [
2562
+ pluginYaml,
2563
+ parserYaml
2564
+ ] = await Promise.all([
2565
+ interopDefault(import("eslint-plugin-yml")),
2566
+ interopDefault(import("yaml-eslint-parser"))
2567
+ ]);
2435
2568
  return [
2436
2569
  {
2437
2570
  name: "vinicunca:yaml:setup",
@@ -2440,9 +2573,9 @@ function yaml(options = {}) {
2440
2573
  }
2441
2574
  },
2442
2575
  {
2443
- files: [GLOB_YAML],
2576
+ files,
2444
2577
  languageOptions: {
2445
- parser: default19
2578
+ parser: parserYaml
2446
2579
  },
2447
2580
  name: "vinicunca:yaml:rules",
2448
2581
  rules: {
@@ -2455,14 +2588,14 @@ function yaml(options = {}) {
2455
2588
  "yaml/flow-mapping-curly-spacing": ERROR,
2456
2589
  "yaml/flow-sequence-bracket-newline": ERROR,
2457
2590
  "yaml/flow-sequence-bracket-spacing": ERROR,
2458
- "yaml/indent": [ERROR, 2],
2591
+ "yaml/indent": [ERROR, indent === "tab" ? 2 : indent],
2459
2592
  "yaml/key-spacing": ERROR,
2460
2593
  "yaml/no-empty-key": ERROR,
2461
2594
  "yaml/no-empty-sequence-entry": ERROR,
2462
2595
  "yaml/no-irregular-whitespace": ERROR,
2463
2596
  "yaml/no-tab-indent": ERROR,
2464
2597
  "yaml/plain-scalar": ERROR,
2465
- "yaml/quotes": [ERROR, { avoidEscape: false, prefer: "single" }],
2598
+ "yaml/quotes": [ERROR, { avoidEscape: false, prefer: quotes }],
2466
2599
  "yaml/spaced-comment": ERROR,
2467
2600
  "yaml/vue-custom-block/no-parsing-error": ERROR,
2468
2601
  ...overrides
@@ -2478,7 +2611,7 @@ var VuePackages = [
2478
2611
  "vitepress",
2479
2612
  "@slidev/cli"
2480
2613
  ];
2481
- function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2614
+ async function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2482
2615
  const {
2483
2616
  componentExts = [],
2484
2617
  isInEditor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE) && !process3.env.CI),
@@ -2486,14 +2619,24 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2486
2619
  markdown: enableMarkdown = true,
2487
2620
  overrides = {},
2488
2621
  react: enableReact = false,
2489
- stylistic: enableStylistic = true,
2490
2622
  test: enableTest = true,
2491
2623
  typescript: tsOptions = {},
2624
+ unocss: enableUnoCSS = false,
2492
2625
  vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
2493
2626
  yaml: enableYaml = true
2494
2627
  } = options;
2628
+ let stylisticOptions = true;
2629
+ if (options.stylistic === false) {
2630
+ stylisticOptions = false;
2631
+ } else if (isObject(options.stylistic)) {
2632
+ stylisticOptions = {
2633
+ ...options.stylistic,
2634
+ jsx: options.jsx ?? true
2635
+ };
2636
+ }
2495
2637
  const configs = [];
2496
2638
  configs.push(
2639
+ ignores(options.ignores),
2497
2640
  javascript({
2498
2641
  isInEditor,
2499
2642
  overrides: overrides.javascript
@@ -2518,7 +2661,7 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2518
2661
  overrides: overrides.typescript
2519
2662
  }));
2520
2663
  }
2521
- if (enableStylistic) {
2664
+ if (stylisticOptions) {
2522
2665
  configs.push(stylistic());
2523
2666
  }
2524
2667
  if (enableTest) {
@@ -2538,10 +2681,21 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2538
2681
  }));
2539
2682
  }
2540
2683
  ;
2684
+ if (enableReact) {
2685
+ configs.push(react({
2686
+ overrides: overrides.react
2687
+ }));
2688
+ }
2689
+ if (enableUnoCSS) {
2690
+ configs.push(unocss(
2691
+ isBoolean(enableUnoCSS) ? {} : enableUnoCSS
2692
+ ));
2693
+ }
2541
2694
  if (enableJsonc) {
2542
2695
  configs.push(
2543
2696
  jsonc({
2544
- overrides: overrides.jsonc
2697
+ overrides: overrides.jsonc,
2698
+ stylistic: stylisticOptions
2545
2699
  }),
2546
2700
  sortPackageJson(),
2547
2701
  sortTsconfig()
@@ -2549,7 +2703,8 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2549
2703
  }
2550
2704
  if (enableYaml) {
2551
2705
  configs.push(yaml({
2552
- overrides: overrides.yaml
2706
+ overrides: overrides.yaml,
2707
+ stylistic: stylisticOptions
2553
2708
  }));
2554
2709
  }
2555
2710
  ;
@@ -2560,20 +2715,12 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2560
2715
  }));
2561
2716
  }
2562
2717
  ;
2563
- if (enableReact) {
2564
- configs.push(react({
2565
- overrides: overrides.react
2566
- }));
2567
- }
2568
2718
  configs.push(ignores(options.ignores));
2569
2719
  return combineConfigs(
2570
2720
  ...configs,
2571
2721
  ...userConfigs
2572
2722
  );
2573
2723
  }
2574
-
2575
- // src/index.ts
2576
- var src_default = vinicuncaESLint;
2577
2724
  export {
2578
2725
  GLOB_EXCLUDE,
2579
2726
  GLOB_JS,
@@ -2583,6 +2730,7 @@ export {
2583
2730
  GLOB_JSX,
2584
2731
  GLOB_MARKDOWN,
2585
2732
  GLOB_MARKDOWN_CODE,
2733
+ GLOB_MARKDOWN_IN_MARKDOWN,
2586
2734
  GLOB_SRC,
2587
2735
  GLOB_SRC_EXT,
2588
2736
  GLOB_TESTS,
@@ -2592,36 +2740,21 @@ export {
2592
2740
  GLOB_YAML,
2593
2741
  combineConfigs,
2594
2742
  comments,
2595
- src_default as default,
2596
2743
  ignores,
2597
2744
  imports,
2745
+ interopDefault,
2598
2746
  javascript,
2599
2747
  jsdoc,
2600
2748
  jsonc,
2601
2749
  markdown,
2602
2750
  node,
2603
- default17 as parserJsonc,
2604
- parserTs,
2605
- default18 as parserVue,
2606
- default19 as parserYaml,
2607
- default5 as pluginComments,
2751
+ default3 as pluginComments,
2608
2752
  pluginImport,
2609
- default6 as pluginJsdoc,
2610
- pluginJsonc,
2611
- default7 as pluginMarkdown,
2612
- default9 as pluginNoOnlyTests,
2613
- default8 as pluginNode,
2614
- default10 as pluginPerfectionist,
2615
- default11 as pluginReact,
2616
- default12 as pluginReactHooks,
2617
- default2 as pluginStylistic,
2618
- default3 as pluginTs,
2619
- default13 as pluginUnicorn,
2620
- default14 as pluginUnusedImports,
2621
- default4 as pluginVinicunca,
2622
- default15 as pluginVitest,
2623
- default16 as pluginVue,
2624
- pluginYaml,
2753
+ default4 as pluginNode,
2754
+ default5 as pluginPerfectionist,
2755
+ default6 as pluginUnicorn,
2756
+ default7 as pluginUnusedImports,
2757
+ default2 as pluginVinicunca,
2625
2758
  react,
2626
2759
  renameRules,
2627
2760
  sortPackageJson,
@@ -2630,6 +2763,7 @@ export {
2630
2763
  test,
2631
2764
  typescript,
2632
2765
  unicorn,
2766
+ unocss,
2633
2767
  vinicuncaESLint,
2634
2768
  vue,
2635
2769
  yaml