@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.cjs +308 -192
- package/dist/index.d.cts +120 -93
- package/dist/index.d.ts +120 -93
- package/dist/index.js +321 -193
- package/package.json +17 -12
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,66 +71,13 @@ __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
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;
|
|
@@ -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);
|
|
@@ -1172,10 +1147,11 @@ var GLOB_JSON5 = "**/*.json5";
|
|
|
1172
1147
|
var GLOB_JSONC = "**/*.jsonc";
|
|
1173
1148
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
1174
1149
|
var GLOB_MARKDOWN = "**/*.md";
|
|
1150
|
+
var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
1175
1151
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
1176
1152
|
|
|
1177
1153
|
// src/configs/ignores.ts
|
|
1178
|
-
function ignores({
|
|
1154
|
+
async function ignores({
|
|
1179
1155
|
enableGitignore = true,
|
|
1180
1156
|
items = [],
|
|
1181
1157
|
replace = false
|
|
@@ -1207,7 +1183,7 @@ function ignores({
|
|
|
1207
1183
|
}
|
|
1208
1184
|
|
|
1209
1185
|
// src/configs/imports.ts
|
|
1210
|
-
function imports() {
|
|
1186
|
+
async function imports() {
|
|
1211
1187
|
return [
|
|
1212
1188
|
{
|
|
1213
1189
|
name: "vinicunca:imports",
|
|
@@ -1238,7 +1214,7 @@ function imports() {
|
|
|
1238
1214
|
|
|
1239
1215
|
// src/configs/javascript.ts
|
|
1240
1216
|
var import_globals = __toESM(require("globals"), 1);
|
|
1241
|
-
function javascript(options = {}) {
|
|
1217
|
+
async function javascript(options = {}) {
|
|
1242
1218
|
const {
|
|
1243
1219
|
isInEditor = false,
|
|
1244
1220
|
overrides = {}
|
|
@@ -1255,7 +1231,9 @@ function javascript(options = {}) {
|
|
|
1255
1231
|
window: "readonly"
|
|
1256
1232
|
},
|
|
1257
1233
|
parserOptions: {
|
|
1258
|
-
ecmaFeatures: {
|
|
1234
|
+
ecmaFeatures: {
|
|
1235
|
+
jsx: true
|
|
1236
|
+
},
|
|
1259
1237
|
ecmaVersion: 2022,
|
|
1260
1238
|
sourceType: "module"
|
|
1261
1239
|
},
|
|
@@ -1276,7 +1254,6 @@ function javascript(options = {}) {
|
|
|
1276
1254
|
setWithoutGet: true
|
|
1277
1255
|
}],
|
|
1278
1256
|
"array-callback-return": [ERROR, { checkForEach: true }],
|
|
1279
|
-
"arrow-parens": [ERROR, ALWAYS],
|
|
1280
1257
|
"block-scoped-var": ERROR,
|
|
1281
1258
|
"camelcase": [ERROR, {
|
|
1282
1259
|
allow: ["^UNSAFE_"],
|
|
@@ -1527,13 +1504,35 @@ function javascript(options = {}) {
|
|
|
1527
1504
|
];
|
|
1528
1505
|
}
|
|
1529
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
|
+
|
|
1530
1528
|
// src/configs/jsdoc.ts
|
|
1531
|
-
function jsdoc() {
|
|
1529
|
+
async function jsdoc() {
|
|
1532
1530
|
return [
|
|
1533
1531
|
{
|
|
1534
1532
|
name: "vinicunca:jsdoc",
|
|
1535
1533
|
plugins: {
|
|
1536
|
-
|
|
1534
|
+
// @ts-expect-error missing types
|
|
1535
|
+
jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
|
|
1537
1536
|
},
|
|
1538
1537
|
rules: {
|
|
1539
1538
|
"jsdoc/check-access": WARN,
|
|
@@ -1561,10 +1560,22 @@ function jsdoc() {
|
|
|
1561
1560
|
}
|
|
1562
1561
|
|
|
1563
1562
|
// src/configs/jsonc.ts
|
|
1564
|
-
function jsonc(options = {}) {
|
|
1563
|
+
async function jsonc(options = {}) {
|
|
1565
1564
|
const {
|
|
1566
|
-
|
|
1565
|
+
files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
1566
|
+
overrides = {},
|
|
1567
|
+
stylistic: stylistic2 = true
|
|
1567
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
|
+
]);
|
|
1568
1579
|
return [
|
|
1569
1580
|
{
|
|
1570
1581
|
name: "vinicunca:jsonc:setup",
|
|
@@ -1573,17 +1584,12 @@ function jsonc(options = {}) {
|
|
|
1573
1584
|
}
|
|
1574
1585
|
},
|
|
1575
1586
|
{
|
|
1576
|
-
files
|
|
1587
|
+
files,
|
|
1577
1588
|
languageOptions: {
|
|
1578
|
-
parser:
|
|
1589
|
+
parser: parserJsonc
|
|
1579
1590
|
},
|
|
1580
1591
|
name: "vinicunca:jsonc:rules",
|
|
1581
1592
|
rules: {
|
|
1582
|
-
"jsonc/array-bracket-spacing": [ERROR, NEVER],
|
|
1583
|
-
"jsonc/comma-dangle": [ERROR, NEVER],
|
|
1584
|
-
"jsonc/comma-style": [ERROR, "last"],
|
|
1585
|
-
"jsonc/indent": [ERROR, 2],
|
|
1586
|
-
"jsonc/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
|
|
1587
1593
|
"jsonc/no-bigint-literals": ERROR,
|
|
1588
1594
|
"jsonc/no-binary-expression": ERROR,
|
|
1589
1595
|
"jsonc/no-binary-numeric-literals": ERROR,
|
|
@@ -1607,14 +1613,21 @@ function jsonc(options = {}) {
|
|
|
1607
1613
|
"jsonc/no-undefined-value": ERROR,
|
|
1608
1614
|
"jsonc/no-unicode-codepoint-escapes": ERROR,
|
|
1609
1615
|
"jsonc/no-useless-escape": ERROR,
|
|
1610
|
-
"jsonc/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
|
|
1611
|
-
"jsonc/object-curly-spacing": [ERROR, "always"],
|
|
1612
|
-
"jsonc/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
|
|
1613
|
-
"jsonc/quote-props": ERROR,
|
|
1614
|
-
"jsonc/quotes": ERROR,
|
|
1615
1616
|
"jsonc/space-unary-ops": ERROR,
|
|
1616
1617
|
"jsonc/valid-json-number": ERROR,
|
|
1617
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
|
+
} : {},
|
|
1618
1631
|
...overrides
|
|
1619
1632
|
}
|
|
1620
1633
|
}
|
|
@@ -1622,18 +1635,26 @@ function jsonc(options = {}) {
|
|
|
1622
1635
|
}
|
|
1623
1636
|
|
|
1624
1637
|
// src/configs/markdown.ts
|
|
1625
|
-
function markdown(options = {}) {
|
|
1638
|
+
async function markdown(options = {}) {
|
|
1626
1639
|
const {
|
|
1627
1640
|
componentExts = [],
|
|
1641
|
+
files = [GLOB_MARKDOWN],
|
|
1628
1642
|
overrides = {}
|
|
1629
1643
|
} = options;
|
|
1630
1644
|
return [
|
|
1631
1645
|
{
|
|
1632
1646
|
name: "vinicunca:markdown:setup",
|
|
1633
1647
|
plugins: {
|
|
1634
|
-
|
|
1648
|
+
// @ts-expect-error missing types
|
|
1649
|
+
markdown: await interopDefault(import("eslint-plugin-markdown"))
|
|
1635
1650
|
}
|
|
1636
1651
|
},
|
|
1652
|
+
{
|
|
1653
|
+
files,
|
|
1654
|
+
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
1655
|
+
name: "vinicunca:markdown:processor",
|
|
1656
|
+
processor: "markdown/markdown"
|
|
1657
|
+
},
|
|
1637
1658
|
{
|
|
1638
1659
|
files: [GLOB_MARKDOWN],
|
|
1639
1660
|
name: "vinicunca:markdown:processor",
|
|
@@ -1651,8 +1672,9 @@ function markdown(options = {}) {
|
|
|
1651
1672
|
}
|
|
1652
1673
|
}
|
|
1653
1674
|
},
|
|
1654
|
-
name: "vinicunca:markdown:
|
|
1675
|
+
name: "vinicunca:markdown:disables",
|
|
1655
1676
|
rules: {
|
|
1677
|
+
"import/newline-after-import": OFF,
|
|
1656
1678
|
"no-alert": OFF,
|
|
1657
1679
|
"no-console": OFF,
|
|
1658
1680
|
"no-undef": OFF,
|
|
@@ -1690,7 +1712,6 @@ function markdown(options = {}) {
|
|
|
1690
1712
|
"ts/restrict-template-expressions": OFF,
|
|
1691
1713
|
"ts/unbound-method": OFF
|
|
1692
1714
|
},
|
|
1693
|
-
"vinicunca/no-cjs-exports": OFF,
|
|
1694
1715
|
"vinicunca/no-ts-export-equal": OFF,
|
|
1695
1716
|
...overrides
|
|
1696
1717
|
}
|
|
@@ -1699,7 +1720,7 @@ function markdown(options = {}) {
|
|
|
1699
1720
|
}
|
|
1700
1721
|
|
|
1701
1722
|
// src/configs/node.ts
|
|
1702
|
-
function node() {
|
|
1723
|
+
async function node() {
|
|
1703
1724
|
return [
|
|
1704
1725
|
{
|
|
1705
1726
|
name: "vinicunca:node",
|
|
@@ -1723,23 +1744,46 @@ function node() {
|
|
|
1723
1744
|
|
|
1724
1745
|
// src/configs/react.ts
|
|
1725
1746
|
var STR_PARENS_NEW_LINE = "parens-new-line";
|
|
1726
|
-
function react(options = {}) {
|
|
1747
|
+
async function react(options = {}) {
|
|
1727
1748
|
const {
|
|
1749
|
+
files = [GLOB_JSX, GLOB_TSX],
|
|
1728
1750
|
overrides = {}
|
|
1729
1751
|
} = options;
|
|
1752
|
+
const [
|
|
1753
|
+
pluginReact,
|
|
1754
|
+
pluginReactHooks
|
|
1755
|
+
] = await Promise.all([
|
|
1756
|
+
// @ts-expect-error missing types
|
|
1757
|
+
interopDefault(import("eslint-plugin-react")),
|
|
1758
|
+
// @ts-expect-error missing types
|
|
1759
|
+
interopDefault(import("eslint-plugin-react-hooks"))
|
|
1760
|
+
]);
|
|
1730
1761
|
return [
|
|
1731
1762
|
{
|
|
1732
1763
|
name: "vinicunca:react:setup",
|
|
1733
1764
|
plugins: {
|
|
1734
|
-
"react":
|
|
1735
|
-
"react-hooks":
|
|
1765
|
+
"react": pluginReact,
|
|
1766
|
+
"react-hooks": pluginReactHooks
|
|
1767
|
+
},
|
|
1768
|
+
settings: {
|
|
1769
|
+
react: {
|
|
1770
|
+
version: "detect"
|
|
1771
|
+
}
|
|
1736
1772
|
}
|
|
1737
1773
|
},
|
|
1738
1774
|
{
|
|
1775
|
+
files,
|
|
1776
|
+
languageOptions: {
|
|
1777
|
+
parserOptions: {
|
|
1778
|
+
ecmaFeatures: {
|
|
1779
|
+
jsx: true
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
},
|
|
1739
1783
|
name: "vinicunca:react:rules",
|
|
1740
1784
|
rules: {
|
|
1741
|
-
...
|
|
1742
|
-
...
|
|
1785
|
+
...pluginReact.configs.recommended.rules,
|
|
1786
|
+
...pluginReactHooks.configs.recommended.rules,
|
|
1743
1787
|
"react/boolean-prop-naming": [OFF, {
|
|
1744
1788
|
message: "",
|
|
1745
1789
|
propTypeNames: ["bool", "mutuallyExclusiveTrueProps"],
|
|
@@ -1799,24 +1843,19 @@ function react(options = {}) {
|
|
|
1799
1843
|
return: STR_PARENS_NEW_LINE
|
|
1800
1844
|
}],
|
|
1801
1845
|
"react/no-danger": WARN,
|
|
1846
|
+
"react/no-unescaped-entities": OFF,
|
|
1802
1847
|
"react/prop-types": OFF,
|
|
1803
1848
|
"react/react-in-jsx-scope": OFF,
|
|
1804
1849
|
"react/self-closing-comp": ERROR,
|
|
1805
1850
|
"react/style-prop-object": ERROR,
|
|
1806
|
-
"style/jsx-quotes": [ERROR, "prefer-double"],
|
|
1807
1851
|
...overrides
|
|
1808
|
-
},
|
|
1809
|
-
settings: {
|
|
1810
|
-
react: {
|
|
1811
|
-
version: "detect"
|
|
1812
|
-
}
|
|
1813
1852
|
}
|
|
1814
1853
|
}
|
|
1815
1854
|
];
|
|
1816
1855
|
}
|
|
1817
1856
|
|
|
1818
1857
|
// src/configs/sort-package-json.ts
|
|
1819
|
-
function sortPackageJson() {
|
|
1858
|
+
async function sortPackageJson() {
|
|
1820
1859
|
return [
|
|
1821
1860
|
{
|
|
1822
1861
|
files: ["**/package.json"],
|
|
@@ -2032,12 +2071,27 @@ function sortTsconfig() {
|
|
|
2032
2071
|
}
|
|
2033
2072
|
|
|
2034
2073
|
// src/configs/stylistic.ts
|
|
2035
|
-
|
|
2074
|
+
var STYLISTIC_CONFIG_DEFAULTS = {
|
|
2075
|
+
indent: 2,
|
|
2076
|
+
jsx: true,
|
|
2077
|
+
quotes: "single",
|
|
2078
|
+
semi: true
|
|
2079
|
+
};
|
|
2080
|
+
async function stylistic(options = {}) {
|
|
2081
|
+
const {
|
|
2082
|
+
indent,
|
|
2083
|
+
quotes,
|
|
2084
|
+
semi
|
|
2085
|
+
} = {
|
|
2086
|
+
...STYLISTIC_CONFIG_DEFAULTS,
|
|
2087
|
+
...options
|
|
2088
|
+
};
|
|
2089
|
+
const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
|
|
2036
2090
|
return [
|
|
2037
2091
|
{
|
|
2038
2092
|
name: "vinicunca:stylistic",
|
|
2039
2093
|
plugins: {
|
|
2040
|
-
style:
|
|
2094
|
+
style: pluginStylistic,
|
|
2041
2095
|
vinicunca: import_eslint_plugin_vinicunca.default
|
|
2042
2096
|
},
|
|
2043
2097
|
rules: {
|
|
@@ -2045,6 +2099,7 @@ function stylistic() {
|
|
|
2045
2099
|
"style/array-bracket-newline": [ERROR, CONSISTENT],
|
|
2046
2100
|
"style/array-bracket-spacing": [ERROR, NEVER],
|
|
2047
2101
|
"style/array-element-newline": [ERROR, CONSISTENT],
|
|
2102
|
+
"style/arrow-parens": [ERROR, ALWAYS],
|
|
2048
2103
|
"style/arrow-spacing": [ERROR, { after: true, before: true }],
|
|
2049
2104
|
"style/block-spacing": [ERROR, ALWAYS],
|
|
2050
2105
|
"style/brace-style": [ERROR],
|
|
@@ -2055,7 +2110,7 @@ function stylistic() {
|
|
|
2055
2110
|
"style/dot-location": [ERROR, "property"],
|
|
2056
2111
|
"style/eol-last": ERROR,
|
|
2057
2112
|
"style/func-call-spacing": [ERROR, NEVER],
|
|
2058
|
-
"style/indent": [ERROR,
|
|
2113
|
+
"style/indent": [ERROR, indent, {
|
|
2059
2114
|
ArrayExpression: 1,
|
|
2060
2115
|
CallExpression: { arguments: 1 },
|
|
2061
2116
|
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
@@ -2093,6 +2148,7 @@ function stylistic() {
|
|
|
2093
2148
|
offsetTernaryExpressions: true,
|
|
2094
2149
|
outerIIFEBody: 1
|
|
2095
2150
|
}],
|
|
2151
|
+
"style/indent-binary-ops": [ERROR, indent],
|
|
2096
2152
|
"style/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
|
|
2097
2153
|
"style/keyword-spacing": [ERROR, { after: true, before: true }],
|
|
2098
2154
|
"style/lines-between-class-members": [ERROR, ALWAYS, { exceptAfterSingleLine: true }],
|
|
@@ -2122,9 +2178,9 @@ function stylistic() {
|
|
|
2122
2178
|
"style/operator-linebreak": [ERROR, "before"],
|
|
2123
2179
|
"style/padded-blocks": [ERROR, { blocks: NEVER, classes: NEVER, switches: NEVER }],
|
|
2124
2180
|
"style/quote-props": [ERROR, "consistent-as-needed"],
|
|
2125
|
-
"style/quotes": [ERROR,
|
|
2181
|
+
"style/quotes": [ERROR, quotes],
|
|
2126
2182
|
"style/rest-spread-spacing": [ERROR, NEVER],
|
|
2127
|
-
"style/semi": [ERROR, ALWAYS],
|
|
2183
|
+
"style/semi": [ERROR, semi ? ALWAYS : NEVER],
|
|
2128
2184
|
"style/semi-spacing": [ERROR, { after: true, before: false }],
|
|
2129
2185
|
"style/space-before-blocks": [ERROR, ALWAYS],
|
|
2130
2186
|
"style/space-before-function-paren": [ERROR, {
|
|
@@ -2168,27 +2224,36 @@ function stylistic() {
|
|
|
2168
2224
|
}
|
|
2169
2225
|
|
|
2170
2226
|
// src/configs/test.ts
|
|
2171
|
-
function test(options = {}) {
|
|
2227
|
+
async function test(options = {}) {
|
|
2172
2228
|
const {
|
|
2229
|
+
files = GLOB_TESTS,
|
|
2173
2230
|
isInEditor = false,
|
|
2174
2231
|
overrides = {}
|
|
2175
2232
|
} = options;
|
|
2233
|
+
const [
|
|
2234
|
+
pluginVitest,
|
|
2235
|
+
pluginNoOnlyTests
|
|
2236
|
+
] = await Promise.all([
|
|
2237
|
+
interopDefault(import("eslint-plugin-vitest")),
|
|
2238
|
+
// @ts-expect-error missing types
|
|
2239
|
+
interopDefault(import("eslint-plugin-no-only-tests"))
|
|
2240
|
+
]);
|
|
2176
2241
|
return [
|
|
2177
2242
|
{
|
|
2178
2243
|
name: "vinicunca:test:setup",
|
|
2179
2244
|
plugins: {
|
|
2180
2245
|
test: {
|
|
2181
|
-
...
|
|
2246
|
+
...pluginVitest,
|
|
2182
2247
|
rules: {
|
|
2183
|
-
...
|
|
2248
|
+
...pluginVitest.rules,
|
|
2184
2249
|
// extend `test/no-only-tests` rule
|
|
2185
|
-
...
|
|
2250
|
+
...pluginNoOnlyTests.rules
|
|
2186
2251
|
}
|
|
2187
2252
|
}
|
|
2188
2253
|
}
|
|
2189
2254
|
},
|
|
2190
2255
|
{
|
|
2191
|
-
files
|
|
2256
|
+
files,
|
|
2192
2257
|
name: "vinicunca:test:rules",
|
|
2193
2258
|
rules: {
|
|
2194
2259
|
"test/consistent-test-it": [ERROR, { fn: "it", withinDescribe: "it" }],
|
|
@@ -2204,31 +2269,17 @@ function test(options = {}) {
|
|
|
2204
2269
|
|
|
2205
2270
|
// src/configs/typescript.ts
|
|
2206
2271
|
var import_node_process = __toESM(require("process"), 1);
|
|
2207
|
-
|
|
2208
|
-
// src/utils.ts
|
|
2209
|
-
function combineConfigs(...configs) {
|
|
2210
|
-
return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
|
|
2211
|
-
}
|
|
2212
|
-
function renameRules(rules, from, to) {
|
|
2213
|
-
return Object.fromEntries(
|
|
2214
|
-
Object.entries(rules).map(([key, value]) => {
|
|
2215
|
-
if (key.startsWith(from)) {
|
|
2216
|
-
return [to + key.slice(from.length), value];
|
|
2217
|
-
}
|
|
2218
|
-
;
|
|
2219
|
-
return [key, value];
|
|
2220
|
-
})
|
|
2221
|
-
);
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
|
-
// src/configs/typescript.ts
|
|
2225
|
-
function typescript(options) {
|
|
2272
|
+
async function typescript(options = {}) {
|
|
2226
2273
|
const {
|
|
2227
2274
|
componentExts = [],
|
|
2228
2275
|
overrides = {},
|
|
2229
2276
|
parserOptions = {},
|
|
2230
2277
|
tsconfigPath = []
|
|
2231
2278
|
} = options ?? {};
|
|
2279
|
+
const files = options.files ?? [
|
|
2280
|
+
GLOB_SRC,
|
|
2281
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
2282
|
+
];
|
|
2232
2283
|
const typeAwareRules = {
|
|
2233
2284
|
"dot-notation": OFF,
|
|
2234
2285
|
"no-implied-eval": OFF,
|
|
@@ -2253,21 +2304,28 @@ function typescript(options) {
|
|
|
2253
2304
|
};
|
|
2254
2305
|
additionalTypeAwareRules = typeAwareRules;
|
|
2255
2306
|
}
|
|
2307
|
+
const [
|
|
2308
|
+
pluginTs,
|
|
2309
|
+
parserTs,
|
|
2310
|
+
pluginStylistic
|
|
2311
|
+
] = await Promise.all([
|
|
2312
|
+
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
2313
|
+
interopDefault(import("@typescript-eslint/parser")),
|
|
2314
|
+
interopDefault(import("@stylistic/eslint-plugin"))
|
|
2315
|
+
]);
|
|
2256
2316
|
return [
|
|
2257
2317
|
{
|
|
2258
2318
|
// Install the plugins without globs, so they can be configured separately.
|
|
2259
2319
|
name: "vinicunca:typescript:setup",
|
|
2260
2320
|
plugins: {
|
|
2261
2321
|
import: pluginImport,
|
|
2262
|
-
|
|
2322
|
+
style: pluginStylistic,
|
|
2323
|
+
ts: pluginTs,
|
|
2263
2324
|
vinicunca: import_eslint_plugin_vinicunca.default
|
|
2264
2325
|
}
|
|
2265
2326
|
},
|
|
2266
2327
|
{
|
|
2267
|
-
files
|
|
2268
|
-
GLOB_SRC,
|
|
2269
|
-
...componentExts.map((ext) => `**/*.${ext}`)
|
|
2270
|
-
],
|
|
2328
|
+
files,
|
|
2271
2329
|
languageOptions: {
|
|
2272
2330
|
parser: parserTs,
|
|
2273
2331
|
parserOptions: {
|
|
@@ -2280,12 +2338,12 @@ function typescript(options) {
|
|
|
2280
2338
|
name: "vinicunca:typescript:rules",
|
|
2281
2339
|
rules: {
|
|
2282
2340
|
...renameRules(
|
|
2283
|
-
|
|
2341
|
+
pluginTs.configs["eslint-recommended"].overrides[0].rules,
|
|
2284
2342
|
"@typescript-eslint/",
|
|
2285
2343
|
"ts/"
|
|
2286
2344
|
),
|
|
2287
2345
|
...renameRules(
|
|
2288
|
-
|
|
2346
|
+
pluginTs.configs.strict.rules,
|
|
2289
2347
|
"@typescript-eslint/",
|
|
2290
2348
|
"ts/"
|
|
2291
2349
|
),
|
|
@@ -2296,6 +2354,8 @@ function typescript(options) {
|
|
|
2296
2354
|
"no-unused-vars": OFF,
|
|
2297
2355
|
"no-use-before-define": OFF,
|
|
2298
2356
|
"no-useless-constructor": OFF,
|
|
2357
|
+
"style/type-generic-spacing": ERROR,
|
|
2358
|
+
"style/type-named-tuple-spacing": ERROR,
|
|
2299
2359
|
"ts/ban-ts-comment": [ERROR, { "ts-ignore": "allow-with-description" }],
|
|
2300
2360
|
"ts/ban-types": [ERROR, { types: { Function: false } }],
|
|
2301
2361
|
"ts/consistent-type-definitions": [ERROR, "interface"],
|
|
@@ -2324,9 +2384,6 @@ function typescript(options) {
|
|
|
2324
2384
|
"ts/parameter-properties": OFF,
|
|
2325
2385
|
"ts/prefer-ts-expect-error": ERROR,
|
|
2326
2386
|
"ts/triple-slash-reference": OFF,
|
|
2327
|
-
"vinicunca/generic-spacing": ERROR,
|
|
2328
|
-
"vinicunca/named-tuple-spacing": ERROR,
|
|
2329
|
-
"vinicunca/no-cjs-exports": ERROR,
|
|
2330
2387
|
"vinicunca/no-ts-export-equal": ERROR,
|
|
2331
2388
|
...additionalTypeAwareRules,
|
|
2332
2389
|
...overrides
|
|
@@ -2360,7 +2417,7 @@ function typescript(options) {
|
|
|
2360
2417
|
}
|
|
2361
2418
|
|
|
2362
2419
|
// src/configs/unicorn.ts
|
|
2363
|
-
function unicorn(options = {}) {
|
|
2420
|
+
async function unicorn(options = {}) {
|
|
2364
2421
|
const {
|
|
2365
2422
|
overrides = {}
|
|
2366
2423
|
} = options;
|
|
@@ -2390,13 +2447,48 @@ function unicorn(options = {}) {
|
|
|
2390
2447
|
];
|
|
2391
2448
|
}
|
|
2392
2449
|
|
|
2450
|
+
// src/configs/unocss.ts
|
|
2451
|
+
async function unocss(options = {}) {
|
|
2452
|
+
const {
|
|
2453
|
+
attributify = false,
|
|
2454
|
+
strict = false
|
|
2455
|
+
} = options;
|
|
2456
|
+
const [
|
|
2457
|
+
pluginUnoCSS
|
|
2458
|
+
] = await Promise.all([
|
|
2459
|
+
interopDefault(import("@unocss/eslint-plugin"))
|
|
2460
|
+
]);
|
|
2461
|
+
return [
|
|
2462
|
+
{
|
|
2463
|
+
name: "vinicunca:unocss",
|
|
2464
|
+
plugins: {
|
|
2465
|
+
unocss: pluginUnoCSS
|
|
2466
|
+
},
|
|
2467
|
+
rules: {
|
|
2468
|
+
"unocss/order": "warn",
|
|
2469
|
+
...attributify ? {
|
|
2470
|
+
"unocss/order-attributify": "warn"
|
|
2471
|
+
} : {},
|
|
2472
|
+
...strict ? {
|
|
2473
|
+
"unocss/blocklist": "error"
|
|
2474
|
+
} : {}
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
];
|
|
2478
|
+
}
|
|
2479
|
+
|
|
2393
2480
|
// src/configs/vue.ts
|
|
2394
2481
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
2395
|
-
function vue(options = {}) {
|
|
2482
|
+
async function vue(options = {}) {
|
|
2396
2483
|
const {
|
|
2484
|
+
files = [GLOB_VUE],
|
|
2397
2485
|
overrides = {},
|
|
2486
|
+
stylistic: stylistic2 = true,
|
|
2398
2487
|
typescript: typescript2 = {}
|
|
2399
2488
|
} = options;
|
|
2489
|
+
const {
|
|
2490
|
+
indent = 2
|
|
2491
|
+
} = isBoolean(stylistic2) ? {} : stylistic2;
|
|
2400
2492
|
let tsConfigOptions = {};
|
|
2401
2493
|
const tsconfigPath = typescript2.tsconfigPath ?? [];
|
|
2402
2494
|
if (!isEmpty(tsconfigPath)) {
|
|
@@ -2405,34 +2497,42 @@ function vue(options = {}) {
|
|
|
2405
2497
|
tsconfigRootDir: import_node_process2.default.cwd()
|
|
2406
2498
|
};
|
|
2407
2499
|
}
|
|
2500
|
+
const [
|
|
2501
|
+
pluginVue,
|
|
2502
|
+
parserVue
|
|
2503
|
+
] = await Promise.all([
|
|
2504
|
+
// @ts-expect-error missing types
|
|
2505
|
+
interopDefault(import("eslint-plugin-vue")),
|
|
2506
|
+
interopDefault(import("vue-eslint-parser"))
|
|
2507
|
+
]);
|
|
2408
2508
|
return [
|
|
2409
2509
|
{
|
|
2410
2510
|
name: "vinicunca:vue:setup",
|
|
2411
2511
|
plugins: {
|
|
2412
|
-
vue:
|
|
2512
|
+
vue: pluginVue
|
|
2413
2513
|
}
|
|
2414
2514
|
},
|
|
2415
2515
|
{
|
|
2416
|
-
files
|
|
2516
|
+
files,
|
|
2417
2517
|
languageOptions: {
|
|
2418
|
-
parser:
|
|
2518
|
+
parser: parserVue,
|
|
2419
2519
|
parserOptions: {
|
|
2420
2520
|
ecmaFeatures: {
|
|
2421
2521
|
jsx: true
|
|
2422
2522
|
},
|
|
2423
2523
|
extraFileExtensions: [".vue"],
|
|
2424
|
-
parser: typescript2.enabled ?
|
|
2524
|
+
parser: typescript2.enabled ? await interopDefault(import("@typescript-eslint/parser")) : null,
|
|
2425
2525
|
sourceType: "module",
|
|
2426
2526
|
...tsConfigOptions
|
|
2427
2527
|
}
|
|
2428
2528
|
},
|
|
2429
2529
|
name: "vinicunca:vue:rules",
|
|
2430
|
-
processor:
|
|
2530
|
+
processor: pluginVue.processors[".vue"],
|
|
2431
2531
|
rules: {
|
|
2432
|
-
...
|
|
2433
|
-
...
|
|
2434
|
-
...
|
|
2435
|
-
...
|
|
2532
|
+
...pluginVue.configs.base.rules,
|
|
2533
|
+
...pluginVue.configs["vue3-essential"].rules,
|
|
2534
|
+
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
2535
|
+
...pluginVue.configs["vue3-recommended"].rules,
|
|
2436
2536
|
"node/prefer-global/process": OFF,
|
|
2437
2537
|
"vue/array-bracket-spacing": [ERROR, NEVER],
|
|
2438
2538
|
"vue/arrow-spacing": [ERROR, {
|
|
@@ -2466,6 +2566,7 @@ function vue(options = {}) {
|
|
|
2466
2566
|
"vue/html-comment-content-spacing": [ERROR, ALWAYS, {
|
|
2467
2567
|
exceptions: ["-"]
|
|
2468
2568
|
}],
|
|
2569
|
+
"vue/html-indent": [ERROR, indent],
|
|
2469
2570
|
"vue/key-spacing": [ERROR, {
|
|
2470
2571
|
afterColon: true,
|
|
2471
2572
|
beforeColon: false
|
|
@@ -2525,10 +2626,23 @@ function vue(options = {}) {
|
|
|
2525
2626
|
}
|
|
2526
2627
|
|
|
2527
2628
|
// src/configs/yaml.ts
|
|
2528
|
-
function yaml(options = {}) {
|
|
2629
|
+
async function yaml(options = {}) {
|
|
2529
2630
|
const {
|
|
2530
|
-
|
|
2631
|
+
files = [GLOB_YAML],
|
|
2632
|
+
overrides = {},
|
|
2633
|
+
stylistic: stylistic2 = true
|
|
2531
2634
|
} = options;
|
|
2635
|
+
const {
|
|
2636
|
+
indent = 2,
|
|
2637
|
+
quotes = "single"
|
|
2638
|
+
} = isBoolean(stylistic2) ? {} : stylistic2;
|
|
2639
|
+
const [
|
|
2640
|
+
pluginYaml,
|
|
2641
|
+
parserYaml
|
|
2642
|
+
] = await Promise.all([
|
|
2643
|
+
interopDefault(import("eslint-plugin-yml")),
|
|
2644
|
+
interopDefault(import("yaml-eslint-parser"))
|
|
2645
|
+
]);
|
|
2532
2646
|
return [
|
|
2533
2647
|
{
|
|
2534
2648
|
name: "vinicunca:yaml:setup",
|
|
@@ -2537,9 +2651,9 @@ function yaml(options = {}) {
|
|
|
2537
2651
|
}
|
|
2538
2652
|
},
|
|
2539
2653
|
{
|
|
2540
|
-
files
|
|
2654
|
+
files,
|
|
2541
2655
|
languageOptions: {
|
|
2542
|
-
parser:
|
|
2656
|
+
parser: parserYaml
|
|
2543
2657
|
},
|
|
2544
2658
|
name: "vinicunca:yaml:rules",
|
|
2545
2659
|
rules: {
|
|
@@ -2552,14 +2666,14 @@ function yaml(options = {}) {
|
|
|
2552
2666
|
"yaml/flow-mapping-curly-spacing": ERROR,
|
|
2553
2667
|
"yaml/flow-sequence-bracket-newline": ERROR,
|
|
2554
2668
|
"yaml/flow-sequence-bracket-spacing": ERROR,
|
|
2555
|
-
"yaml/indent": [ERROR, 2],
|
|
2669
|
+
"yaml/indent": [ERROR, indent === "tab" ? 2 : indent],
|
|
2556
2670
|
"yaml/key-spacing": ERROR,
|
|
2557
2671
|
"yaml/no-empty-key": ERROR,
|
|
2558
2672
|
"yaml/no-empty-sequence-entry": ERROR,
|
|
2559
2673
|
"yaml/no-irregular-whitespace": ERROR,
|
|
2560
2674
|
"yaml/no-tab-indent": ERROR,
|
|
2561
2675
|
"yaml/plain-scalar": ERROR,
|
|
2562
|
-
"yaml/quotes": [ERROR, { avoidEscape: false, prefer:
|
|
2676
|
+
"yaml/quotes": [ERROR, { avoidEscape: false, prefer: quotes }],
|
|
2563
2677
|
"yaml/spaced-comment": ERROR,
|
|
2564
2678
|
"yaml/vue-custom-block/no-parsing-error": ERROR,
|
|
2565
2679
|
...overrides
|
|
@@ -2575,7 +2689,7 @@ var VuePackages = [
|
|
|
2575
2689
|
"vitepress",
|
|
2576
2690
|
"@slidev/cli"
|
|
2577
2691
|
];
|
|
2578
|
-
function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
2692
|
+
async function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
2579
2693
|
const {
|
|
2580
2694
|
componentExts = [],
|
|
2581
2695
|
isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !import_node_process3.default.env.CI),
|
|
@@ -2583,14 +2697,24 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2583
2697
|
markdown: enableMarkdown = true,
|
|
2584
2698
|
overrides = {},
|
|
2585
2699
|
react: enableReact = false,
|
|
2586
|
-
stylistic: enableStylistic = true,
|
|
2587
2700
|
test: enableTest = true,
|
|
2588
2701
|
typescript: tsOptions = {},
|
|
2702
|
+
unocss: enableUnoCSS = false,
|
|
2589
2703
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg.isPackageExists)(i)),
|
|
2590
2704
|
yaml: enableYaml = true
|
|
2591
2705
|
} = options;
|
|
2706
|
+
let stylisticOptions = true;
|
|
2707
|
+
if (options.stylistic === false) {
|
|
2708
|
+
stylisticOptions = false;
|
|
2709
|
+
} else if (isObject(options.stylistic)) {
|
|
2710
|
+
stylisticOptions = {
|
|
2711
|
+
...options.stylistic,
|
|
2712
|
+
jsx: options.jsx ?? true
|
|
2713
|
+
};
|
|
2714
|
+
}
|
|
2592
2715
|
const configs = [];
|
|
2593
2716
|
configs.push(
|
|
2717
|
+
ignores(options.ignores),
|
|
2594
2718
|
javascript({
|
|
2595
2719
|
isInEditor,
|
|
2596
2720
|
overrides: overrides.javascript
|
|
@@ -2615,7 +2739,7 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2615
2739
|
overrides: overrides.typescript
|
|
2616
2740
|
}));
|
|
2617
2741
|
}
|
|
2618
|
-
if (
|
|
2742
|
+
if (stylisticOptions) {
|
|
2619
2743
|
configs.push(stylistic());
|
|
2620
2744
|
}
|
|
2621
2745
|
if (enableTest) {
|
|
@@ -2635,10 +2759,21 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2635
2759
|
}));
|
|
2636
2760
|
}
|
|
2637
2761
|
;
|
|
2762
|
+
if (enableReact) {
|
|
2763
|
+
configs.push(react({
|
|
2764
|
+
overrides: overrides.react
|
|
2765
|
+
}));
|
|
2766
|
+
}
|
|
2767
|
+
if (enableUnoCSS) {
|
|
2768
|
+
configs.push(unocss(
|
|
2769
|
+
isBoolean(enableUnoCSS) ? {} : enableUnoCSS
|
|
2770
|
+
));
|
|
2771
|
+
}
|
|
2638
2772
|
if (enableJsonc) {
|
|
2639
2773
|
configs.push(
|
|
2640
2774
|
jsonc({
|
|
2641
|
-
overrides: overrides.jsonc
|
|
2775
|
+
overrides: overrides.jsonc,
|
|
2776
|
+
stylistic: stylisticOptions
|
|
2642
2777
|
}),
|
|
2643
2778
|
sortPackageJson(),
|
|
2644
2779
|
sortTsconfig()
|
|
@@ -2646,7 +2781,8 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2646
2781
|
}
|
|
2647
2782
|
if (enableYaml) {
|
|
2648
2783
|
configs.push(yaml({
|
|
2649
|
-
overrides: overrides.yaml
|
|
2784
|
+
overrides: overrides.yaml,
|
|
2785
|
+
stylistic: stylisticOptions
|
|
2650
2786
|
}));
|
|
2651
2787
|
}
|
|
2652
2788
|
;
|
|
@@ -2657,20 +2793,12 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2657
2793
|
}));
|
|
2658
2794
|
}
|
|
2659
2795
|
;
|
|
2660
|
-
if (enableReact) {
|
|
2661
|
-
configs.push(react({
|
|
2662
|
-
overrides: overrides.react
|
|
2663
|
-
}));
|
|
2664
|
-
}
|
|
2665
2796
|
configs.push(ignores(options.ignores));
|
|
2666
2797
|
return combineConfigs(
|
|
2667
2798
|
...configs,
|
|
2668
2799
|
...userConfigs
|
|
2669
2800
|
);
|
|
2670
2801
|
}
|
|
2671
|
-
|
|
2672
|
-
// src/index.ts
|
|
2673
|
-
var src_default = vinicuncaESLint;
|
|
2674
2802
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2675
2803
|
0 && (module.exports = {
|
|
2676
2804
|
GLOB_EXCLUDE,
|
|
@@ -2681,6 +2809,7 @@ var src_default = vinicuncaESLint;
|
|
|
2681
2809
|
GLOB_JSX,
|
|
2682
2810
|
GLOB_MARKDOWN,
|
|
2683
2811
|
GLOB_MARKDOWN_CODE,
|
|
2812
|
+
GLOB_MARKDOWN_IN_MARKDOWN,
|
|
2684
2813
|
GLOB_SRC,
|
|
2685
2814
|
GLOB_SRC_EXT,
|
|
2686
2815
|
GLOB_TESTS,
|
|
@@ -2692,33 +2821,19 @@ var src_default = vinicuncaESLint;
|
|
|
2692
2821
|
comments,
|
|
2693
2822
|
ignores,
|
|
2694
2823
|
imports,
|
|
2824
|
+
interopDefault,
|
|
2695
2825
|
javascript,
|
|
2696
2826
|
jsdoc,
|
|
2697
2827
|
jsonc,
|
|
2698
2828
|
markdown,
|
|
2699
2829
|
node,
|
|
2700
|
-
parserJsonc,
|
|
2701
|
-
parserTs,
|
|
2702
|
-
parserVue,
|
|
2703
|
-
parserYaml,
|
|
2704
2830
|
pluginComments,
|
|
2705
2831
|
pluginImport,
|
|
2706
|
-
pluginJsdoc,
|
|
2707
|
-
pluginJsonc,
|
|
2708
|
-
pluginMarkdown,
|
|
2709
|
-
pluginNoOnlyTests,
|
|
2710
2832
|
pluginNode,
|
|
2711
2833
|
pluginPerfectionist,
|
|
2712
|
-
pluginReact,
|
|
2713
|
-
pluginReactHooks,
|
|
2714
|
-
pluginStylistic,
|
|
2715
|
-
pluginTs,
|
|
2716
2834
|
pluginUnicorn,
|
|
2717
2835
|
pluginUnusedImports,
|
|
2718
2836
|
pluginVinicunca,
|
|
2719
|
-
pluginVitest,
|
|
2720
|
-
pluginVue,
|
|
2721
|
-
pluginYaml,
|
|
2722
2837
|
react,
|
|
2723
2838
|
renameRules,
|
|
2724
2839
|
sortPackageJson,
|
|
@@ -2727,6 +2842,7 @@ var src_default = vinicuncaESLint;
|
|
|
2727
2842
|
test,
|
|
2728
2843
|
typescript,
|
|
2729
2844
|
unicorn,
|
|
2845
|
+
unocss,
|
|
2730
2846
|
vinicuncaESLint,
|
|
2731
2847
|
vue,
|
|
2732
2848
|
yaml
|