@vinicunca/eslint-config 2.0.0 → 2.0.1
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 +114 -75
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +114 -75
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -91,9 +91,62 @@ __export(src_exports, {
|
|
|
91
91
|
module.exports = __toCommonJS(src_exports);
|
|
92
92
|
|
|
93
93
|
// src/base.ts
|
|
94
|
-
var
|
|
94
|
+
var import_node_process3 = __toESM(require("process"), 1);
|
|
95
95
|
var import_local_pkg = require("local-pkg");
|
|
96
96
|
|
|
97
|
+
// src/flags.ts
|
|
98
|
+
var ERROR = "error";
|
|
99
|
+
var OFF = "off";
|
|
100
|
+
var WARN = "warn";
|
|
101
|
+
var CONSISTENT = "consistent";
|
|
102
|
+
var NEVER = "never";
|
|
103
|
+
var ALWAYS = "always";
|
|
104
|
+
|
|
105
|
+
// src/plugins.ts
|
|
106
|
+
var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
107
|
+
var import_eslint_plugin_vinicunca = __toESM(require("@vinicunca/eslint-plugin-vinicunca"), 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_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
111
|
+
var pluginImport = __toESM(require("eslint-plugin-i"), 1);
|
|
112
|
+
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
113
|
+
var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
114
|
+
var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
|
|
115
|
+
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
116
|
+
var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
|
|
117
|
+
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
118
|
+
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 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_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
122
|
+
var pluginYaml = __toESM(require("eslint-plugin-yml"), 1);
|
|
123
|
+
var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
|
|
124
|
+
var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
|
|
125
|
+
var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
|
|
126
|
+
var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
|
|
127
|
+
|
|
128
|
+
// src/configs/comments.ts
|
|
129
|
+
function comments() {
|
|
130
|
+
return [
|
|
131
|
+
{
|
|
132
|
+
name: "vinicunca:eslint-comments",
|
|
133
|
+
plugins: {
|
|
134
|
+
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
135
|
+
},
|
|
136
|
+
rules: {
|
|
137
|
+
"eslint-comments/no-aggregating-enable": ERROR,
|
|
138
|
+
"eslint-comments/no-duplicate-disable": ERROR,
|
|
139
|
+
"eslint-comments/no-unlimited-disable": ERROR,
|
|
140
|
+
"eslint-comments/no-unused-enable": ERROR
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/configs/ignores.ts
|
|
147
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
148
|
+
var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
|
|
149
|
+
|
|
97
150
|
// ../node_modules/.pnpm/@vinicunca+perkakas@0.0.10/node_modules/@vinicunca/perkakas/dist/index.js
|
|
98
151
|
function purry(fn, args, lazy) {
|
|
99
152
|
const diff = fn.length - args.length;
|
|
@@ -111,8 +164,8 @@ function purry(fn, args, lazy) {
|
|
|
111
164
|
}
|
|
112
165
|
throw new Error("Wrong number of arguments");
|
|
113
166
|
}
|
|
114
|
-
function
|
|
115
|
-
return
|
|
167
|
+
function isArray(data) {
|
|
168
|
+
return Array.isArray(data);
|
|
116
169
|
}
|
|
117
170
|
function isDefined(data) {
|
|
118
171
|
return typeof data !== "undefined" && data !== null;
|
|
@@ -123,6 +176,27 @@ function isDefined(data) {
|
|
|
123
176
|
}
|
|
124
177
|
isDefined2.strict = strict;
|
|
125
178
|
})(isDefined || (isDefined = {}));
|
|
179
|
+
function toString(value) {
|
|
180
|
+
return Object.prototype.toString.call(value);
|
|
181
|
+
}
|
|
182
|
+
function isObject(data) {
|
|
183
|
+
return toString(data) === "[object Object]";
|
|
184
|
+
}
|
|
185
|
+
function isString(data) {
|
|
186
|
+
return typeof data === "string";
|
|
187
|
+
}
|
|
188
|
+
function isEmpty(data) {
|
|
189
|
+
if (isArray(data) || isString(data)) {
|
|
190
|
+
return data.length === 0;
|
|
191
|
+
}
|
|
192
|
+
if (isObject(data)) {
|
|
193
|
+
for (const _ in data) {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
return !(data instanceof RegExp);
|
|
197
|
+
}
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
126
200
|
function _countBy(indexed) {
|
|
127
201
|
return (array, fn) => {
|
|
128
202
|
return array.reduce((ret, item, index) => {
|
|
@@ -1047,59 +1121,6 @@ function toPairs(object) {
|
|
|
1047
1121
|
toPairs2.strict = strict;
|
|
1048
1122
|
})(toPairs || (toPairs = {}));
|
|
1049
1123
|
|
|
1050
|
-
// src/flags.ts
|
|
1051
|
-
var ERROR = "error";
|
|
1052
|
-
var OFF = "off";
|
|
1053
|
-
var WARN = "warn";
|
|
1054
|
-
var CONSISTENT = "consistent";
|
|
1055
|
-
var NEVER = "never";
|
|
1056
|
-
var ALWAYS = "always";
|
|
1057
|
-
|
|
1058
|
-
// src/plugins.ts
|
|
1059
|
-
var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
1060
|
-
var import_eslint_plugin_vinicunca = __toESM(require("@vinicunca/eslint-plugin-vinicunca"), 1);
|
|
1061
|
-
var import_eslint_plugin2 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
1062
|
-
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
1063
|
-
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
1064
|
-
var pluginImport = __toESM(require("eslint-plugin-i"), 1);
|
|
1065
|
-
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
1066
|
-
var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
1067
|
-
var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
|
|
1068
|
-
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
1069
|
-
var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
|
|
1070
|
-
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
1071
|
-
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
1072
|
-
var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
|
|
1073
|
-
var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
|
|
1074
|
-
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
1075
|
-
var pluginYaml = __toESM(require("eslint-plugin-yml"), 1);
|
|
1076
|
-
var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
|
|
1077
|
-
var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
|
|
1078
|
-
var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
|
|
1079
|
-
var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
|
|
1080
|
-
|
|
1081
|
-
// src/configs/comments.ts
|
|
1082
|
-
function comments() {
|
|
1083
|
-
return [
|
|
1084
|
-
{
|
|
1085
|
-
name: "vinicunca:eslint-comments",
|
|
1086
|
-
plugins: {
|
|
1087
|
-
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
1088
|
-
},
|
|
1089
|
-
rules: {
|
|
1090
|
-
"eslint-comments/no-aggregating-enable": ERROR,
|
|
1091
|
-
"eslint-comments/no-duplicate-disable": ERROR,
|
|
1092
|
-
"eslint-comments/no-unlimited-disable": ERROR,
|
|
1093
|
-
"eslint-comments/no-unused-enable": ERROR
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
];
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
// src/configs/ignores.ts
|
|
1100
|
-
var import_node_fs = __toESM(require("fs"), 1);
|
|
1101
|
-
var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
|
|
1102
|
-
|
|
1103
1124
|
// src/globs.ts
|
|
1104
1125
|
var GLOB_JS = "**/*.?([cm])js";
|
|
1105
1126
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
@@ -2184,7 +2205,7 @@ function typescript(options) {
|
|
|
2184
2205
|
componentExts = [],
|
|
2185
2206
|
overrides = {},
|
|
2186
2207
|
parserOptions = {},
|
|
2187
|
-
tsconfigPath
|
|
2208
|
+
tsconfigPath = []
|
|
2188
2209
|
} = options ?? {};
|
|
2189
2210
|
const typeAwareRules = {
|
|
2190
2211
|
"dot-notation": OFF,
|
|
@@ -2197,16 +2218,19 @@ function typescript(options) {
|
|
|
2197
2218
|
"ts/no-implied-eval": ERROR,
|
|
2198
2219
|
"ts/no-misused-promises": ERROR,
|
|
2199
2220
|
"ts/no-throw-literal": ERROR,
|
|
2200
|
-
"ts/no-unnecessary-type-assertion": ERROR,
|
|
2201
|
-
"ts/no-unsafe-argument": ERROR,
|
|
2202
|
-
"ts/no-unsafe-assignment": ERROR,
|
|
2203
|
-
"ts/no-unsafe-call": ERROR,
|
|
2204
|
-
"ts/no-unsafe-member-access": ERROR,
|
|
2205
|
-
"ts/no-unsafe-return": ERROR,
|
|
2206
2221
|
"ts/restrict-plus-operands": ERROR,
|
|
2207
2222
|
"ts/restrict-template-expressions": ERROR,
|
|
2208
2223
|
"ts/unbound-method": ERROR
|
|
2209
2224
|
};
|
|
2225
|
+
let tsConfigOptions = {};
|
|
2226
|
+
let additionalTypeAwareRules = {};
|
|
2227
|
+
if (!isEmpty(tsconfigPath)) {
|
|
2228
|
+
tsConfigOptions = {
|
|
2229
|
+
project: tsconfigPath,
|
|
2230
|
+
tsconfigRootDir: import_node_process.default.cwd()
|
|
2231
|
+
};
|
|
2232
|
+
additionalTypeAwareRules = typeAwareRules;
|
|
2233
|
+
}
|
|
2210
2234
|
return [
|
|
2211
2235
|
{
|
|
2212
2236
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -2227,10 +2251,7 @@ function typescript(options) {
|
|
|
2227
2251
|
parser: parserTs,
|
|
2228
2252
|
parserOptions: {
|
|
2229
2253
|
sourceType: "module",
|
|
2230
|
-
...
|
|
2231
|
-
project: [tsconfigPath],
|
|
2232
|
-
tsconfigRootDir: import_node_process.default.cwd()
|
|
2233
|
-
} : {},
|
|
2254
|
+
...tsConfigOptions,
|
|
2234
2255
|
...parserOptions
|
|
2235
2256
|
}
|
|
2236
2257
|
},
|
|
@@ -2284,7 +2305,7 @@ function typescript(options) {
|
|
|
2284
2305
|
"vinicunca/named-tuple-spacing": ERROR,
|
|
2285
2306
|
"vinicunca/no-cjs-exports": ERROR,
|
|
2286
2307
|
"vinicunca/no-ts-export-equal": ERROR,
|
|
2287
|
-
...
|
|
2308
|
+
...additionalTypeAwareRules,
|
|
2288
2309
|
...overrides
|
|
2289
2310
|
}
|
|
2290
2311
|
},
|
|
@@ -2347,10 +2368,20 @@ function unicorn(options = {}) {
|
|
|
2347
2368
|
}
|
|
2348
2369
|
|
|
2349
2370
|
// src/configs/vue.ts
|
|
2371
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
2350
2372
|
function vue(options = {}) {
|
|
2351
2373
|
const {
|
|
2374
|
+
typescript: typescript2 = {},
|
|
2352
2375
|
overrides = {}
|
|
2353
2376
|
} = options;
|
|
2377
|
+
let tsConfigOptions = {};
|
|
2378
|
+
const tsconfigPath = typescript2.tsconfigPath ?? [];
|
|
2379
|
+
if (!isEmpty(tsconfigPath)) {
|
|
2380
|
+
tsConfigOptions = {
|
|
2381
|
+
project: tsconfigPath,
|
|
2382
|
+
tsconfigRootDir: import_node_process2.default.cwd()
|
|
2383
|
+
};
|
|
2384
|
+
}
|
|
2354
2385
|
return [
|
|
2355
2386
|
{
|
|
2356
2387
|
name: "vinicunca:vue:setup",
|
|
@@ -2368,8 +2399,9 @@ function vue(options = {}) {
|
|
|
2368
2399
|
jsx: true
|
|
2369
2400
|
},
|
|
2370
2401
|
extraFileExtensions: [".vue"],
|
|
2371
|
-
parser:
|
|
2372
|
-
sourceType: "module"
|
|
2402
|
+
parser: typescript2.enabled ? parserTs : void 0,
|
|
2403
|
+
sourceType: "module",
|
|
2404
|
+
...tsConfigOptions
|
|
2373
2405
|
}
|
|
2374
2406
|
},
|
|
2375
2407
|
processor: import_eslint_plugin_vue.default.processors[".vue"],
|
|
@@ -2522,9 +2554,9 @@ var VuePackages = [
|
|
|
2522
2554
|
];
|
|
2523
2555
|
function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
2524
2556
|
const {
|
|
2525
|
-
isInEditor = !!((
|
|
2557
|
+
isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !import_node_process3.default.env.CI),
|
|
2526
2558
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg.isPackageExists)(i)),
|
|
2527
|
-
typescript:
|
|
2559
|
+
typescript: tsOptions = {},
|
|
2528
2560
|
stylistic: enableStylistic = true,
|
|
2529
2561
|
test: enableTest = true,
|
|
2530
2562
|
jsonc: enableJsonc = true,
|
|
@@ -2549,9 +2581,13 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2549
2581
|
if (enableVue) {
|
|
2550
2582
|
componentExts.push("vue");
|
|
2551
2583
|
}
|
|
2552
|
-
|
|
2584
|
+
const {
|
|
2585
|
+
enabled: tsEnabled = (0, import_local_pkg.isPackageExists)("typescript"),
|
|
2586
|
+
...tsParams
|
|
2587
|
+
} = tsOptions;
|
|
2588
|
+
if (tsEnabled) {
|
|
2553
2589
|
configs.push(typescript({
|
|
2554
|
-
|
|
2590
|
+
...tsParams,
|
|
2555
2591
|
componentExts,
|
|
2556
2592
|
overrides: overrides.typescript
|
|
2557
2593
|
}));
|
|
@@ -2568,7 +2604,10 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2568
2604
|
;
|
|
2569
2605
|
if (enableVue) {
|
|
2570
2606
|
configs.push(vue({
|
|
2571
|
-
typescript:
|
|
2607
|
+
typescript: {
|
|
2608
|
+
enabled: tsEnabled,
|
|
2609
|
+
...tsParams
|
|
2610
|
+
},
|
|
2572
2611
|
overrides: overrides.vue
|
|
2573
2612
|
}));
|
|
2574
2613
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -57,7 +57,9 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
57
57
|
*
|
|
58
58
|
* @default auto-detect based on the dependencies
|
|
59
59
|
*/
|
|
60
|
-
typescript?:
|
|
60
|
+
typescript?: OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & {
|
|
61
|
+
enabled?: boolean;
|
|
62
|
+
};
|
|
61
63
|
/**
|
|
62
64
|
* Enable JSX related rules.
|
|
63
65
|
*
|
|
@@ -159,10 +161,10 @@ interface OptionsTypeScriptWithTypes {
|
|
|
159
161
|
* When this options is provided, type aware rules will be enabled.
|
|
160
162
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
161
163
|
*/
|
|
162
|
-
tsconfigPath?: string;
|
|
164
|
+
tsconfigPath?: string[];
|
|
163
165
|
}
|
|
164
166
|
interface OptionsHasTypeScript {
|
|
165
|
-
typescript?:
|
|
167
|
+
typescript?: OptionsConfig['typescript'];
|
|
166
168
|
}
|
|
167
169
|
|
|
168
170
|
declare function vinicuncaESLint({ options, userConfigs }?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -57,7 +57,9 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
57
57
|
*
|
|
58
58
|
* @default auto-detect based on the dependencies
|
|
59
59
|
*/
|
|
60
|
-
typescript?:
|
|
60
|
+
typescript?: OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & {
|
|
61
|
+
enabled?: boolean;
|
|
62
|
+
};
|
|
61
63
|
/**
|
|
62
64
|
* Enable JSX related rules.
|
|
63
65
|
*
|
|
@@ -159,10 +161,10 @@ interface OptionsTypeScriptWithTypes {
|
|
|
159
161
|
* When this options is provided, type aware rules will be enabled.
|
|
160
162
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
161
163
|
*/
|
|
162
|
-
tsconfigPath?: string;
|
|
164
|
+
tsconfigPath?: string[];
|
|
163
165
|
}
|
|
164
166
|
interface OptionsHasTypeScript {
|
|
165
|
-
typescript?:
|
|
167
|
+
typescript?: OptionsConfig['typescript'];
|
|
166
168
|
}
|
|
167
169
|
|
|
168
170
|
declare function vinicuncaESLint({ options, userConfigs }?: {
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,60 @@
|
|
|
1
1
|
// src/base.ts
|
|
2
|
-
import
|
|
2
|
+
import process3 from "process";
|
|
3
3
|
import { isPackageExists } from "local-pkg";
|
|
4
4
|
|
|
5
|
+
// src/flags.ts
|
|
6
|
+
var ERROR = "error";
|
|
7
|
+
var OFF = "off";
|
|
8
|
+
var WARN = "warn";
|
|
9
|
+
var CONSISTENT = "consistent";
|
|
10
|
+
var NEVER = "never";
|
|
11
|
+
var ALWAYS = "always";
|
|
12
|
+
|
|
13
|
+
// src/plugins.ts
|
|
14
|
+
import { default as default2 } from "@stylistic/eslint-plugin";
|
|
15
|
+
import { default as default3 } from "@vinicunca/eslint-plugin-vinicunca";
|
|
16
|
+
import { default as default4 } from "@typescript-eslint/eslint-plugin";
|
|
17
|
+
import * as parserTs from "@typescript-eslint/parser";
|
|
18
|
+
import { default as default5 } from "eslint-plugin-eslint-comments";
|
|
19
|
+
import * as pluginImport from "eslint-plugin-i";
|
|
20
|
+
import { default as default6 } from "eslint-plugin-jsdoc";
|
|
21
|
+
import * as pluginJsonc from "eslint-plugin-jsonc";
|
|
22
|
+
import { default as default7 } from "eslint-plugin-markdown";
|
|
23
|
+
import { default as default8 } from "eslint-plugin-n";
|
|
24
|
+
import { default as default9 } from "eslint-plugin-no-only-tests";
|
|
25
|
+
import { default as default10 } from "eslint-plugin-unicorn";
|
|
26
|
+
import { default as default11 } from "eslint-plugin-unused-imports";
|
|
27
|
+
import { default as default12 } from "eslint-plugin-react";
|
|
28
|
+
import { default as default13 } from "eslint-plugin-react-hooks";
|
|
29
|
+
import { default as default14 } from "eslint-plugin-vue";
|
|
30
|
+
import * as pluginYaml from "eslint-plugin-yml";
|
|
31
|
+
import { default as default15 } from "eslint-plugin-vitest";
|
|
32
|
+
import { default as default16 } from "jsonc-eslint-parser";
|
|
33
|
+
import { default as default17 } from "vue-eslint-parser";
|
|
34
|
+
import { default as default18 } from "yaml-eslint-parser";
|
|
35
|
+
|
|
36
|
+
// src/configs/comments.ts
|
|
37
|
+
function comments() {
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
name: "vinicunca:eslint-comments",
|
|
41
|
+
plugins: {
|
|
42
|
+
"eslint-comments": default5
|
|
43
|
+
},
|
|
44
|
+
rules: {
|
|
45
|
+
"eslint-comments/no-aggregating-enable": ERROR,
|
|
46
|
+
"eslint-comments/no-duplicate-disable": ERROR,
|
|
47
|
+
"eslint-comments/no-unlimited-disable": ERROR,
|
|
48
|
+
"eslint-comments/no-unused-enable": ERROR
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/configs/ignores.ts
|
|
55
|
+
import fs from "fs";
|
|
56
|
+
import parseGitignore from "parse-gitignore";
|
|
57
|
+
|
|
5
58
|
// ../node_modules/.pnpm/@vinicunca+perkakas@0.0.10/node_modules/@vinicunca/perkakas/dist/index.js
|
|
6
59
|
function purry(fn, args, lazy) {
|
|
7
60
|
const diff = fn.length - args.length;
|
|
@@ -19,8 +72,8 @@ function purry(fn, args, lazy) {
|
|
|
19
72
|
}
|
|
20
73
|
throw new Error("Wrong number of arguments");
|
|
21
74
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
75
|
+
function isArray(data) {
|
|
76
|
+
return Array.isArray(data);
|
|
24
77
|
}
|
|
25
78
|
function isDefined(data) {
|
|
26
79
|
return typeof data !== "undefined" && data !== null;
|
|
@@ -31,6 +84,27 @@ function isDefined(data) {
|
|
|
31
84
|
}
|
|
32
85
|
isDefined2.strict = strict;
|
|
33
86
|
})(isDefined || (isDefined = {}));
|
|
87
|
+
function toString(value) {
|
|
88
|
+
return Object.prototype.toString.call(value);
|
|
89
|
+
}
|
|
90
|
+
function isObject(data) {
|
|
91
|
+
return toString(data) === "[object Object]";
|
|
92
|
+
}
|
|
93
|
+
function isString(data) {
|
|
94
|
+
return typeof data === "string";
|
|
95
|
+
}
|
|
96
|
+
function isEmpty(data) {
|
|
97
|
+
if (isArray(data) || isString(data)) {
|
|
98
|
+
return data.length === 0;
|
|
99
|
+
}
|
|
100
|
+
if (isObject(data)) {
|
|
101
|
+
for (const _ in data) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return !(data instanceof RegExp);
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
34
108
|
function _countBy(indexed) {
|
|
35
109
|
return (array, fn) => {
|
|
36
110
|
return array.reduce((ret, item, index) => {
|
|
@@ -955,59 +1029,6 @@ function toPairs(object) {
|
|
|
955
1029
|
toPairs2.strict = strict;
|
|
956
1030
|
})(toPairs || (toPairs = {}));
|
|
957
1031
|
|
|
958
|
-
// src/flags.ts
|
|
959
|
-
var ERROR = "error";
|
|
960
|
-
var OFF = "off";
|
|
961
|
-
var WARN = "warn";
|
|
962
|
-
var CONSISTENT = "consistent";
|
|
963
|
-
var NEVER = "never";
|
|
964
|
-
var ALWAYS = "always";
|
|
965
|
-
|
|
966
|
-
// src/plugins.ts
|
|
967
|
-
import { default as default2 } from "@stylistic/eslint-plugin";
|
|
968
|
-
import { default as default3 } from "@vinicunca/eslint-plugin-vinicunca";
|
|
969
|
-
import { default as default4 } from "@typescript-eslint/eslint-plugin";
|
|
970
|
-
import * as parserTs from "@typescript-eslint/parser";
|
|
971
|
-
import { default as default5 } from "eslint-plugin-eslint-comments";
|
|
972
|
-
import * as pluginImport from "eslint-plugin-i";
|
|
973
|
-
import { default as default6 } from "eslint-plugin-jsdoc";
|
|
974
|
-
import * as pluginJsonc from "eslint-plugin-jsonc";
|
|
975
|
-
import { default as default7 } from "eslint-plugin-markdown";
|
|
976
|
-
import { default as default8 } from "eslint-plugin-n";
|
|
977
|
-
import { default as default9 } from "eslint-plugin-no-only-tests";
|
|
978
|
-
import { default as default10 } from "eslint-plugin-unicorn";
|
|
979
|
-
import { default as default11 } from "eslint-plugin-unused-imports";
|
|
980
|
-
import { default as default12 } from "eslint-plugin-react";
|
|
981
|
-
import { default as default13 } from "eslint-plugin-react-hooks";
|
|
982
|
-
import { default as default14 } from "eslint-plugin-vue";
|
|
983
|
-
import * as pluginYaml from "eslint-plugin-yml";
|
|
984
|
-
import { default as default15 } from "eslint-plugin-vitest";
|
|
985
|
-
import { default as default16 } from "jsonc-eslint-parser";
|
|
986
|
-
import { default as default17 } from "vue-eslint-parser";
|
|
987
|
-
import { default as default18 } from "yaml-eslint-parser";
|
|
988
|
-
|
|
989
|
-
// src/configs/comments.ts
|
|
990
|
-
function comments() {
|
|
991
|
-
return [
|
|
992
|
-
{
|
|
993
|
-
name: "vinicunca:eslint-comments",
|
|
994
|
-
plugins: {
|
|
995
|
-
"eslint-comments": default5
|
|
996
|
-
},
|
|
997
|
-
rules: {
|
|
998
|
-
"eslint-comments/no-aggregating-enable": ERROR,
|
|
999
|
-
"eslint-comments/no-duplicate-disable": ERROR,
|
|
1000
|
-
"eslint-comments/no-unlimited-disable": ERROR,
|
|
1001
|
-
"eslint-comments/no-unused-enable": ERROR
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
];
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
// src/configs/ignores.ts
|
|
1008
|
-
import fs from "fs";
|
|
1009
|
-
import parseGitignore from "parse-gitignore";
|
|
1010
|
-
|
|
1011
1032
|
// src/globs.ts
|
|
1012
1033
|
var GLOB_JS = "**/*.?([cm])js";
|
|
1013
1034
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
@@ -2092,7 +2113,7 @@ function typescript(options) {
|
|
|
2092
2113
|
componentExts = [],
|
|
2093
2114
|
overrides = {},
|
|
2094
2115
|
parserOptions = {},
|
|
2095
|
-
tsconfigPath
|
|
2116
|
+
tsconfigPath = []
|
|
2096
2117
|
} = options ?? {};
|
|
2097
2118
|
const typeAwareRules = {
|
|
2098
2119
|
"dot-notation": OFF,
|
|
@@ -2105,16 +2126,19 @@ function typescript(options) {
|
|
|
2105
2126
|
"ts/no-implied-eval": ERROR,
|
|
2106
2127
|
"ts/no-misused-promises": ERROR,
|
|
2107
2128
|
"ts/no-throw-literal": ERROR,
|
|
2108
|
-
"ts/no-unnecessary-type-assertion": ERROR,
|
|
2109
|
-
"ts/no-unsafe-argument": ERROR,
|
|
2110
|
-
"ts/no-unsafe-assignment": ERROR,
|
|
2111
|
-
"ts/no-unsafe-call": ERROR,
|
|
2112
|
-
"ts/no-unsafe-member-access": ERROR,
|
|
2113
|
-
"ts/no-unsafe-return": ERROR,
|
|
2114
2129
|
"ts/restrict-plus-operands": ERROR,
|
|
2115
2130
|
"ts/restrict-template-expressions": ERROR,
|
|
2116
2131
|
"ts/unbound-method": ERROR
|
|
2117
2132
|
};
|
|
2133
|
+
let tsConfigOptions = {};
|
|
2134
|
+
let additionalTypeAwareRules = {};
|
|
2135
|
+
if (!isEmpty(tsconfigPath)) {
|
|
2136
|
+
tsConfigOptions = {
|
|
2137
|
+
project: tsconfigPath,
|
|
2138
|
+
tsconfigRootDir: process.cwd()
|
|
2139
|
+
};
|
|
2140
|
+
additionalTypeAwareRules = typeAwareRules;
|
|
2141
|
+
}
|
|
2118
2142
|
return [
|
|
2119
2143
|
{
|
|
2120
2144
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -2135,10 +2159,7 @@ function typescript(options) {
|
|
|
2135
2159
|
parser: parserTs,
|
|
2136
2160
|
parserOptions: {
|
|
2137
2161
|
sourceType: "module",
|
|
2138
|
-
...
|
|
2139
|
-
project: [tsconfigPath],
|
|
2140
|
-
tsconfigRootDir: process.cwd()
|
|
2141
|
-
} : {},
|
|
2162
|
+
...tsConfigOptions,
|
|
2142
2163
|
...parserOptions
|
|
2143
2164
|
}
|
|
2144
2165
|
},
|
|
@@ -2192,7 +2213,7 @@ function typescript(options) {
|
|
|
2192
2213
|
"vinicunca/named-tuple-spacing": ERROR,
|
|
2193
2214
|
"vinicunca/no-cjs-exports": ERROR,
|
|
2194
2215
|
"vinicunca/no-ts-export-equal": ERROR,
|
|
2195
|
-
...
|
|
2216
|
+
...additionalTypeAwareRules,
|
|
2196
2217
|
...overrides
|
|
2197
2218
|
}
|
|
2198
2219
|
},
|
|
@@ -2255,10 +2276,20 @@ function unicorn(options = {}) {
|
|
|
2255
2276
|
}
|
|
2256
2277
|
|
|
2257
2278
|
// src/configs/vue.ts
|
|
2279
|
+
import process2 from "process";
|
|
2258
2280
|
function vue(options = {}) {
|
|
2259
2281
|
const {
|
|
2282
|
+
typescript: typescript2 = {},
|
|
2260
2283
|
overrides = {}
|
|
2261
2284
|
} = options;
|
|
2285
|
+
let tsConfigOptions = {};
|
|
2286
|
+
const tsconfigPath = typescript2.tsconfigPath ?? [];
|
|
2287
|
+
if (!isEmpty(tsconfigPath)) {
|
|
2288
|
+
tsConfigOptions = {
|
|
2289
|
+
project: tsconfigPath,
|
|
2290
|
+
tsconfigRootDir: process2.cwd()
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2262
2293
|
return [
|
|
2263
2294
|
{
|
|
2264
2295
|
name: "vinicunca:vue:setup",
|
|
@@ -2276,8 +2307,9 @@ function vue(options = {}) {
|
|
|
2276
2307
|
jsx: true
|
|
2277
2308
|
},
|
|
2278
2309
|
extraFileExtensions: [".vue"],
|
|
2279
|
-
parser:
|
|
2280
|
-
sourceType: "module"
|
|
2310
|
+
parser: typescript2.enabled ? parserTs : void 0,
|
|
2311
|
+
sourceType: "module",
|
|
2312
|
+
...tsConfigOptions
|
|
2281
2313
|
}
|
|
2282
2314
|
},
|
|
2283
2315
|
processor: default14.processors[".vue"],
|
|
@@ -2430,9 +2462,9 @@ var VuePackages = [
|
|
|
2430
2462
|
];
|
|
2431
2463
|
function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
2432
2464
|
const {
|
|
2433
|
-
isInEditor = !!((
|
|
2465
|
+
isInEditor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE) && !process3.env.CI),
|
|
2434
2466
|
vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
|
|
2435
|
-
typescript:
|
|
2467
|
+
typescript: tsOptions = {},
|
|
2436
2468
|
stylistic: enableStylistic = true,
|
|
2437
2469
|
test: enableTest = true,
|
|
2438
2470
|
jsonc: enableJsonc = true,
|
|
@@ -2457,9 +2489,13 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2457
2489
|
if (enableVue) {
|
|
2458
2490
|
componentExts.push("vue");
|
|
2459
2491
|
}
|
|
2460
|
-
|
|
2492
|
+
const {
|
|
2493
|
+
enabled: tsEnabled = isPackageExists("typescript"),
|
|
2494
|
+
...tsParams
|
|
2495
|
+
} = tsOptions;
|
|
2496
|
+
if (tsEnabled) {
|
|
2461
2497
|
configs.push(typescript({
|
|
2462
|
-
|
|
2498
|
+
...tsParams,
|
|
2463
2499
|
componentExts,
|
|
2464
2500
|
overrides: overrides.typescript
|
|
2465
2501
|
}));
|
|
@@ -2476,7 +2512,10 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
2476
2512
|
;
|
|
2477
2513
|
if (enableVue) {
|
|
2478
2514
|
configs.push(vue({
|
|
2479
|
-
typescript:
|
|
2515
|
+
typescript: {
|
|
2516
|
+
enabled: tsEnabled,
|
|
2517
|
+
...tsParams
|
|
2518
|
+
},
|
|
2480
2519
|
overrides: overrides.vue
|
|
2481
2520
|
}));
|
|
2482
2521
|
}
|