@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.cjs CHANGED
@@ -38,6 +38,7 @@ __export(src_exports, {
38
38
  GLOB_JSX: () => GLOB_JSX,
39
39
  GLOB_MARKDOWN: () => GLOB_MARKDOWN,
40
40
  GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
41
+ GLOB_MARKDOWN_IN_MARKDOWN: () => GLOB_MARKDOWN_IN_MARKDOWN,
41
42
  GLOB_SRC: () => GLOB_SRC,
42
43
  GLOB_SRC_EXT: () => GLOB_SRC_EXT,
43
44
  GLOB_TESTS: () => GLOB_TESTS,
@@ -47,36 +48,21 @@ __export(src_exports, {
47
48
  GLOB_YAML: () => GLOB_YAML,
48
49
  combineConfigs: () => combineConfigs,
49
50
  comments: () => comments,
50
- default: () => src_default,
51
51
  ignores: () => ignores,
52
52
  imports: () => imports,
53
+ interopDefault: () => interopDefault,
53
54
  javascript: () => javascript,
54
55
  jsdoc: () => jsdoc,
55
56
  jsonc: () => jsonc,
56
57
  markdown: () => markdown,
57
58
  node: () => node,
58
- parserJsonc: () => import_jsonc_eslint_parser.default,
59
- parserTs: () => parserTs,
60
- parserVue: () => import_vue_eslint_parser.default,
61
- parserYaml: () => import_yaml_eslint_parser.default,
62
59
  pluginComments: () => import_eslint_plugin_eslint_comments.default,
63
60
  pluginImport: () => pluginImport,
64
- pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
65
- pluginJsonc: () => pluginJsonc,
66
- pluginMarkdown: () => import_eslint_plugin_markdown.default,
67
- pluginNoOnlyTests: () => import_eslint_plugin_no_only_tests.default,
68
61
  pluginNode: () => import_eslint_plugin_n.default,
69
62
  pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
70
- pluginReact: () => import_eslint_plugin_react.default,
71
- pluginReactHooks: () => import_eslint_plugin_react_hooks.default,
72
- pluginStylistic: () => import_eslint_plugin.default,
73
- pluginTs: () => import_eslint_plugin2.default,
74
63
  pluginUnicorn: () => import_eslint_plugin_unicorn.default,
75
64
  pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
76
65
  pluginVinicunca: () => import_eslint_plugin_vinicunca.default,
77
- pluginVitest: () => import_eslint_plugin_vitest.default,
78
- pluginVue: () => import_eslint_plugin_vue.default,
79
- pluginYaml: () => pluginYaml,
80
66
  react: () => react,
81
67
  renameRules: () => renameRules,
82
68
  sortPackageJson: () => sortPackageJson,
@@ -85,67 +71,14 @@ __export(src_exports, {
85
71
  test: () => test,
86
72
  typescript: () => typescript,
87
73
  unicorn: () => unicorn,
74
+ unocss: () => unocss,
88
75
  vinicuncaESLint: () => vinicuncaESLint,
89
76
  vue: () => vue,
90
77
  yaml: () => yaml
91
78
  });
92
79
  module.exports = __toCommonJS(src_exports);
93
80
 
94
- // src/base.ts
95
- var import_local_pkg = require("local-pkg");
96
- var import_node_process3 = __toESM(require("process"), 1);
97
-
98
- // src/flags.ts
99
- var ERROR = "error";
100
- var OFF = "off";
101
- var WARN = "warn";
102
- var CONSISTENT = "consistent";
103
- var NEVER = "never";
104
- var ALWAYS = "always";
105
-
106
- // src/plugins.ts
107
- var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
108
- var import_eslint_plugin2 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
109
- var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
110
- var import_eslint_plugin_vinicunca = __toESM(require("@vinicunca/eslint-plugin-vinicunca"), 1);
111
- var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
112
- var pluginImport = __toESM(require("eslint-plugin-i"), 1);
113
- var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
114
- var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
115
- var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
116
- var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
117
- var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
118
- var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
119
- var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
120
- var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
121
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
122
- var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
123
- var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
124
- var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
125
- var pluginYaml = __toESM(require("eslint-plugin-yml"), 1);
126
- var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
127
- var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
128
- var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
129
-
130
- // src/configs/comments.ts
131
- function comments() {
132
- return [
133
- {
134
- name: "vinicunca:eslint-comments",
135
- plugins: {
136
- "eslint-comments": import_eslint_plugin_eslint_comments.default
137
- },
138
- rules: {
139
- "eslint-comments/no-aggregating-enable": ERROR,
140
- "eslint-comments/no-duplicate-disable": ERROR,
141
- "eslint-comments/no-unlimited-disable": ERROR,
142
- "eslint-comments/no-unused-enable": ERROR
143
- }
144
- }
145
- ];
146
- }
147
-
148
- // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.10/node_modules/@vinicunca/perkakas/dist/index.js
81
+ // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.11/node_modules/@vinicunca/perkakas/dist/index.js
149
82
  function purry(fn, args, lazy) {
150
83
  const diff = fn.length - args.length;
151
84
  const arrayArgs = Array.from(args);
@@ -165,6 +98,9 @@ function purry(fn, args, lazy) {
165
98
  function isArray(data) {
166
99
  return Array.isArray(data);
167
100
  }
101
+ function isBoolean(data) {
102
+ return typeof data === "boolean";
103
+ }
168
104
  function isDefined(data) {
169
105
  return typeof data !== "undefined" && data !== null;
170
106
  }
@@ -1119,6 +1055,45 @@ function toPairs(object) {
1119
1055
  toPairs2.strict = strict;
1120
1056
  })(toPairs || (toPairs = {}));
1121
1057
 
1058
+ // src/base.ts
1059
+ var import_local_pkg = require("local-pkg");
1060
+ var import_node_process3 = __toESM(require("process"), 1);
1061
+
1062
+ // src/flags.ts
1063
+ var ERROR = "error";
1064
+ var OFF = "off";
1065
+ var WARN = "warn";
1066
+ var CONSISTENT = "consistent";
1067
+ var NEVER = "never";
1068
+ var ALWAYS = "always";
1069
+
1070
+ // src/plugins.ts
1071
+ var import_eslint_plugin_vinicunca = __toESM(require("@vinicunca/eslint-plugin-vinicunca"), 1);
1072
+ var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
1073
+ var pluginImport = __toESM(require("eslint-plugin-i"), 1);
1074
+ var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
1075
+ var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
1076
+ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
1077
+ var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
1078
+
1079
+ // src/configs/comments.ts
1080
+ async function comments() {
1081
+ return [
1082
+ {
1083
+ name: "vinicunca:eslint-comments",
1084
+ plugins: {
1085
+ "eslint-comments": import_eslint_plugin_eslint_comments.default
1086
+ },
1087
+ rules: {
1088
+ "eslint-comments/no-aggregating-enable": ERROR,
1089
+ "eslint-comments/no-duplicate-disable": ERROR,
1090
+ "eslint-comments/no-unlimited-disable": ERROR,
1091
+ "eslint-comments/no-unused-enable": ERROR
1092
+ }
1093
+ }
1094
+ ];
1095
+ }
1096
+
1122
1097
  // src/configs/ignores.ts
1123
1098
  var import_node_fs = __toESM(require("fs"), 1);
1124
1099
  var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
@@ -1137,6 +1112,10 @@ var GLOB_EXCLUDE = [
1137
1112
  "**/output",
1138
1113
  "**/coverage",
1139
1114
  "**/temp",
1115
+ "**/.temp",
1116
+ "**/tmp",
1117
+ "**/.tmp",
1118
+ "**/.history",
1140
1119
  "**/.vitepress/cache",
1141
1120
  "**/.nuxt",
1142
1121
  "**/.next",
@@ -1168,10 +1147,11 @@ var GLOB_JSON5 = "**/*.json5";
1168
1147
  var GLOB_JSONC = "**/*.jsonc";
1169
1148
  var GLOB_YAML = "**/*.y?(a)ml";
1170
1149
  var GLOB_MARKDOWN = "**/*.md";
1150
+ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
1171
1151
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
1172
1152
 
1173
1153
  // src/configs/ignores.ts
1174
- function ignores({
1154
+ async function ignores({
1175
1155
  enableGitignore = true,
1176
1156
  items = [],
1177
1157
  replace = false
@@ -1203,7 +1183,7 @@ function ignores({
1203
1183
  }
1204
1184
 
1205
1185
  // src/configs/imports.ts
1206
- function imports() {
1186
+ async function imports() {
1207
1187
  return [
1208
1188
  {
1209
1189
  name: "vinicunca:imports",
@@ -1234,7 +1214,7 @@ function imports() {
1234
1214
 
1235
1215
  // src/configs/javascript.ts
1236
1216
  var import_globals = __toESM(require("globals"), 1);
1237
- function javascript(options = {}) {
1217
+ async function javascript(options = {}) {
1238
1218
  const {
1239
1219
  isInEditor = false,
1240
1220
  overrides = {}
@@ -1251,7 +1231,9 @@ function javascript(options = {}) {
1251
1231
  window: "readonly"
1252
1232
  },
1253
1233
  parserOptions: {
1254
- ecmaFeatures: { jsx: true },
1234
+ ecmaFeatures: {
1235
+ jsx: true
1236
+ },
1255
1237
  ecmaVersion: 2022,
1256
1238
  sourceType: "module"
1257
1239
  },
@@ -1272,7 +1254,6 @@ function javascript(options = {}) {
1272
1254
  setWithoutGet: true
1273
1255
  }],
1274
1256
  "array-callback-return": [ERROR, { checkForEach: true }],
1275
- "arrow-parens": [ERROR, ALWAYS],
1276
1257
  "block-scoped-var": ERROR,
1277
1258
  "camelcase": [ERROR, {
1278
1259
  allow: ["^UNSAFE_"],
@@ -1523,13 +1504,35 @@ function javascript(options = {}) {
1523
1504
  ];
1524
1505
  }
1525
1506
 
1507
+ // src/utils.ts
1508
+ async function combineConfigs(...configs) {
1509
+ const resolvedConfigs = await Promise.all(configs);
1510
+ return resolvedConfigs.flatMap((config) => Array.isArray(config) ? config : [config]);
1511
+ }
1512
+ function renameRules(rules, from, to) {
1513
+ return Object.fromEntries(
1514
+ Object.entries(rules).map(([key, value]) => {
1515
+ if (key.startsWith(from)) {
1516
+ return [to + key.slice(from.length), value];
1517
+ }
1518
+ ;
1519
+ return [key, value];
1520
+ })
1521
+ );
1522
+ }
1523
+ async function interopDefault(m) {
1524
+ const resolved = await m;
1525
+ return resolved.default || resolved;
1526
+ }
1527
+
1526
1528
  // src/configs/jsdoc.ts
1527
- function jsdoc() {
1529
+ async function jsdoc() {
1528
1530
  return [
1529
1531
  {
1530
1532
  name: "vinicunca:jsdoc",
1531
1533
  plugins: {
1532
- jsdoc: import_eslint_plugin_jsdoc.default
1534
+ // @ts-expect-error missing types
1535
+ jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
1533
1536
  },
1534
1537
  rules: {
1535
1538
  "jsdoc/check-access": WARN,
@@ -1557,10 +1560,22 @@ function jsdoc() {
1557
1560
  }
1558
1561
 
1559
1562
  // src/configs/jsonc.ts
1560
- function jsonc(options = {}) {
1563
+ async function jsonc(options = {}) {
1561
1564
  const {
1562
- overrides = {}
1565
+ files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1566
+ overrides = {},
1567
+ stylistic: stylistic2 = true
1563
1568
  } = options;
1569
+ const {
1570
+ indent = 2
1571
+ } = isBoolean(stylistic2) ? {} : stylistic2;
1572
+ const [
1573
+ pluginJsonc,
1574
+ parserJsonc
1575
+ ] = await Promise.all([
1576
+ interopDefault(import("eslint-plugin-jsonc")),
1577
+ interopDefault(import("jsonc-eslint-parser"))
1578
+ ]);
1564
1579
  return [
1565
1580
  {
1566
1581
  name: "vinicunca:jsonc:setup",
@@ -1569,17 +1584,12 @@ function jsonc(options = {}) {
1569
1584
  }
1570
1585
  },
1571
1586
  {
1572
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1587
+ files,
1573
1588
  languageOptions: {
1574
- parser: import_jsonc_eslint_parser.default
1589
+ parser: parserJsonc
1575
1590
  },
1576
1591
  name: "vinicunca:jsonc:rules",
1577
1592
  rules: {
1578
- "jsonc/array-bracket-spacing": [ERROR, NEVER],
1579
- "jsonc/comma-dangle": [ERROR, NEVER],
1580
- "jsonc/comma-style": [ERROR, "last"],
1581
- "jsonc/indent": [ERROR, 2],
1582
- "jsonc/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
1583
1593
  "jsonc/no-bigint-literals": ERROR,
1584
1594
  "jsonc/no-binary-expression": ERROR,
1585
1595
  "jsonc/no-binary-numeric-literals": ERROR,
@@ -1603,14 +1613,21 @@ function jsonc(options = {}) {
1603
1613
  "jsonc/no-undefined-value": ERROR,
1604
1614
  "jsonc/no-unicode-codepoint-escapes": ERROR,
1605
1615
  "jsonc/no-useless-escape": ERROR,
1606
- "jsonc/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
1607
- "jsonc/object-curly-spacing": [ERROR, "always"],
1608
- "jsonc/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
1609
- "jsonc/quote-props": ERROR,
1610
- "jsonc/quotes": ERROR,
1611
1616
  "jsonc/space-unary-ops": ERROR,
1612
1617
  "jsonc/valid-json-number": ERROR,
1613
1618
  "jsonc/vue-custom-block/no-parsing-error": ERROR,
1619
+ ...stylistic2 ? {
1620
+ "jsonc/array-bracket-spacing": [ERROR, NEVER],
1621
+ "jsonc/comma-dangle": [ERROR, NEVER],
1622
+ "jsonc/comma-style": [ERROR, "last"],
1623
+ "jsonc/indent": [ERROR, indent],
1624
+ "jsonc/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
1625
+ "jsonc/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
1626
+ "jsonc/object-curly-spacing": [ERROR, "always"],
1627
+ "jsonc/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
1628
+ "jsonc/quote-props": ERROR,
1629
+ "jsonc/quotes": ERROR
1630
+ } : {},
1614
1631
  ...overrides
1615
1632
  }
1616
1633
  }
@@ -1618,18 +1635,26 @@ function jsonc(options = {}) {
1618
1635
  }
1619
1636
 
1620
1637
  // src/configs/markdown.ts
1621
- function markdown(options = {}) {
1638
+ async function markdown(options = {}) {
1622
1639
  const {
1623
1640
  componentExts = [],
1641
+ files = [GLOB_MARKDOWN],
1624
1642
  overrides = {}
1625
1643
  } = options;
1626
1644
  return [
1627
1645
  {
1628
1646
  name: "vinicunca:markdown:setup",
1629
1647
  plugins: {
1630
- markdown: import_eslint_plugin_markdown.default
1648
+ // @ts-expect-error missing types
1649
+ markdown: await interopDefault(import("eslint-plugin-markdown"))
1631
1650
  }
1632
1651
  },
1652
+ {
1653
+ files,
1654
+ ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
1655
+ name: "vinicunca:markdown:processor",
1656
+ processor: "markdown/markdown"
1657
+ },
1633
1658
  {
1634
1659
  files: [GLOB_MARKDOWN],
1635
1660
  name: "vinicunca:markdown:processor",
@@ -1647,8 +1672,9 @@ function markdown(options = {}) {
1647
1672
  }
1648
1673
  }
1649
1674
  },
1650
- name: "vinicunca:markdown:rules",
1675
+ name: "vinicunca:markdown:disables",
1651
1676
  rules: {
1677
+ "import/newline-after-import": OFF,
1652
1678
  "no-alert": OFF,
1653
1679
  "no-console": OFF,
1654
1680
  "no-undef": OFF,
@@ -1695,7 +1721,7 @@ function markdown(options = {}) {
1695
1721
  }
1696
1722
 
1697
1723
  // src/configs/node.ts
1698
- function node() {
1724
+ async function node() {
1699
1725
  return [
1700
1726
  {
1701
1727
  name: "vinicunca:node",
@@ -1719,23 +1745,46 @@ function node() {
1719
1745
 
1720
1746
  // src/configs/react.ts
1721
1747
  var STR_PARENS_NEW_LINE = "parens-new-line";
1722
- function react(options = {}) {
1748
+ async function react(options = {}) {
1723
1749
  const {
1750
+ files = [GLOB_JSX, GLOB_TSX],
1724
1751
  overrides = {}
1725
1752
  } = options;
1753
+ const [
1754
+ pluginReact,
1755
+ pluginReactHooks
1756
+ ] = await Promise.all([
1757
+ // @ts-expect-error missing types
1758
+ interopDefault(import("eslint-plugin-react")),
1759
+ // @ts-expect-error missing types
1760
+ interopDefault(import("eslint-plugin-react-hooks"))
1761
+ ]);
1726
1762
  return [
1727
1763
  {
1728
1764
  name: "vinicunca:react:setup",
1729
1765
  plugins: {
1730
- "react": import_eslint_plugin_react.default,
1731
- "react-hooks": import_eslint_plugin_react_hooks.default
1766
+ "react": pluginReact,
1767
+ "react-hooks": pluginReactHooks
1768
+ },
1769
+ settings: {
1770
+ react: {
1771
+ version: "detect"
1772
+ }
1732
1773
  }
1733
1774
  },
1734
1775
  {
1776
+ files,
1777
+ languageOptions: {
1778
+ parserOptions: {
1779
+ ecmaFeatures: {
1780
+ jsx: true
1781
+ }
1782
+ }
1783
+ },
1735
1784
  name: "vinicunca:react:rules",
1736
1785
  rules: {
1737
- ...import_eslint_plugin_react.default.configs.recommended.rules,
1738
- ...import_eslint_plugin_react_hooks.default.configs.recommended.rules,
1786
+ ...pluginReact.configs.recommended.rules,
1787
+ ...pluginReactHooks.configs.recommended.rules,
1739
1788
  "react/boolean-prop-naming": [OFF, {
1740
1789
  message: "",
1741
1790
  propTypeNames: ["bool", "mutuallyExclusiveTrueProps"],
@@ -1795,24 +1844,19 @@ function react(options = {}) {
1795
1844
  return: STR_PARENS_NEW_LINE
1796
1845
  }],
1797
1846
  "react/no-danger": WARN,
1847
+ "react/no-unescaped-entities": OFF,
1798
1848
  "react/prop-types": OFF,
1799
1849
  "react/react-in-jsx-scope": OFF,
1800
1850
  "react/self-closing-comp": ERROR,
1801
1851
  "react/style-prop-object": ERROR,
1802
- "style/jsx-quotes": [ERROR, "prefer-double"],
1803
1852
  ...overrides
1804
- },
1805
- settings: {
1806
- react: {
1807
- version: "detect"
1808
- }
1809
1853
  }
1810
1854
  }
1811
1855
  ];
1812
1856
  }
1813
1857
 
1814
1858
  // src/configs/sort-package-json.ts
1815
- function sortPackageJson() {
1859
+ async function sortPackageJson() {
1816
1860
  return [
1817
1861
  {
1818
1862
  files: ["**/package.json"],
@@ -2028,12 +2072,27 @@ function sortTsconfig() {
2028
2072
  }
2029
2073
 
2030
2074
  // src/configs/stylistic.ts
2031
- function stylistic() {
2075
+ var STYLISTIC_CONFIG_DEFAULTS = {
2076
+ indent: 2,
2077
+ jsx: true,
2078
+ quotes: "single",
2079
+ semi: true
2080
+ };
2081
+ async function stylistic(options = {}) {
2082
+ const {
2083
+ indent,
2084
+ quotes,
2085
+ semi
2086
+ } = {
2087
+ ...STYLISTIC_CONFIG_DEFAULTS,
2088
+ ...options
2089
+ };
2090
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
2032
2091
  return [
2033
2092
  {
2034
2093
  name: "vinicunca:stylistic",
2035
2094
  plugins: {
2036
- style: import_eslint_plugin.default,
2095
+ style: pluginStylistic,
2037
2096
  vinicunca: import_eslint_plugin_vinicunca.default
2038
2097
  },
2039
2098
  rules: {
@@ -2041,6 +2100,7 @@ function stylistic() {
2041
2100
  "style/array-bracket-newline": [ERROR, CONSISTENT],
2042
2101
  "style/array-bracket-spacing": [ERROR, NEVER],
2043
2102
  "style/array-element-newline": [ERROR, CONSISTENT],
2103
+ "style/arrow-parens": [ERROR, ALWAYS],
2044
2104
  "style/arrow-spacing": [ERROR, { after: true, before: true }],
2045
2105
  "style/block-spacing": [ERROR, ALWAYS],
2046
2106
  "style/brace-style": [ERROR],
@@ -2051,7 +2111,7 @@ function stylistic() {
2051
2111
  "style/dot-location": [ERROR, "property"],
2052
2112
  "style/eol-last": ERROR,
2053
2113
  "style/func-call-spacing": [ERROR, NEVER],
2054
- "style/indent": [ERROR, 2, {
2114
+ "style/indent": [ERROR, indent, {
2055
2115
  ArrayExpression: 1,
2056
2116
  CallExpression: { arguments: 1 },
2057
2117
  FunctionDeclaration: { body: 1, parameters: 1 },
@@ -2089,6 +2149,7 @@ function stylistic() {
2089
2149
  offsetTernaryExpressions: true,
2090
2150
  outerIIFEBody: 1
2091
2151
  }],
2152
+ "style/indent-binary-ops": [ERROR, indent],
2092
2153
  "style/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
2093
2154
  "style/keyword-spacing": [ERROR, { after: true, before: true }],
2094
2155
  "style/lines-between-class-members": [ERROR, ALWAYS, { exceptAfterSingleLine: true }],
@@ -2118,9 +2179,9 @@ function stylistic() {
2118
2179
  "style/operator-linebreak": [ERROR, "before"],
2119
2180
  "style/padded-blocks": [ERROR, { blocks: NEVER, classes: NEVER, switches: NEVER }],
2120
2181
  "style/quote-props": [ERROR, "consistent-as-needed"],
2121
- "style/quotes": [ERROR, "single"],
2182
+ "style/quotes": [ERROR, quotes],
2122
2183
  "style/rest-spread-spacing": [ERROR, NEVER],
2123
- "style/semi": [ERROR, ALWAYS],
2184
+ "style/semi": [ERROR, semi ? ALWAYS : NEVER],
2124
2185
  "style/semi-spacing": [ERROR, { after: true, before: false }],
2125
2186
  "style/space-before-blocks": [ERROR, ALWAYS],
2126
2187
  "style/space-before-function-paren": [ERROR, {
@@ -2164,27 +2225,36 @@ function stylistic() {
2164
2225
  }
2165
2226
 
2166
2227
  // src/configs/test.ts
2167
- function test(options = {}) {
2228
+ async function test(options = {}) {
2168
2229
  const {
2230
+ files = GLOB_TESTS,
2169
2231
  isInEditor = false,
2170
2232
  overrides = {}
2171
2233
  } = options;
2234
+ const [
2235
+ pluginVitest,
2236
+ pluginNoOnlyTests
2237
+ ] = await Promise.all([
2238
+ interopDefault(import("eslint-plugin-vitest")),
2239
+ // @ts-expect-error missing types
2240
+ interopDefault(import("eslint-plugin-no-only-tests"))
2241
+ ]);
2172
2242
  return [
2173
2243
  {
2174
2244
  name: "vinicunca:test:setup",
2175
2245
  plugins: {
2176
2246
  test: {
2177
- ...import_eslint_plugin_vitest.default,
2247
+ ...pluginVitest,
2178
2248
  rules: {
2179
- ...import_eslint_plugin_vitest.default.rules,
2249
+ ...pluginVitest.rules,
2180
2250
  // extend `test/no-only-tests` rule
2181
- ...import_eslint_plugin_no_only_tests.default.rules
2251
+ ...pluginNoOnlyTests.rules
2182
2252
  }
2183
2253
  }
2184
2254
  }
2185
2255
  },
2186
2256
  {
2187
- files: GLOB_TESTS,
2257
+ files,
2188
2258
  name: "vinicunca:test:rules",
2189
2259
  rules: {
2190
2260
  "test/consistent-test-it": [ERROR, { fn: "it", withinDescribe: "it" }],
@@ -2200,31 +2270,17 @@ function test(options = {}) {
2200
2270
 
2201
2271
  // src/configs/typescript.ts
2202
2272
  var import_node_process = __toESM(require("process"), 1);
2203
-
2204
- // src/utils.ts
2205
- function combineConfigs(...configs) {
2206
- return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
2207
- }
2208
- function renameRules(rules, from, to) {
2209
- return Object.fromEntries(
2210
- Object.entries(rules).map(([key, value]) => {
2211
- if (key.startsWith(from)) {
2212
- return [to + key.slice(from.length), value];
2213
- }
2214
- ;
2215
- return [key, value];
2216
- })
2217
- );
2218
- }
2219
-
2220
- // src/configs/typescript.ts
2221
- function typescript(options) {
2273
+ async function typescript(options = {}) {
2222
2274
  const {
2223
2275
  componentExts = [],
2224
2276
  overrides = {},
2225
2277
  parserOptions = {},
2226
2278
  tsconfigPath = []
2227
2279
  } = options ?? {};
2280
+ const files = options.files ?? [
2281
+ GLOB_SRC,
2282
+ ...componentExts.map((ext) => `**/*.${ext}`)
2283
+ ];
2228
2284
  const typeAwareRules = {
2229
2285
  "dot-notation": OFF,
2230
2286
  "no-implied-eval": OFF,
@@ -2249,21 +2305,28 @@ function typescript(options) {
2249
2305
  };
2250
2306
  additionalTypeAwareRules = typeAwareRules;
2251
2307
  }
2308
+ const [
2309
+ pluginTs,
2310
+ parserTs,
2311
+ pluginStylistic
2312
+ ] = await Promise.all([
2313
+ interopDefault(import("@typescript-eslint/eslint-plugin")),
2314
+ interopDefault(import("@typescript-eslint/parser")),
2315
+ interopDefault(import("@stylistic/eslint-plugin"))
2316
+ ]);
2252
2317
  return [
2253
2318
  {
2254
2319
  // Install the plugins without globs, so they can be configured separately.
2255
2320
  name: "vinicunca:typescript:setup",
2256
2321
  plugins: {
2257
2322
  import: pluginImport,
2258
- ts: import_eslint_plugin2.default,
2323
+ style: pluginStylistic,
2324
+ ts: pluginTs,
2259
2325
  vinicunca: import_eslint_plugin_vinicunca.default
2260
2326
  }
2261
2327
  },
2262
2328
  {
2263
- files: [
2264
- GLOB_SRC,
2265
- ...componentExts.map((ext) => `**/*.${ext}`)
2266
- ],
2329
+ files,
2267
2330
  languageOptions: {
2268
2331
  parser: parserTs,
2269
2332
  parserOptions: {
@@ -2276,12 +2339,12 @@ function typescript(options) {
2276
2339
  name: "vinicunca:typescript:rules",
2277
2340
  rules: {
2278
2341
  ...renameRules(
2279
- import_eslint_plugin2.default.configs["eslint-recommended"].overrides[0].rules,
2342
+ pluginTs.configs["eslint-recommended"].overrides[0].rules,
2280
2343
  "@typescript-eslint/",
2281
2344
  "ts/"
2282
2345
  ),
2283
2346
  ...renameRules(
2284
- import_eslint_plugin2.default.configs.strict.rules,
2347
+ pluginTs.configs.strict.rules,
2285
2348
  "@typescript-eslint/",
2286
2349
  "ts/"
2287
2350
  ),
@@ -2292,6 +2355,8 @@ function typescript(options) {
2292
2355
  "no-unused-vars": OFF,
2293
2356
  "no-use-before-define": OFF,
2294
2357
  "no-useless-constructor": OFF,
2358
+ "style/type-generic-spacing": ERROR,
2359
+ "style/type-named-tuple-spacing": ERROR,
2295
2360
  "ts/ban-ts-comment": [ERROR, { "ts-ignore": "allow-with-description" }],
2296
2361
  "ts/ban-types": [ERROR, { types: { Function: false } }],
2297
2362
  "ts/consistent-type-definitions": [ERROR, "interface"],
@@ -2320,8 +2385,6 @@ function typescript(options) {
2320
2385
  "ts/parameter-properties": OFF,
2321
2386
  "ts/prefer-ts-expect-error": ERROR,
2322
2387
  "ts/triple-slash-reference": OFF,
2323
- "vinicunca/generic-spacing": ERROR,
2324
- "vinicunca/named-tuple-spacing": ERROR,
2325
2388
  "vinicunca/no-cjs-exports": ERROR,
2326
2389
  "vinicunca/no-ts-export-equal": ERROR,
2327
2390
  ...additionalTypeAwareRules,
@@ -2356,7 +2419,7 @@ function typescript(options) {
2356
2419
  }
2357
2420
 
2358
2421
  // src/configs/unicorn.ts
2359
- function unicorn(options = {}) {
2422
+ async function unicorn(options = {}) {
2360
2423
  const {
2361
2424
  overrides = {}
2362
2425
  } = options;
@@ -2386,13 +2449,48 @@ function unicorn(options = {}) {
2386
2449
  ];
2387
2450
  }
2388
2451
 
2452
+ // src/configs/unocss.ts
2453
+ async function unocss(options = {}) {
2454
+ const {
2455
+ attributify = false,
2456
+ strict = false
2457
+ } = options;
2458
+ const [
2459
+ pluginUnoCSS
2460
+ ] = await Promise.all([
2461
+ interopDefault(import("@unocss/eslint-plugin"))
2462
+ ]);
2463
+ return [
2464
+ {
2465
+ name: "vinicunca:unocss",
2466
+ plugins: {
2467
+ unocss: pluginUnoCSS
2468
+ },
2469
+ rules: {
2470
+ "unocss/order": "warn",
2471
+ ...attributify ? {
2472
+ "unocss/order-attributify": "warn"
2473
+ } : {},
2474
+ ...strict ? {
2475
+ "unocss/blocklist": "error"
2476
+ } : {}
2477
+ }
2478
+ }
2479
+ ];
2480
+ }
2481
+
2389
2482
  // src/configs/vue.ts
2390
2483
  var import_node_process2 = __toESM(require("process"), 1);
2391
- function vue(options = {}) {
2484
+ async function vue(options = {}) {
2392
2485
  const {
2486
+ files = [GLOB_VUE],
2393
2487
  overrides = {},
2488
+ stylistic: stylistic2 = true,
2394
2489
  typescript: typescript2 = {}
2395
2490
  } = options;
2491
+ const {
2492
+ indent = 2
2493
+ } = isBoolean(stylistic2) ? {} : stylistic2;
2396
2494
  let tsConfigOptions = {};
2397
2495
  const tsconfigPath = typescript2.tsconfigPath ?? [];
2398
2496
  if (!isEmpty(tsconfigPath)) {
@@ -2401,34 +2499,42 @@ function vue(options = {}) {
2401
2499
  tsconfigRootDir: import_node_process2.default.cwd()
2402
2500
  };
2403
2501
  }
2502
+ const [
2503
+ pluginVue,
2504
+ parserVue
2505
+ ] = await Promise.all([
2506
+ // @ts-expect-error missing types
2507
+ interopDefault(import("eslint-plugin-vue")),
2508
+ interopDefault(import("vue-eslint-parser"))
2509
+ ]);
2404
2510
  return [
2405
2511
  {
2406
2512
  name: "vinicunca:vue:setup",
2407
2513
  plugins: {
2408
- vue: import_eslint_plugin_vue.default
2514
+ vue: pluginVue
2409
2515
  }
2410
2516
  },
2411
2517
  {
2412
- files: [GLOB_VUE],
2518
+ files,
2413
2519
  languageOptions: {
2414
- parser: import_vue_eslint_parser.default,
2520
+ parser: parserVue,
2415
2521
  parserOptions: {
2416
2522
  ecmaFeatures: {
2417
2523
  jsx: true
2418
2524
  },
2419
2525
  extraFileExtensions: [".vue"],
2420
- parser: typescript2.enabled ? parserTs : void 0,
2526
+ parser: typescript2.enabled ? await interopDefault(import("@typescript-eslint/parser")) : null,
2421
2527
  sourceType: "module",
2422
2528
  ...tsConfigOptions
2423
2529
  }
2424
2530
  },
2425
2531
  name: "vinicunca:vue:rules",
2426
- processor: import_eslint_plugin_vue.default.processors[".vue"],
2532
+ processor: pluginVue.processors[".vue"],
2427
2533
  rules: {
2428
- ...import_eslint_plugin_vue.default.configs.base.rules,
2429
- ...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
2430
- ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
2431
- ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules,
2534
+ ...pluginVue.configs.base.rules,
2535
+ ...pluginVue.configs["vue3-essential"].rules,
2536
+ ...pluginVue.configs["vue3-strongly-recommended"].rules,
2537
+ ...pluginVue.configs["vue3-recommended"].rules,
2432
2538
  "node/prefer-global/process": OFF,
2433
2539
  "vue/array-bracket-spacing": [ERROR, NEVER],
2434
2540
  "vue/arrow-spacing": [ERROR, {
@@ -2462,6 +2568,7 @@ function vue(options = {}) {
2462
2568
  "vue/html-comment-content-spacing": [ERROR, ALWAYS, {
2463
2569
  exceptions: ["-"]
2464
2570
  }],
2571
+ "vue/html-indent": [ERROR, indent],
2465
2572
  "vue/key-spacing": [ERROR, {
2466
2573
  afterColon: true,
2467
2574
  beforeColon: false
@@ -2521,10 +2628,23 @@ function vue(options = {}) {
2521
2628
  }
2522
2629
 
2523
2630
  // src/configs/yaml.ts
2524
- function yaml(options = {}) {
2631
+ async function yaml(options = {}) {
2525
2632
  const {
2526
- overrides = {}
2633
+ files = [GLOB_YAML],
2634
+ overrides = {},
2635
+ stylistic: stylistic2 = true
2527
2636
  } = options;
2637
+ const {
2638
+ indent = 2,
2639
+ quotes = "single"
2640
+ } = isBoolean(stylistic2) ? {} : stylistic2;
2641
+ const [
2642
+ pluginYaml,
2643
+ parserYaml
2644
+ ] = await Promise.all([
2645
+ interopDefault(import("eslint-plugin-yml")),
2646
+ interopDefault(import("yaml-eslint-parser"))
2647
+ ]);
2528
2648
  return [
2529
2649
  {
2530
2650
  name: "vinicunca:yaml:setup",
@@ -2533,9 +2653,9 @@ function yaml(options = {}) {
2533
2653
  }
2534
2654
  },
2535
2655
  {
2536
- files: [GLOB_YAML],
2656
+ files,
2537
2657
  languageOptions: {
2538
- parser: import_yaml_eslint_parser.default
2658
+ parser: parserYaml
2539
2659
  },
2540
2660
  name: "vinicunca:yaml:rules",
2541
2661
  rules: {
@@ -2548,14 +2668,14 @@ function yaml(options = {}) {
2548
2668
  "yaml/flow-mapping-curly-spacing": ERROR,
2549
2669
  "yaml/flow-sequence-bracket-newline": ERROR,
2550
2670
  "yaml/flow-sequence-bracket-spacing": ERROR,
2551
- "yaml/indent": [ERROR, 2],
2671
+ "yaml/indent": [ERROR, indent === "tab" ? 2 : indent],
2552
2672
  "yaml/key-spacing": ERROR,
2553
2673
  "yaml/no-empty-key": ERROR,
2554
2674
  "yaml/no-empty-sequence-entry": ERROR,
2555
2675
  "yaml/no-irregular-whitespace": ERROR,
2556
2676
  "yaml/no-tab-indent": ERROR,
2557
2677
  "yaml/plain-scalar": ERROR,
2558
- "yaml/quotes": [ERROR, { avoidEscape: false, prefer: "single" }],
2678
+ "yaml/quotes": [ERROR, { avoidEscape: false, prefer: quotes }],
2559
2679
  "yaml/spaced-comment": ERROR,
2560
2680
  "yaml/vue-custom-block/no-parsing-error": ERROR,
2561
2681
  ...overrides
@@ -2571,7 +2691,7 @@ var VuePackages = [
2571
2691
  "vitepress",
2572
2692
  "@slidev/cli"
2573
2693
  ];
2574
- function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2694
+ async function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2575
2695
  const {
2576
2696
  componentExts = [],
2577
2697
  isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !import_node_process3.default.env.CI),
@@ -2579,14 +2699,24 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2579
2699
  markdown: enableMarkdown = true,
2580
2700
  overrides = {},
2581
2701
  react: enableReact = false,
2582
- stylistic: enableStylistic = true,
2583
2702
  test: enableTest = true,
2584
2703
  typescript: tsOptions = {},
2704
+ unocss: enableUnoCSS = false,
2585
2705
  vue: enableVue = VuePackages.some((i) => (0, import_local_pkg.isPackageExists)(i)),
2586
2706
  yaml: enableYaml = true
2587
2707
  } = options;
2708
+ let stylisticOptions = true;
2709
+ if (options.stylistic === false) {
2710
+ stylisticOptions = false;
2711
+ } else if (isObject(options.stylistic)) {
2712
+ stylisticOptions = {
2713
+ ...options.stylistic,
2714
+ jsx: options.jsx ?? true
2715
+ };
2716
+ }
2588
2717
  const configs = [];
2589
2718
  configs.push(
2719
+ ignores(options.ignores),
2590
2720
  javascript({
2591
2721
  isInEditor,
2592
2722
  overrides: overrides.javascript
@@ -2611,7 +2741,7 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2611
2741
  overrides: overrides.typescript
2612
2742
  }));
2613
2743
  }
2614
- if (enableStylistic) {
2744
+ if (stylisticOptions) {
2615
2745
  configs.push(stylistic());
2616
2746
  }
2617
2747
  if (enableTest) {
@@ -2631,10 +2761,21 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2631
2761
  }));
2632
2762
  }
2633
2763
  ;
2764
+ if (enableReact) {
2765
+ configs.push(react({
2766
+ overrides: overrides.react
2767
+ }));
2768
+ }
2769
+ if (enableUnoCSS) {
2770
+ configs.push(unocss(
2771
+ isBoolean(enableUnoCSS) ? {} : enableUnoCSS
2772
+ ));
2773
+ }
2634
2774
  if (enableJsonc) {
2635
2775
  configs.push(
2636
2776
  jsonc({
2637
- overrides: overrides.jsonc
2777
+ overrides: overrides.jsonc,
2778
+ stylistic: stylisticOptions
2638
2779
  }),
2639
2780
  sortPackageJson(),
2640
2781
  sortTsconfig()
@@ -2642,7 +2783,8 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2642
2783
  }
2643
2784
  if (enableYaml) {
2644
2785
  configs.push(yaml({
2645
- overrides: overrides.yaml
2786
+ overrides: overrides.yaml,
2787
+ stylistic: stylisticOptions
2646
2788
  }));
2647
2789
  }
2648
2790
  ;
@@ -2653,20 +2795,12 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
2653
2795
  }));
2654
2796
  }
2655
2797
  ;
2656
- if (enableReact) {
2657
- configs.push(react({
2658
- overrides: overrides.react
2659
- }));
2660
- }
2661
2798
  configs.push(ignores(options.ignores));
2662
2799
  return combineConfigs(
2663
2800
  ...configs,
2664
2801
  ...userConfigs
2665
2802
  );
2666
2803
  }
2667
-
2668
- // src/index.ts
2669
- var src_default = vinicuncaESLint;
2670
2804
  // Annotate the CommonJS export names for ESM import in node:
2671
2805
  0 && (module.exports = {
2672
2806
  GLOB_EXCLUDE,
@@ -2677,6 +2811,7 @@ var src_default = vinicuncaESLint;
2677
2811
  GLOB_JSX,
2678
2812
  GLOB_MARKDOWN,
2679
2813
  GLOB_MARKDOWN_CODE,
2814
+ GLOB_MARKDOWN_IN_MARKDOWN,
2680
2815
  GLOB_SRC,
2681
2816
  GLOB_SRC_EXT,
2682
2817
  GLOB_TESTS,
@@ -2688,33 +2823,19 @@ var src_default = vinicuncaESLint;
2688
2823
  comments,
2689
2824
  ignores,
2690
2825
  imports,
2826
+ interopDefault,
2691
2827
  javascript,
2692
2828
  jsdoc,
2693
2829
  jsonc,
2694
2830
  markdown,
2695
2831
  node,
2696
- parserJsonc,
2697
- parserTs,
2698
- parserVue,
2699
- parserYaml,
2700
2832
  pluginComments,
2701
2833
  pluginImport,
2702
- pluginJsdoc,
2703
- pluginJsonc,
2704
- pluginMarkdown,
2705
- pluginNoOnlyTests,
2706
2834
  pluginNode,
2707
2835
  pluginPerfectionist,
2708
- pluginReact,
2709
- pluginReactHooks,
2710
- pluginStylistic,
2711
- pluginTs,
2712
2836
  pluginUnicorn,
2713
2837
  pluginUnusedImports,
2714
2838
  pluginVinicunca,
2715
- pluginVitest,
2716
- pluginVue,
2717
- pluginYaml,
2718
2839
  react,
2719
2840
  renameRules,
2720
2841
  sortPackageJson,
@@ -2723,6 +2844,7 @@ var src_default = vinicuncaESLint;
2723
2844
  test,
2724
2845
  typescript,
2725
2846
  unicorn,
2847
+ unocss,
2726
2848
  vinicuncaESLint,
2727
2849
  vue,
2728
2850
  yaml