@vinicunca/eslint-config 2.0.11 → 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 +308 -190
- package/dist/index.d.cts +120 -93
- package/dist/index.d.ts +120 -93
- package/dist/index.js +321 -191
- 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,
|
|
@@ -1699,7 +1721,7 @@ function markdown(options = {}) {
|
|
|
1699
1721
|
}
|
|
1700
1722
|
|
|
1701
1723
|
// src/configs/node.ts
|
|
1702
|
-
function node() {
|
|
1724
|
+
async function node() {
|
|
1703
1725
|
return [
|
|
1704
1726
|
{
|
|
1705
1727
|
name: "vinicunca:node",
|
|
@@ -1723,23 +1745,46 @@ function node() {
|
|
|
1723
1745
|
|
|
1724
1746
|
// src/configs/react.ts
|
|
1725
1747
|
var STR_PARENS_NEW_LINE = "parens-new-line";
|
|
1726
|
-
function react(options = {}) {
|
|
1748
|
+
async function react(options = {}) {
|
|
1727
1749
|
const {
|
|
1750
|
+
files = [GLOB_JSX, GLOB_TSX],
|
|
1728
1751
|
overrides = {}
|
|
1729
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
|
+
]);
|
|
1730
1762
|
return [
|
|
1731
1763
|
{
|
|
1732
1764
|
name: "vinicunca:react:setup",
|
|
1733
1765
|
plugins: {
|
|
1734
|
-
"react":
|
|
1735
|
-
"react-hooks":
|
|
1766
|
+
"react": pluginReact,
|
|
1767
|
+
"react-hooks": pluginReactHooks
|
|
1768
|
+
},
|
|
1769
|
+
settings: {
|
|
1770
|
+
react: {
|
|
1771
|
+
version: "detect"
|
|
1772
|
+
}
|
|
1736
1773
|
}
|
|
1737
1774
|
},
|
|
1738
1775
|
{
|
|
1776
|
+
files,
|
|
1777
|
+
languageOptions: {
|
|
1778
|
+
parserOptions: {
|
|
1779
|
+
ecmaFeatures: {
|
|
1780
|
+
jsx: true
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
},
|
|
1739
1784
|
name: "vinicunca:react:rules",
|
|
1740
1785
|
rules: {
|
|
1741
|
-
...
|
|
1742
|
-
...
|
|
1786
|
+
...pluginReact.configs.recommended.rules,
|
|
1787
|
+
...pluginReactHooks.configs.recommended.rules,
|
|
1743
1788
|
"react/boolean-prop-naming": [OFF, {
|
|
1744
1789
|
message: "",
|
|
1745
1790
|
propTypeNames: ["bool", "mutuallyExclusiveTrueProps"],
|
|
@@ -1799,24 +1844,19 @@ function react(options = {}) {
|
|
|
1799
1844
|
return: STR_PARENS_NEW_LINE
|
|
1800
1845
|
}],
|
|
1801
1846
|
"react/no-danger": WARN,
|
|
1847
|
+
"react/no-unescaped-entities": OFF,
|
|
1802
1848
|
"react/prop-types": OFF,
|
|
1803
1849
|
"react/react-in-jsx-scope": OFF,
|
|
1804
1850
|
"react/self-closing-comp": ERROR,
|
|
1805
1851
|
"react/style-prop-object": ERROR,
|
|
1806
|
-
"style/jsx-quotes": [ERROR, "prefer-double"],
|
|
1807
1852
|
...overrides
|
|
1808
|
-
},
|
|
1809
|
-
settings: {
|
|
1810
|
-
react: {
|
|
1811
|
-
version: "detect"
|
|
1812
|
-
}
|
|
1813
1853
|
}
|
|
1814
1854
|
}
|
|
1815
1855
|
];
|
|
1816
1856
|
}
|
|
1817
1857
|
|
|
1818
1858
|
// src/configs/sort-package-json.ts
|
|
1819
|
-
function sortPackageJson() {
|
|
1859
|
+
async function sortPackageJson() {
|
|
1820
1860
|
return [
|
|
1821
1861
|
{
|
|
1822
1862
|
files: ["**/package.json"],
|
|
@@ -2032,12 +2072,27 @@ function sortTsconfig() {
|
|
|
2032
2072
|
}
|
|
2033
2073
|
|
|
2034
2074
|
// src/configs/stylistic.ts
|
|
2035
|
-
|
|
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"));
|
|
2036
2091
|
return [
|
|
2037
2092
|
{
|
|
2038
2093
|
name: "vinicunca:stylistic",
|
|
2039
2094
|
plugins: {
|
|
2040
|
-
style:
|
|
2095
|
+
style: pluginStylistic,
|
|
2041
2096
|
vinicunca: import_eslint_plugin_vinicunca.default
|
|
2042
2097
|
},
|
|
2043
2098
|
rules: {
|
|
@@ -2045,6 +2100,7 @@ function stylistic() {
|
|
|
2045
2100
|
"style/array-bracket-newline": [ERROR, CONSISTENT],
|
|
2046
2101
|
"style/array-bracket-spacing": [ERROR, NEVER],
|
|
2047
2102
|
"style/array-element-newline": [ERROR, CONSISTENT],
|
|
2103
|
+
"style/arrow-parens": [ERROR, ALWAYS],
|
|
2048
2104
|
"style/arrow-spacing": [ERROR, { after: true, before: true }],
|
|
2049
2105
|
"style/block-spacing": [ERROR, ALWAYS],
|
|
2050
2106
|
"style/brace-style": [ERROR],
|
|
@@ -2055,7 +2111,7 @@ function stylistic() {
|
|
|
2055
2111
|
"style/dot-location": [ERROR, "property"],
|
|
2056
2112
|
"style/eol-last": ERROR,
|
|
2057
2113
|
"style/func-call-spacing": [ERROR, NEVER],
|
|
2058
|
-
"style/indent": [ERROR,
|
|
2114
|
+
"style/indent": [ERROR, indent, {
|
|
2059
2115
|
ArrayExpression: 1,
|
|
2060
2116
|
CallExpression: { arguments: 1 },
|
|
2061
2117
|
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
@@ -2093,6 +2149,7 @@ function stylistic() {
|
|
|
2093
2149
|
offsetTernaryExpressions: true,
|
|
2094
2150
|
outerIIFEBody: 1
|
|
2095
2151
|
}],
|
|
2152
|
+
"style/indent-binary-ops": [ERROR, indent],
|
|
2096
2153
|
"style/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
|
|
2097
2154
|
"style/keyword-spacing": [ERROR, { after: true, before: true }],
|
|
2098
2155
|
"style/lines-between-class-members": [ERROR, ALWAYS, { exceptAfterSingleLine: true }],
|
|
@@ -2122,9 +2179,9 @@ function stylistic() {
|
|
|
2122
2179
|
"style/operator-linebreak": [ERROR, "before"],
|
|
2123
2180
|
"style/padded-blocks": [ERROR, { blocks: NEVER, classes: NEVER, switches: NEVER }],
|
|
2124
2181
|
"style/quote-props": [ERROR, "consistent-as-needed"],
|
|
2125
|
-
"style/quotes": [ERROR,
|
|
2182
|
+
"style/quotes": [ERROR, quotes],
|
|
2126
2183
|
"style/rest-spread-spacing": [ERROR, NEVER],
|
|
2127
|
-
"style/semi": [ERROR, ALWAYS],
|
|
2184
|
+
"style/semi": [ERROR, semi ? ALWAYS : NEVER],
|
|
2128
2185
|
"style/semi-spacing": [ERROR, { after: true, before: false }],
|
|
2129
2186
|
"style/space-before-blocks": [ERROR, ALWAYS],
|
|
2130
2187
|
"style/space-before-function-paren": [ERROR, {
|
|
@@ -2168,27 +2225,36 @@ function stylistic() {
|
|
|
2168
2225
|
}
|
|
2169
2226
|
|
|
2170
2227
|
// src/configs/test.ts
|
|
2171
|
-
function test(options = {}) {
|
|
2228
|
+
async function test(options = {}) {
|
|
2172
2229
|
const {
|
|
2230
|
+
files = GLOB_TESTS,
|
|
2173
2231
|
isInEditor = false,
|
|
2174
2232
|
overrides = {}
|
|
2175
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
|
+
]);
|
|
2176
2242
|
return [
|
|
2177
2243
|
{
|
|
2178
2244
|
name: "vinicunca:test:setup",
|
|
2179
2245
|
plugins: {
|
|
2180
2246
|
test: {
|
|
2181
|
-
...
|
|
2247
|
+
...pluginVitest,
|
|
2182
2248
|
rules: {
|
|
2183
|
-
...
|
|
2249
|
+
...pluginVitest.rules,
|
|
2184
2250
|
// extend `test/no-only-tests` rule
|
|
2185
|
-
...
|
|
2251
|
+
...pluginNoOnlyTests.rules
|
|
2186
2252
|
}
|
|
2187
2253
|
}
|
|
2188
2254
|
}
|
|
2189
2255
|
},
|
|
2190
2256
|
{
|
|
2191
|
-
files
|
|
2257
|
+
files,
|
|
2192
2258
|
name: "vinicunca:test:rules",
|
|
2193
2259
|
rules: {
|
|
2194
2260
|
"test/consistent-test-it": [ERROR, { fn: "it", withinDescribe: "it" }],
|
|
@@ -2204,31 +2270,17 @@ function test(options = {}) {
|
|
|
2204
2270
|
|
|
2205
2271
|
// src/configs/typescript.ts
|
|
2206
2272
|
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) {
|
|
2273
|
+
async function typescript(options = {}) {
|
|
2226
2274
|
const {
|
|
2227
2275
|
componentExts = [],
|
|
2228
2276
|
overrides = {},
|
|
2229
2277
|
parserOptions = {},
|
|
2230
2278
|
tsconfigPath = []
|
|
2231
2279
|
} = options ?? {};
|
|
2280
|
+
const files = options.files ?? [
|
|
2281
|
+
GLOB_SRC,
|
|
2282
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
2283
|
+
];
|
|
2232
2284
|
const typeAwareRules = {
|
|
2233
2285
|
"dot-notation": OFF,
|
|
2234
2286
|
"no-implied-eval": OFF,
|
|
@@ -2253,21 +2305,28 @@ function typescript(options) {
|
|
|
2253
2305
|
};
|
|
2254
2306
|
additionalTypeAwareRules = typeAwareRules;
|
|
2255
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
|
+
]);
|
|
2256
2317
|
return [
|
|
2257
2318
|
{
|
|
2258
2319
|
// Install the plugins without globs, so they can be configured separately.
|
|
2259
2320
|
name: "vinicunca:typescript:setup",
|
|
2260
2321
|
plugins: {
|
|
2261
2322
|
import: pluginImport,
|
|
2262
|
-
|
|
2323
|
+
style: pluginStylistic,
|
|
2324
|
+
ts: pluginTs,
|
|
2263
2325
|
vinicunca: import_eslint_plugin_vinicunca.default
|
|
2264
2326
|
}
|
|
2265
2327
|
},
|
|
2266
2328
|
{
|
|
2267
|
-
files
|
|
2268
|
-
GLOB_SRC,
|
|
2269
|
-
...componentExts.map((ext) => `**/*.${ext}`)
|
|
2270
|
-
],
|
|
2329
|
+
files,
|
|
2271
2330
|
languageOptions: {
|
|
2272
2331
|
parser: parserTs,
|
|
2273
2332
|
parserOptions: {
|
|
@@ -2280,12 +2339,12 @@ function typescript(options) {
|
|
|
2280
2339
|
name: "vinicunca:typescript:rules",
|
|
2281
2340
|
rules: {
|
|
2282
2341
|
...renameRules(
|
|
2283
|
-
|
|
2342
|
+
pluginTs.configs["eslint-recommended"].overrides[0].rules,
|
|
2284
2343
|
"@typescript-eslint/",
|
|
2285
2344
|
"ts/"
|
|
2286
2345
|
),
|
|
2287
2346
|
...renameRules(
|
|
2288
|
-
|
|
2347
|
+
pluginTs.configs.strict.rules,
|
|
2289
2348
|
"@typescript-eslint/",
|
|
2290
2349
|
"ts/"
|
|
2291
2350
|
),
|
|
@@ -2296,6 +2355,8 @@ function typescript(options) {
|
|
|
2296
2355
|
"no-unused-vars": OFF,
|
|
2297
2356
|
"no-use-before-define": OFF,
|
|
2298
2357
|
"no-useless-constructor": OFF,
|
|
2358
|
+
"style/type-generic-spacing": ERROR,
|
|
2359
|
+
"style/type-named-tuple-spacing": ERROR,
|
|
2299
2360
|
"ts/ban-ts-comment": [ERROR, { "ts-ignore": "allow-with-description" }],
|
|
2300
2361
|
"ts/ban-types": [ERROR, { types: { Function: false } }],
|
|
2301
2362
|
"ts/consistent-type-definitions": [ERROR, "interface"],
|
|
@@ -2324,8 +2385,6 @@ function typescript(options) {
|
|
|
2324
2385
|
"ts/parameter-properties": OFF,
|
|
2325
2386
|
"ts/prefer-ts-expect-error": ERROR,
|
|
2326
2387
|
"ts/triple-slash-reference": OFF,
|
|
2327
|
-
"vinicunca/generic-spacing": ERROR,
|
|
2328
|
-
"vinicunca/named-tuple-spacing": ERROR,
|
|
2329
2388
|
"vinicunca/no-cjs-exports": ERROR,
|
|
2330
2389
|
"vinicunca/no-ts-export-equal": ERROR,
|
|
2331
2390
|
...additionalTypeAwareRules,
|
|
@@ -2360,7 +2419,7 @@ function typescript(options) {
|
|
|
2360
2419
|
}
|
|
2361
2420
|
|
|
2362
2421
|
// src/configs/unicorn.ts
|
|
2363
|
-
function unicorn(options = {}) {
|
|
2422
|
+
async function unicorn(options = {}) {
|
|
2364
2423
|
const {
|
|
2365
2424
|
overrides = {}
|
|
2366
2425
|
} = options;
|
|
@@ -2390,13 +2449,48 @@ function unicorn(options = {}) {
|
|
|
2390
2449
|
];
|
|
2391
2450
|
}
|
|
2392
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
|
+
|
|
2393
2482
|
// src/configs/vue.ts
|
|
2394
2483
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
2395
|
-
function vue(options = {}) {
|
|
2484
|
+
async function vue(options = {}) {
|
|
2396
2485
|
const {
|
|
2486
|
+
files = [GLOB_VUE],
|
|
2397
2487
|
overrides = {},
|
|
2488
|
+
stylistic: stylistic2 = true,
|
|
2398
2489
|
typescript: typescript2 = {}
|
|
2399
2490
|
} = options;
|
|
2491
|
+
const {
|
|
2492
|
+
indent = 2
|
|
2493
|
+
} = isBoolean(stylistic2) ? {} : stylistic2;
|
|
2400
2494
|
let tsConfigOptions = {};
|
|
2401
2495
|
const tsconfigPath = typescript2.tsconfigPath ?? [];
|
|
2402
2496
|
if (!isEmpty(tsconfigPath)) {
|
|
@@ -2405,34 +2499,42 @@ function vue(options = {}) {
|
|
|
2405
2499
|
tsconfigRootDir: import_node_process2.default.cwd()
|
|
2406
2500
|
};
|
|
2407
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
|
+
]);
|
|
2408
2510
|
return [
|
|
2409
2511
|
{
|
|
2410
2512
|
name: "vinicunca:vue:setup",
|
|
2411
2513
|
plugins: {
|
|
2412
|
-
vue:
|
|
2514
|
+
vue: pluginVue
|
|
2413
2515
|
}
|
|
2414
2516
|
},
|
|
2415
2517
|
{
|
|
2416
|
-
files
|
|
2518
|
+
files,
|
|
2417
2519
|
languageOptions: {
|
|
2418
|
-
parser:
|
|
2520
|
+
parser: parserVue,
|
|
2419
2521
|
parserOptions: {
|
|
2420
2522
|
ecmaFeatures: {
|
|
2421
2523
|
jsx: true
|
|
2422
2524
|
},
|
|
2423
2525
|
extraFileExtensions: [".vue"],
|
|
2424
|
-
parser: typescript2.enabled ?
|
|
2526
|
+
parser: typescript2.enabled ? await interopDefault(import("@typescript-eslint/parser")) : null,
|
|
2425
2527
|
sourceType: "module",
|
|
2426
2528
|
...tsConfigOptions
|
|
2427
2529
|
}
|
|
2428
2530
|
},
|
|
2429
2531
|
name: "vinicunca:vue:rules",
|
|
2430
|
-
processor:
|
|
2532
|
+
processor: pluginVue.processors[".vue"],
|
|
2431
2533
|
rules: {
|
|
2432
|
-
...
|
|
2433
|
-
...
|
|
2434
|
-
...
|
|
2435
|
-
...
|
|
2534
|
+
...pluginVue.configs.base.rules,
|
|
2535
|
+
...pluginVue.configs["vue3-essential"].rules,
|
|
2536
|
+
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
2537
|
+
...pluginVue.configs["vue3-recommended"].rules,
|
|
2436
2538
|
"node/prefer-global/process": OFF,
|
|
2437
2539
|
"vue/array-bracket-spacing": [ERROR, NEVER],
|
|
2438
2540
|
"vue/arrow-spacing": [ERROR, {
|
|
@@ -2466,6 +2568,7 @@ function vue(options = {}) {
|
|
|
2466
2568
|
"vue/html-comment-content-spacing": [ERROR, ALWAYS, {
|
|
2467
2569
|
exceptions: ["-"]
|
|
2468
2570
|
}],
|
|
2571
|
+
"vue/html-indent": [ERROR, indent],
|
|
2469
2572
|
"vue/key-spacing": [ERROR, {
|
|
2470
2573
|
afterColon: true,
|
|
2471
2574
|
beforeColon: false
|
|
@@ -2525,10 +2628,23 @@ function vue(options = {}) {
|
|
|
2525
2628
|
}
|
|
2526
2629
|
|
|
2527
2630
|
// src/configs/yaml.ts
|
|
2528
|
-
function yaml(options = {}) {
|
|
2631
|
+
async function yaml(options = {}) {
|
|
2529
2632
|
const {
|
|
2530
|
-
|
|
2633
|
+
files = [GLOB_YAML],
|
|
2634
|
+
overrides = {},
|
|
2635
|
+
stylistic: stylistic2 = true
|
|
2531
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
|
+
]);
|
|
2532
2648
|
return [
|
|
2533
2649
|
{
|
|
2534
2650
|
name: "vinicunca:yaml:setup",
|
|
@@ -2537,9 +2653,9 @@ function yaml(options = {}) {
|
|
|
2537
2653
|
}
|
|
2538
2654
|
},
|
|
2539
2655
|
{
|
|
2540
|
-
files
|
|
2656
|
+
files,
|
|
2541
2657
|
languageOptions: {
|
|
2542
|
-
parser:
|
|
2658
|
+
parser: parserYaml
|
|
2543
2659
|
},
|
|
2544
2660
|
name: "vinicunca:yaml:rules",
|
|
2545
2661
|
rules: {
|
|
@@ -2552,14 +2668,14 @@ function yaml(options = {}) {
|
|
|
2552
2668
|
"yaml/flow-mapping-curly-spacing": ERROR,
|
|
2553
2669
|
"yaml/flow-sequence-bracket-newline": ERROR,
|
|
2554
2670
|
"yaml/flow-sequence-bracket-spacing": ERROR,
|
|
2555
|
-
"yaml/indent": [ERROR, 2],
|
|
2671
|
+
"yaml/indent": [ERROR, indent === "tab" ? 2 : indent],
|
|
2556
2672
|
"yaml/key-spacing": ERROR,
|
|
2557
2673
|
"yaml/no-empty-key": ERROR,
|
|
2558
2674
|
"yaml/no-empty-sequence-entry": ERROR,
|
|
2559
2675
|
"yaml/no-irregular-whitespace": ERROR,
|
|
2560
2676
|
"yaml/no-tab-indent": ERROR,
|
|
2561
2677
|
"yaml/plain-scalar": ERROR,
|
|
2562
|
-
"yaml/quotes": [ERROR, { avoidEscape: false, prefer:
|
|
2678
|
+
"yaml/quotes": [ERROR, { avoidEscape: false, prefer: quotes }],
|
|
2563
2679
|
"yaml/spaced-comment": ERROR,
|
|
2564
2680
|
"yaml/vue-custom-block/no-parsing-error": ERROR,
|
|
2565
2681
|
...overrides
|
|
@@ -2575,7 +2691,7 @@ var VuePackages = [
|
|
|
2575
2691
|
"vitepress",
|
|
2576
2692
|
"@slidev/cli"
|
|
2577
2693
|
];
|
|
2578
|
-
function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
2694
|
+
async function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
2579
2695
|
const {
|
|
2580
2696
|
componentExts = [],
|
|
2581
2697
|
isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !import_node_process3.default.env.CI),
|
|
@@ -2583,14 +2699,24 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2583
2699
|
markdown: enableMarkdown = true,
|
|
2584
2700
|
overrides = {},
|
|
2585
2701
|
react: enableReact = false,
|
|
2586
|
-
stylistic: enableStylistic = true,
|
|
2587
2702
|
test: enableTest = true,
|
|
2588
2703
|
typescript: tsOptions = {},
|
|
2704
|
+
unocss: enableUnoCSS = false,
|
|
2589
2705
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg.isPackageExists)(i)),
|
|
2590
2706
|
yaml: enableYaml = true
|
|
2591
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
|
+
}
|
|
2592
2717
|
const configs = [];
|
|
2593
2718
|
configs.push(
|
|
2719
|
+
ignores(options.ignores),
|
|
2594
2720
|
javascript({
|
|
2595
2721
|
isInEditor,
|
|
2596
2722
|
overrides: overrides.javascript
|
|
@@ -2615,7 +2741,7 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2615
2741
|
overrides: overrides.typescript
|
|
2616
2742
|
}));
|
|
2617
2743
|
}
|
|
2618
|
-
if (
|
|
2744
|
+
if (stylisticOptions) {
|
|
2619
2745
|
configs.push(stylistic());
|
|
2620
2746
|
}
|
|
2621
2747
|
if (enableTest) {
|
|
@@ -2635,10 +2761,21 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2635
2761
|
}));
|
|
2636
2762
|
}
|
|
2637
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
|
+
}
|
|
2638
2774
|
if (enableJsonc) {
|
|
2639
2775
|
configs.push(
|
|
2640
2776
|
jsonc({
|
|
2641
|
-
overrides: overrides.jsonc
|
|
2777
|
+
overrides: overrides.jsonc,
|
|
2778
|
+
stylistic: stylisticOptions
|
|
2642
2779
|
}),
|
|
2643
2780
|
sortPackageJson(),
|
|
2644
2781
|
sortTsconfig()
|
|
@@ -2646,7 +2783,8 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2646
2783
|
}
|
|
2647
2784
|
if (enableYaml) {
|
|
2648
2785
|
configs.push(yaml({
|
|
2649
|
-
overrides: overrides.yaml
|
|
2786
|
+
overrides: overrides.yaml,
|
|
2787
|
+
stylistic: stylisticOptions
|
|
2650
2788
|
}));
|
|
2651
2789
|
}
|
|
2652
2790
|
;
|
|
@@ -2657,20 +2795,12 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2657
2795
|
}));
|
|
2658
2796
|
}
|
|
2659
2797
|
;
|
|
2660
|
-
if (enableReact) {
|
|
2661
|
-
configs.push(react({
|
|
2662
|
-
overrides: overrides.react
|
|
2663
|
-
}));
|
|
2664
|
-
}
|
|
2665
2798
|
configs.push(ignores(options.ignores));
|
|
2666
2799
|
return combineConfigs(
|
|
2667
2800
|
...configs,
|
|
2668
2801
|
...userConfigs
|
|
2669
2802
|
);
|
|
2670
2803
|
}
|
|
2671
|
-
|
|
2672
|
-
// src/index.ts
|
|
2673
|
-
var src_default = vinicuncaESLint;
|
|
2674
2804
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2675
2805
|
0 && (module.exports = {
|
|
2676
2806
|
GLOB_EXCLUDE,
|
|
@@ -2681,6 +2811,7 @@ var src_default = vinicuncaESLint;
|
|
|
2681
2811
|
GLOB_JSX,
|
|
2682
2812
|
GLOB_MARKDOWN,
|
|
2683
2813
|
GLOB_MARKDOWN_CODE,
|
|
2814
|
+
GLOB_MARKDOWN_IN_MARKDOWN,
|
|
2684
2815
|
GLOB_SRC,
|
|
2685
2816
|
GLOB_SRC_EXT,
|
|
2686
2817
|
GLOB_TESTS,
|
|
@@ -2692,33 +2823,19 @@ var src_default = vinicuncaESLint;
|
|
|
2692
2823
|
comments,
|
|
2693
2824
|
ignores,
|
|
2694
2825
|
imports,
|
|
2826
|
+
interopDefault,
|
|
2695
2827
|
javascript,
|
|
2696
2828
|
jsdoc,
|
|
2697
2829
|
jsonc,
|
|
2698
2830
|
markdown,
|
|
2699
2831
|
node,
|
|
2700
|
-
parserJsonc,
|
|
2701
|
-
parserTs,
|
|
2702
|
-
parserVue,
|
|
2703
|
-
parserYaml,
|
|
2704
2832
|
pluginComments,
|
|
2705
2833
|
pluginImport,
|
|
2706
|
-
pluginJsdoc,
|
|
2707
|
-
pluginJsonc,
|
|
2708
|
-
pluginMarkdown,
|
|
2709
|
-
pluginNoOnlyTests,
|
|
2710
2834
|
pluginNode,
|
|
2711
2835
|
pluginPerfectionist,
|
|
2712
|
-
pluginReact,
|
|
2713
|
-
pluginReactHooks,
|
|
2714
|
-
pluginStylistic,
|
|
2715
|
-
pluginTs,
|
|
2716
2836
|
pluginUnicorn,
|
|
2717
2837
|
pluginUnusedImports,
|
|
2718
2838
|
pluginVinicunca,
|
|
2719
|
-
pluginVitest,
|
|
2720
|
-
pluginVue,
|
|
2721
|
-
pluginYaml,
|
|
2722
2839
|
react,
|
|
2723
2840
|
renameRules,
|
|
2724
2841
|
sortPackageJson,
|
|
@@ -2727,6 +2844,7 @@ var src_default = vinicuncaESLint;
|
|
|
2727
2844
|
test,
|
|
2728
2845
|
typescript,
|
|
2729
2846
|
unicorn,
|
|
2847
|
+
unocss,
|
|
2730
2848
|
vinicuncaESLint,
|
|
2731
2849
|
vue,
|
|
2732
2850
|
yaml
|