@vinicunca/eslint-config 2.0.11 → 2.0.13

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