@so1ve/eslint-config 1.0.0-alpha.7 → 1.0.0-alpha.9
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 +207 -88
- package/dist/index.d.ts +20 -24
- package/dist/index.mjs +206 -84
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -15,7 +15,6 @@ var pluginEtc = require('eslint-plugin-etc');
|
|
|
15
15
|
var pluginHtmlJsSupport = require('eslint-plugin-html');
|
|
16
16
|
var pluginImport = require('eslint-plugin-i');
|
|
17
17
|
var pluginJestFormatting = require('eslint-plugin-jest-formatting');
|
|
18
|
-
var pluginJsdoc = require('eslint-plugin-jsdoc');
|
|
19
18
|
var pluginJsonSchemaValidator = require('eslint-plugin-json-schema-validator');
|
|
20
19
|
var pluginJsonc = require('eslint-plugin-jsonc');
|
|
21
20
|
var pluginMdx = require('eslint-plugin-mdx');
|
|
@@ -55,7 +54,6 @@ var pluginEtc__default = /*#__PURE__*/_interopDefaultLegacy(pluginEtc);
|
|
|
55
54
|
var pluginHtmlJsSupport__default = /*#__PURE__*/_interopDefaultLegacy(pluginHtmlJsSupport);
|
|
56
55
|
var pluginImport__default = /*#__PURE__*/_interopDefaultLegacy(pluginImport);
|
|
57
56
|
var pluginJestFormatting__default = /*#__PURE__*/_interopDefaultLegacy(pluginJestFormatting);
|
|
58
|
-
var pluginJsdoc__default = /*#__PURE__*/_interopDefaultLegacy(pluginJsdoc);
|
|
59
57
|
var pluginJsonSchemaValidator__default = /*#__PURE__*/_interopDefaultLegacy(pluginJsonSchemaValidator);
|
|
60
58
|
var pluginJsonc__default = /*#__PURE__*/_interopDefaultLegacy(pluginJsonc);
|
|
61
59
|
var pluginMdx__default = /*#__PURE__*/_interopDefaultLegacy(pluginMdx);
|
|
@@ -97,7 +95,7 @@ const comments = () => [
|
|
|
97
95
|
];
|
|
98
96
|
|
|
99
97
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
100
|
-
const GLOB_SRC =
|
|
98
|
+
const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
101
99
|
const GLOB_JS = "**/*.?([cm])js";
|
|
102
100
|
const GLOB_JSX = "**/*.?([cm])jsx";
|
|
103
101
|
const GLOB_TS = "**/*.?([cm])ts";
|
|
@@ -111,17 +109,20 @@ const GLOB_JSON = "**/*.json";
|
|
|
111
109
|
const GLOB_JSON5 = "**/*.json5";
|
|
112
110
|
const GLOB_JSONC = "**/*.jsonc";
|
|
113
111
|
const GLOB_ESLINTRC = "**/.eslintrc";
|
|
114
|
-
const GLOB_MARKDOWN = "**/*.
|
|
112
|
+
const GLOB_MARKDOWN = "**/*.md?(x)";
|
|
115
113
|
const GLOB_VUE = "**/*.vue";
|
|
116
114
|
const GLOB_YAML = "**/*.y?(a)ml";
|
|
117
115
|
const GLOB_TOML = "**/*.toml";
|
|
118
116
|
const GLOB_HTML = "**/*.htm?(l)";
|
|
119
117
|
const GLOB_PACKAGEJSON = "**/package.json";
|
|
118
|
+
const GLOB_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
|
|
120
119
|
const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
121
120
|
const GLOB_TESTS = [
|
|
122
121
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
123
122
|
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
124
|
-
`**/*.test.${GLOB_SRC_EXT}
|
|
123
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
124
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
125
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
125
126
|
];
|
|
126
127
|
const GLOB_ALL_SRC = [
|
|
127
128
|
GLOB_SRC,
|
|
@@ -142,6 +143,7 @@ const GLOB_EXCLUDE = [
|
|
|
142
143
|
"**/package-lock.json",
|
|
143
144
|
"**/yarn.lock",
|
|
144
145
|
"**/pnpm-lock.yaml",
|
|
146
|
+
"**/bun.lockb",
|
|
145
147
|
"**/coverage",
|
|
146
148
|
"**/temp",
|
|
147
149
|
"**/.vitepress/cache",
|
|
@@ -168,6 +170,170 @@ const GLOB_EXCLUDE = [
|
|
|
168
170
|
"**/*.vue.tsx"
|
|
169
171
|
];
|
|
170
172
|
|
|
173
|
+
const formatting = (options) => {
|
|
174
|
+
var _a, _b;
|
|
175
|
+
return [
|
|
176
|
+
{
|
|
177
|
+
rules: {
|
|
178
|
+
"so1ve/no-useless-template-string": "error",
|
|
179
|
+
"so1ve/no-negated-comparison": "error",
|
|
180
|
+
"so1ve/no-import-promises-as": "error",
|
|
181
|
+
"so1ve/pad-after-last-import": "error",
|
|
182
|
+
"so1ve/function-style": "error",
|
|
183
|
+
"quote-props": ["error", "consistent-as-needed"],
|
|
184
|
+
"padding-line-between-statements": [
|
|
185
|
+
"error",
|
|
186
|
+
{ blankLine: "always", prev: "*", next: "return" }
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
((_a = options.jsonc) != null ? _a : true) && [
|
|
191
|
+
{
|
|
192
|
+
files: [GLOB_PACKAGEJSON],
|
|
193
|
+
rules: {
|
|
194
|
+
"jsonc/sort-keys": [
|
|
195
|
+
"error",
|
|
196
|
+
{
|
|
197
|
+
pathPattern: "^exports$",
|
|
198
|
+
order: { type: "asc" }
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
pathPattern: "^exports.*$",
|
|
202
|
+
order: ["types", "require", "import", "default"]
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
files: GLOB_TSCONFIG,
|
|
209
|
+
rules: {
|
|
210
|
+
"jsonc/sort-keys": [
|
|
211
|
+
"error",
|
|
212
|
+
{
|
|
213
|
+
order: [
|
|
214
|
+
"extends",
|
|
215
|
+
"compilerOptions",
|
|
216
|
+
"references",
|
|
217
|
+
"files",
|
|
218
|
+
"include",
|
|
219
|
+
"exclude"
|
|
220
|
+
],
|
|
221
|
+
pathPattern: "^$"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
order: [
|
|
225
|
+
/* Projects */
|
|
226
|
+
"incremental",
|
|
227
|
+
"composite",
|
|
228
|
+
"tsBuildInfoFile",
|
|
229
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
230
|
+
"disableSolutionSearching",
|
|
231
|
+
"disableReferencedProjectLoad",
|
|
232
|
+
/* Language and Environment */
|
|
233
|
+
"target",
|
|
234
|
+
"jsx",
|
|
235
|
+
"jsxFactory",
|
|
236
|
+
"jsxFragmentFactory",
|
|
237
|
+
"jsxImportSource",
|
|
238
|
+
"lib",
|
|
239
|
+
"moduleDetection",
|
|
240
|
+
"noLib",
|
|
241
|
+
"reactNamespace",
|
|
242
|
+
"useDefineForClassFields",
|
|
243
|
+
"emitDecoratorMetadata",
|
|
244
|
+
"experimentalDecorators",
|
|
245
|
+
/* Modules */
|
|
246
|
+
"baseUrl",
|
|
247
|
+
"rootDir",
|
|
248
|
+
"rootDirs",
|
|
249
|
+
"customConditions",
|
|
250
|
+
"module",
|
|
251
|
+
"moduleResolution",
|
|
252
|
+
"moduleSuffixes",
|
|
253
|
+
"noResolve",
|
|
254
|
+
"paths",
|
|
255
|
+
"resolveJsonModule",
|
|
256
|
+
"resolvePackageJsonExports",
|
|
257
|
+
"resolvePackageJsonImports",
|
|
258
|
+
"typeRoots",
|
|
259
|
+
"types",
|
|
260
|
+
"allowArbitraryExtensions",
|
|
261
|
+
"allowImportingTsExtensions",
|
|
262
|
+
"allowUmdGlobalAccess",
|
|
263
|
+
/* JavaScript Support */
|
|
264
|
+
"allowJs",
|
|
265
|
+
"checkJs",
|
|
266
|
+
"maxNodeModuleJsDepth",
|
|
267
|
+
/* Type Checking */
|
|
268
|
+
"strict",
|
|
269
|
+
"strictBindCallApply",
|
|
270
|
+
"strictFunctionTypes",
|
|
271
|
+
"strictNullChecks",
|
|
272
|
+
"strictPropertyInitialization",
|
|
273
|
+
"allowUnreachableCode",
|
|
274
|
+
"allowUnusedLabels",
|
|
275
|
+
"alwaysStrict",
|
|
276
|
+
"exactOptionalPropertyTypes",
|
|
277
|
+
"noFallthroughCasesInSwitch",
|
|
278
|
+
"noImplicitAny",
|
|
279
|
+
"noImplicitOverride",
|
|
280
|
+
"noImplicitReturns",
|
|
281
|
+
"noImplicitThis",
|
|
282
|
+
"noPropertyAccessFromIndexSignature",
|
|
283
|
+
"noUncheckedIndexedAccess",
|
|
284
|
+
"noUnusedLocals",
|
|
285
|
+
"noUnusedParameters",
|
|
286
|
+
"useUnknownInCatchVariables",
|
|
287
|
+
/* Emit */
|
|
288
|
+
"declaration",
|
|
289
|
+
"declarationDir",
|
|
290
|
+
"declarationMap",
|
|
291
|
+
"downlevelIteration",
|
|
292
|
+
"emitBOM",
|
|
293
|
+
"emitDeclarationOnly",
|
|
294
|
+
"importHelpers",
|
|
295
|
+
"importsNotUsedAsValues",
|
|
296
|
+
"inlineSourceMap",
|
|
297
|
+
"inlineSources",
|
|
298
|
+
"mapRoot",
|
|
299
|
+
"newLine",
|
|
300
|
+
"noEmit",
|
|
301
|
+
"noEmitHelpers",
|
|
302
|
+
"noEmitOnError",
|
|
303
|
+
"outDir",
|
|
304
|
+
"outFile",
|
|
305
|
+
"preserveConstEnums",
|
|
306
|
+
"preserveValueImports",
|
|
307
|
+
"removeComments",
|
|
308
|
+
"sourceMap",
|
|
309
|
+
"sourceRoot",
|
|
310
|
+
"stripInternal",
|
|
311
|
+
/* Interop Constraints */
|
|
312
|
+
"allowSyntheticDefaultImports",
|
|
313
|
+
"esModuleInterop",
|
|
314
|
+
"forceConsistentCasingInFileNames",
|
|
315
|
+
"isolatedModules",
|
|
316
|
+
"preserveSymlinks",
|
|
317
|
+
"verbatimModuleSyntax",
|
|
318
|
+
/* Completeness */
|
|
319
|
+
"skipDefaultLibCheck",
|
|
320
|
+
"skipLibCheck"
|
|
321
|
+
],
|
|
322
|
+
pathPattern: "^compilerOptions$"
|
|
323
|
+
}
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
],
|
|
328
|
+
((_b = options.test) != null ? _b : true) && {
|
|
329
|
+
files: GLOB_TESTS,
|
|
330
|
+
rules: {
|
|
331
|
+
"jest-formatting/padding-around-all": "error"
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
].flat().filter(Boolean);
|
|
335
|
+
};
|
|
336
|
+
|
|
171
337
|
const html = () => [
|
|
172
338
|
{
|
|
173
339
|
plugins: {
|
|
@@ -205,14 +371,21 @@ const imports = (options = {}) => [
|
|
|
205
371
|
}
|
|
206
372
|
},
|
|
207
373
|
{
|
|
208
|
-
settings:
|
|
374
|
+
settings: {
|
|
375
|
+
"import/parsers": {
|
|
376
|
+
espree: [".js", ".cjs", ".mjs", ".jsx"]
|
|
377
|
+
},
|
|
209
378
|
"import/resolver": {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
379
|
+
...options.typescript ? {
|
|
380
|
+
node: {
|
|
381
|
+
extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
|
|
382
|
+
},
|
|
383
|
+
typescript: {
|
|
384
|
+
extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
|
|
385
|
+
}
|
|
386
|
+
} : {
|
|
387
|
+
node: { extensions: [".js", ".mjs"] }
|
|
388
|
+
}
|
|
216
389
|
}
|
|
217
390
|
},
|
|
218
391
|
rules: {
|
|
@@ -482,11 +655,6 @@ const javascript = ({
|
|
|
482
655
|
ignoreConstructors: false
|
|
483
656
|
}
|
|
484
657
|
],
|
|
485
|
-
"quote-props": ["error", "consistent-as-needed"],
|
|
486
|
-
"padding-line-between-statements": [
|
|
487
|
-
"error",
|
|
488
|
-
{ blankLine: "always", prev: "*", next: "return" }
|
|
489
|
-
],
|
|
490
658
|
"prefer-exponentiation-operator": "error",
|
|
491
659
|
"prefer-rest-params": "error",
|
|
492
660
|
"prefer-spread": "error",
|
|
@@ -553,11 +721,6 @@ const javascript = ({
|
|
|
553
721
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
554
722
|
// so1ve
|
|
555
723
|
"so1ve/import-dedupe": "error",
|
|
556
|
-
"so1ve/no-useless-template-string": "error",
|
|
557
|
-
"so1ve/no-negated-comparison": "error",
|
|
558
|
-
"so1ve/no-import-promises-as": "error",
|
|
559
|
-
"so1ve/pad-after-last-import": "error",
|
|
560
|
-
"so1ve/function-style": "error",
|
|
561
724
|
"so1ve/use-async-with-await": "error",
|
|
562
725
|
// Sort Imports
|
|
563
726
|
"sort-imports/imports": ["error"],
|
|
@@ -579,34 +742,6 @@ const javascript = ({
|
|
|
579
742
|
}
|
|
580
743
|
];
|
|
581
744
|
|
|
582
|
-
const jsdoc = () => [
|
|
583
|
-
{
|
|
584
|
-
plugins: {
|
|
585
|
-
jsdoc: pluginJsdoc__default["default"]
|
|
586
|
-
},
|
|
587
|
-
rules: {
|
|
588
|
-
"jsdoc/check-access": "error",
|
|
589
|
-
"jsdoc/check-alignment": "error",
|
|
590
|
-
"jsdoc/check-param-names": "error",
|
|
591
|
-
"jsdoc/check-property-names": "error",
|
|
592
|
-
"jsdoc/check-types": "error",
|
|
593
|
-
"jsdoc/empty-tags": "error",
|
|
594
|
-
"jsdoc/implements-on-classes": "error",
|
|
595
|
-
"jsdoc/multiline-blocks": "error",
|
|
596
|
-
"jsdoc/no-defaults": "error",
|
|
597
|
-
"jsdoc/no-multi-asterisks": "error",
|
|
598
|
-
"jsdoc/require-param-name": "error",
|
|
599
|
-
"jsdoc/require-property": "error",
|
|
600
|
-
"jsdoc/require-property-description": "error",
|
|
601
|
-
"jsdoc/require-property-name": "error",
|
|
602
|
-
"jsdoc/require-returns-check": "error",
|
|
603
|
-
"jsdoc/require-returns-description": "error",
|
|
604
|
-
"jsdoc/require-yields-check": "error",
|
|
605
|
-
"jsdoc/valid-types": "error"
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
];
|
|
609
|
-
|
|
610
745
|
const jsonc = () => [
|
|
611
746
|
{
|
|
612
747
|
plugins: {
|
|
@@ -625,22 +760,6 @@ const jsonc = () => [
|
|
|
625
760
|
"jsonc/quotes": "off",
|
|
626
761
|
"jsonc/quotes-props": "off"
|
|
627
762
|
}
|
|
628
|
-
},
|
|
629
|
-
{
|
|
630
|
-
files: [GLOB_PACKAGEJSON],
|
|
631
|
-
rules: {
|
|
632
|
-
"jsonc/sort-keys": [
|
|
633
|
-
"error",
|
|
634
|
-
{
|
|
635
|
-
pathPattern: "^exports$",
|
|
636
|
-
order: { type: "asc" }
|
|
637
|
-
},
|
|
638
|
-
{
|
|
639
|
-
pathPattern: "^exports.*$",
|
|
640
|
-
order: ["types", "require", "import", "default"]
|
|
641
|
-
}
|
|
642
|
-
]
|
|
643
|
-
}
|
|
644
763
|
}
|
|
645
764
|
];
|
|
646
765
|
|
|
@@ -795,7 +914,6 @@ const test = ({
|
|
|
795
914
|
"vitest/prefer-to-have-length": "error",
|
|
796
915
|
"vitest/prefer-todo": "error",
|
|
797
916
|
"vitest/valid-title": ["error", { allowArguments: true }],
|
|
798
|
-
"jest-formatting/padding-around-all": "error",
|
|
799
917
|
...overrides
|
|
800
918
|
}
|
|
801
919
|
}
|
|
@@ -919,6 +1037,7 @@ function typescript({
|
|
|
919
1037
|
parser: parserTs__default["default"],
|
|
920
1038
|
parserOptions: {
|
|
921
1039
|
sourceType: "module",
|
|
1040
|
+
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
922
1041
|
EXPERIMENTAL_useProjectService: true,
|
|
923
1042
|
...parserOptions
|
|
924
1043
|
}
|
|
@@ -1098,25 +1217,24 @@ const unicorn = () => [
|
|
|
1098
1217
|
unicorn: pluginUnicorn__default["default"]
|
|
1099
1218
|
},
|
|
1100
1219
|
rules: {
|
|
1220
|
+
"unicorn/throw-new-error": "error",
|
|
1221
|
+
"unicorn/relative-url-style": ["error", "always"],
|
|
1222
|
+
"unicorn/switch-case-braces": "error",
|
|
1223
|
+
"unicorn/number-literal-case": "error",
|
|
1224
|
+
"unicorn/numeric-separators-style": "error",
|
|
1225
|
+
"unicorn/new-for-builtins": "error",
|
|
1101
1226
|
"unicorn/error-message": "error",
|
|
1102
1227
|
"unicorn/escape-case": "error",
|
|
1228
|
+
"unicorn/explicit-length-check": "error",
|
|
1103
1229
|
"unicorn/no-instanceof-array": "error",
|
|
1104
1230
|
"unicorn/no-new-buffer": "error",
|
|
1105
1231
|
"unicorn/no-new-array": "error",
|
|
1106
|
-
"unicorn/no-unsafe-regex": "off",
|
|
1107
|
-
"unicorn/number-literal-case": "error",
|
|
1108
|
-
"unicorn/numeric-separators-style": "error",
|
|
1109
|
-
"unicorn/throw-new-error": "error",
|
|
1110
|
-
"unicorn/no-useless-spread": "error",
|
|
1111
|
-
"unicorn/relative-url-style": ["error", "always"],
|
|
1112
|
-
"unicorn/explicit-length-check": "error",
|
|
1113
|
-
"unicorn/new-for-builtins": "error",
|
|
1114
1232
|
"unicorn/no-array-for-each": "error",
|
|
1115
1233
|
"unicorn/no-array-method-this-argument": "error",
|
|
1116
1234
|
"unicorn/no-for-loop": "error",
|
|
1117
1235
|
"unicorn/no-lonely-if": "error",
|
|
1118
1236
|
"unicorn/no-negated-condition": "error",
|
|
1119
|
-
"unicorn/
|
|
1237
|
+
"unicorn/no-useless-spread": "error",
|
|
1120
1238
|
"unicorn/prefer-ternary": "error",
|
|
1121
1239
|
"unicorn/prefer-query-selector": "error",
|
|
1122
1240
|
"unicorn/prefer-modern-dom-apis": "error",
|
|
@@ -1135,8 +1253,11 @@ const unicorn = () => [
|
|
|
1135
1253
|
"unicorn/prefer-text-content": "error",
|
|
1136
1254
|
"unicorn/prefer-type-error": "error",
|
|
1137
1255
|
"unicorn/prefer-node-protocol": "error",
|
|
1256
|
+
"unicorn/prefer-negative-index": "error",
|
|
1138
1257
|
"unicorn/prefer-regexp-test": "error",
|
|
1139
|
-
"unicorn/prefer-optional-catch-binding": "error"
|
|
1258
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
1259
|
+
"unicorn/prefer-object-from-entries": "error",
|
|
1260
|
+
"unicorn/prefer-prototype-methods": "error"
|
|
1140
1261
|
}
|
|
1141
1262
|
}
|
|
1142
1263
|
];
|
|
@@ -1181,7 +1302,7 @@ const vue = ({
|
|
|
1181
1302
|
"vue/block-order": [
|
|
1182
1303
|
"error",
|
|
1183
1304
|
{
|
|
1184
|
-
order: ["script", "template", "style"]
|
|
1305
|
+
order: ["script:not([setup])", "script[setup]", "template", "style"]
|
|
1185
1306
|
}
|
|
1186
1307
|
],
|
|
1187
1308
|
"vue/component-api-style": ["error", ["script-setup", "composition"]],
|
|
@@ -1369,13 +1490,14 @@ const flatConfigProps = [
|
|
|
1369
1490
|
];
|
|
1370
1491
|
const VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
|
|
1371
1492
|
function so1ve(options = {}, ...userConfigs) {
|
|
1372
|
-
var _a, _b, _c, _d, _e;
|
|
1493
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1373
1494
|
const {
|
|
1374
1495
|
vue: enableVue = VuePackages.some((i) => localPkg.isPackageExists(i)),
|
|
1375
1496
|
solid: enableSolid = localPkg.isPackageExists("solid-js"),
|
|
1376
1497
|
typescript: enableTypeScript = localPkg.isPackageExists("typescript"),
|
|
1377
1498
|
gitignore: enableGitignore = true,
|
|
1378
|
-
overrides = {}
|
|
1499
|
+
overrides = {},
|
|
1500
|
+
componentExts = []
|
|
1379
1501
|
} = options;
|
|
1380
1502
|
const configs = [];
|
|
1381
1503
|
if (enableGitignore) {
|
|
@@ -1396,13 +1518,10 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1396
1518
|
node(),
|
|
1397
1519
|
onlyError(),
|
|
1398
1520
|
promise(),
|
|
1399
|
-
// jsdoc(),
|
|
1400
1521
|
sortImports(),
|
|
1401
1522
|
imports(),
|
|
1402
|
-
jsdoc(),
|
|
1403
1523
|
unicorn()
|
|
1404
1524
|
);
|
|
1405
|
-
const componentExts = [];
|
|
1406
1525
|
if (enableVue) {
|
|
1407
1526
|
componentExts.push("vue");
|
|
1408
1527
|
}
|
|
@@ -1462,6 +1581,9 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1462
1581
|
})
|
|
1463
1582
|
);
|
|
1464
1583
|
}
|
|
1584
|
+
if ((_f = options.formatting) != null ? _f : true) {
|
|
1585
|
+
configs.push(formatting(options));
|
|
1586
|
+
}
|
|
1465
1587
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
1466
1588
|
if (key in options) {
|
|
1467
1589
|
acc[key] = options[key];
|
|
@@ -1527,10 +1649,6 @@ Object.defineProperty(exports, 'pluginJestFormatting', {
|
|
|
1527
1649
|
enumerable: true,
|
|
1528
1650
|
get: function () { return pluginJestFormatting__default["default"]; }
|
|
1529
1651
|
});
|
|
1530
|
-
Object.defineProperty(exports, 'pluginJsdoc', {
|
|
1531
|
-
enumerable: true,
|
|
1532
|
-
get: function () { return pluginJsdoc__default["default"]; }
|
|
1533
|
-
});
|
|
1534
1652
|
Object.defineProperty(exports, 'pluginJsonSchemaValidator', {
|
|
1535
1653
|
enumerable: true,
|
|
1536
1654
|
get: function () { return pluginJsonSchemaValidator__default["default"]; }
|
|
@@ -1629,16 +1747,17 @@ exports.GLOB_STYLE = GLOB_STYLE;
|
|
|
1629
1747
|
exports.GLOB_TESTS = GLOB_TESTS;
|
|
1630
1748
|
exports.GLOB_TOML = GLOB_TOML;
|
|
1631
1749
|
exports.GLOB_TS = GLOB_TS;
|
|
1750
|
+
exports.GLOB_TSCONFIG = GLOB_TSCONFIG;
|
|
1632
1751
|
exports.GLOB_TSX = GLOB_TSX;
|
|
1633
1752
|
exports.GLOB_VUE = GLOB_VUE;
|
|
1634
1753
|
exports.GLOB_YAML = GLOB_YAML;
|
|
1635
1754
|
exports.combine = combine;
|
|
1636
1755
|
exports.comments = comments;
|
|
1756
|
+
exports.formatting = formatting;
|
|
1637
1757
|
exports.html = html;
|
|
1638
1758
|
exports.ignores = ignores;
|
|
1639
1759
|
exports.imports = imports;
|
|
1640
1760
|
exports.javascript = javascript;
|
|
1641
|
-
exports.jsdoc = jsdoc;
|
|
1642
1761
|
exports.jsonc = jsonc;
|
|
1643
1762
|
exports.mdx = mdx;
|
|
1644
1763
|
exports.node = node;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export { default as pluginEtc } from 'eslint-plugin-etc';
|
|
|
14
14
|
export { default as pluginHtmlJsSupport } from 'eslint-plugin-html';
|
|
15
15
|
export { default as pluginImport } from 'eslint-plugin-i';
|
|
16
16
|
export { default as pluginJestFormatting } from 'eslint-plugin-jest-formatting';
|
|
17
|
-
export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
|
|
18
17
|
export { default as pluginJsonSchemaValidator } from 'eslint-plugin-json-schema-validator';
|
|
19
18
|
export { default as pluginJsonc } from 'eslint-plugin-jsonc';
|
|
20
19
|
export { default as pluginMdx } from 'eslint-plugin-mdx';
|
|
@@ -37,20 +36,12 @@ export { default as parserYaml } from 'yaml-eslint-parser';
|
|
|
37
36
|
|
|
38
37
|
declare const comments: () => FlatESLintConfigItem[];
|
|
39
38
|
|
|
40
|
-
declare const html: () => FlatESLintConfigItem[];
|
|
41
|
-
|
|
42
|
-
declare const ignores: () => FlatESLintConfigItem[];
|
|
43
|
-
|
|
44
39
|
interface OptionsComponentExts {
|
|
45
|
-
/**
|
|
46
|
-
* Additional extensions for components.
|
|
47
|
-
*/
|
|
40
|
+
/** Additional extensions for components. */
|
|
48
41
|
componentExts?: string[];
|
|
49
42
|
}
|
|
50
43
|
interface OptionsTypeScriptParserOptions {
|
|
51
|
-
/**
|
|
52
|
-
* Additional parser options for TypeScript.
|
|
53
|
-
*/
|
|
44
|
+
/** Additional parser options for TypeScript. */
|
|
54
45
|
parserOptions?: Partial<ParserOptions>;
|
|
55
46
|
}
|
|
56
47
|
interface OptionsHasTypeScript {
|
|
@@ -59,7 +50,7 @@ interface OptionsHasTypeScript {
|
|
|
59
50
|
interface OptionsOverrides {
|
|
60
51
|
overrides?: FlatESLintConfigItem["rules"];
|
|
61
52
|
}
|
|
62
|
-
interface Options {
|
|
53
|
+
interface Options extends OptionsComponentExts {
|
|
63
54
|
/**
|
|
64
55
|
* Enable gitignore support.
|
|
65
56
|
*
|
|
@@ -120,8 +111,12 @@ interface Options {
|
|
|
120
111
|
*/
|
|
121
112
|
mdx?: boolean;
|
|
122
113
|
/**
|
|
123
|
-
*
|
|
114
|
+
* Enable formatting rules.
|
|
115
|
+
*
|
|
116
|
+
* @default true
|
|
124
117
|
*/
|
|
118
|
+
formatting?: boolean;
|
|
119
|
+
/** Provide overrides for rules for each integration. */
|
|
125
120
|
overrides?: {
|
|
126
121
|
javascript?: FlatESLintConfigItem["rules"];
|
|
127
122
|
typescript?: FlatESLintConfigItem["rules"];
|
|
@@ -135,12 +130,16 @@ interface Options {
|
|
|
135
130
|
};
|
|
136
131
|
}
|
|
137
132
|
|
|
133
|
+
declare const formatting: (options: Options) => FlatESLintConfigItem[];
|
|
134
|
+
|
|
135
|
+
declare const html: () => FlatESLintConfigItem[];
|
|
136
|
+
|
|
137
|
+
declare const ignores: () => FlatESLintConfigItem[];
|
|
138
|
+
|
|
138
139
|
declare const imports: (options?: Options) => FlatESLintConfigItem[];
|
|
139
140
|
|
|
140
141
|
declare const javascript: ({ overrides, }?: OptionsOverrides) => FlatESLintConfigItem[];
|
|
141
142
|
|
|
142
|
-
declare const jsdoc: () => FlatESLintConfigItem[];
|
|
143
|
-
|
|
144
143
|
declare const jsonc: () => FlatESLintConfigItem[];
|
|
145
144
|
|
|
146
145
|
declare const mdx: ({ componentExts, overrides, }?: OptionsComponentExts & OptionsOverrides) => FlatESLintConfigItem[];
|
|
@@ -167,9 +166,7 @@ declare const vue: ({ overrides, typescript, }?: OptionsHasTypeScript & OptionsO
|
|
|
167
166
|
|
|
168
167
|
declare const yaml: ({ overrides, }?: OptionsOverrides) => FlatESLintConfigItem[];
|
|
169
168
|
|
|
170
|
-
/**
|
|
171
|
-
* Construct an array of ESLint flat config items.
|
|
172
|
-
*/
|
|
169
|
+
/** Construct an array of ESLint flat config items. */
|
|
173
170
|
declare function so1ve(options?: Options, ...userConfigs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[];
|
|
174
171
|
|
|
175
172
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -187,20 +184,19 @@ declare const GLOB_JSON = "**/*.json";
|
|
|
187
184
|
declare const GLOB_JSON5 = "**/*.json5";
|
|
188
185
|
declare const GLOB_JSONC = "**/*.jsonc";
|
|
189
186
|
declare const GLOB_ESLINTRC = "**/.eslintrc";
|
|
190
|
-
declare const GLOB_MARKDOWN = "**/*.
|
|
187
|
+
declare const GLOB_MARKDOWN = "**/*.md?(x)";
|
|
191
188
|
declare const GLOB_VUE = "**/*.vue";
|
|
192
189
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
193
190
|
declare const GLOB_TOML = "**/*.toml";
|
|
194
191
|
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
195
192
|
declare const GLOB_PACKAGEJSON = "**/package.json";
|
|
196
|
-
declare const
|
|
193
|
+
declare const GLOB_TSCONFIG: string[];
|
|
194
|
+
declare const GLOB_MARKDOWN_CODE = "**/*.md?(x)/**/*.?([cm])[jt]s?(x)";
|
|
197
195
|
declare const GLOB_TESTS: string[];
|
|
198
196
|
declare const GLOB_ALL_SRC: string[];
|
|
199
197
|
declare const GLOB_EXCLUDE: string[];
|
|
200
198
|
|
|
201
|
-
/**
|
|
202
|
-
* Combine array and non-array configs into a single array.
|
|
203
|
-
*/
|
|
199
|
+
/** Combine array and non-array configs into a single array. */
|
|
204
200
|
declare const combine: (...configs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]) => FlatESLintConfigItem[];
|
|
205
201
|
declare const renameRules: (rules: Record<string, any>, from: string, to: string) => {
|
|
206
202
|
[k: string]: any;
|
|
@@ -209,4 +205,4 @@ declare function recordRulesStateConfigs(configs: FlatESLintConfigItem[]): FlatE
|
|
|
209
205
|
declare function recordRulesState(rules: FlatESLintConfigItem["rules"]): FlatESLintConfigItem["rules"];
|
|
210
206
|
declare function warnUnnecessaryOffRules(): void;
|
|
211
207
|
|
|
212
|
-
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, Options, OptionsComponentExts, OptionsHasTypeScript, OptionsOverrides, OptionsTypeScriptParserOptions, combine, comments, html, ignores, imports, javascript,
|
|
208
|
+
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, Options, OptionsComponentExts, OptionsHasTypeScript, OptionsOverrides, OptionsTypeScriptParserOptions, combine, comments, formatting, html, ignores, imports, javascript, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
|
package/dist/index.mjs
CHANGED
|
@@ -23,8 +23,6 @@ import pluginImport from 'eslint-plugin-i';
|
|
|
23
23
|
export { default as pluginImport } from 'eslint-plugin-i';
|
|
24
24
|
import pluginJestFormatting from 'eslint-plugin-jest-formatting';
|
|
25
25
|
export { default as pluginJestFormatting } from 'eslint-plugin-jest-formatting';
|
|
26
|
-
import pluginJsdoc from 'eslint-plugin-jsdoc';
|
|
27
|
-
export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
|
|
28
26
|
import pluginJsonSchemaValidator from 'eslint-plugin-json-schema-validator';
|
|
29
27
|
export { default as pluginJsonSchemaValidator } from 'eslint-plugin-json-schema-validator';
|
|
30
28
|
import pluginJsonc from 'eslint-plugin-jsonc';
|
|
@@ -86,7 +84,7 @@ const comments = () => [
|
|
|
86
84
|
];
|
|
87
85
|
|
|
88
86
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
89
|
-
const GLOB_SRC =
|
|
87
|
+
const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
90
88
|
const GLOB_JS = "**/*.?([cm])js";
|
|
91
89
|
const GLOB_JSX = "**/*.?([cm])jsx";
|
|
92
90
|
const GLOB_TS = "**/*.?([cm])ts";
|
|
@@ -100,17 +98,20 @@ const GLOB_JSON = "**/*.json";
|
|
|
100
98
|
const GLOB_JSON5 = "**/*.json5";
|
|
101
99
|
const GLOB_JSONC = "**/*.jsonc";
|
|
102
100
|
const GLOB_ESLINTRC = "**/.eslintrc";
|
|
103
|
-
const GLOB_MARKDOWN = "**/*.
|
|
101
|
+
const GLOB_MARKDOWN = "**/*.md?(x)";
|
|
104
102
|
const GLOB_VUE = "**/*.vue";
|
|
105
103
|
const GLOB_YAML = "**/*.y?(a)ml";
|
|
106
104
|
const GLOB_TOML = "**/*.toml";
|
|
107
105
|
const GLOB_HTML = "**/*.htm?(l)";
|
|
108
106
|
const GLOB_PACKAGEJSON = "**/package.json";
|
|
107
|
+
const GLOB_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
|
|
109
108
|
const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
110
109
|
const GLOB_TESTS = [
|
|
111
110
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
112
111
|
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
113
|
-
`**/*.test.${GLOB_SRC_EXT}
|
|
112
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
113
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
114
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
114
115
|
];
|
|
115
116
|
const GLOB_ALL_SRC = [
|
|
116
117
|
GLOB_SRC,
|
|
@@ -131,6 +132,7 @@ const GLOB_EXCLUDE = [
|
|
|
131
132
|
"**/package-lock.json",
|
|
132
133
|
"**/yarn.lock",
|
|
133
134
|
"**/pnpm-lock.yaml",
|
|
135
|
+
"**/bun.lockb",
|
|
134
136
|
"**/coverage",
|
|
135
137
|
"**/temp",
|
|
136
138
|
"**/.vitepress/cache",
|
|
@@ -157,6 +159,170 @@ const GLOB_EXCLUDE = [
|
|
|
157
159
|
"**/*.vue.tsx"
|
|
158
160
|
];
|
|
159
161
|
|
|
162
|
+
const formatting = (options) => {
|
|
163
|
+
var _a, _b;
|
|
164
|
+
return [
|
|
165
|
+
{
|
|
166
|
+
rules: {
|
|
167
|
+
"so1ve/no-useless-template-string": "error",
|
|
168
|
+
"so1ve/no-negated-comparison": "error",
|
|
169
|
+
"so1ve/no-import-promises-as": "error",
|
|
170
|
+
"so1ve/pad-after-last-import": "error",
|
|
171
|
+
"so1ve/function-style": "error",
|
|
172
|
+
"quote-props": ["error", "consistent-as-needed"],
|
|
173
|
+
"padding-line-between-statements": [
|
|
174
|
+
"error",
|
|
175
|
+
{ blankLine: "always", prev: "*", next: "return" }
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
((_a = options.jsonc) != null ? _a : true) && [
|
|
180
|
+
{
|
|
181
|
+
files: [GLOB_PACKAGEJSON],
|
|
182
|
+
rules: {
|
|
183
|
+
"jsonc/sort-keys": [
|
|
184
|
+
"error",
|
|
185
|
+
{
|
|
186
|
+
pathPattern: "^exports$",
|
|
187
|
+
order: { type: "asc" }
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
pathPattern: "^exports.*$",
|
|
191
|
+
order: ["types", "require", "import", "default"]
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
files: GLOB_TSCONFIG,
|
|
198
|
+
rules: {
|
|
199
|
+
"jsonc/sort-keys": [
|
|
200
|
+
"error",
|
|
201
|
+
{
|
|
202
|
+
order: [
|
|
203
|
+
"extends",
|
|
204
|
+
"compilerOptions",
|
|
205
|
+
"references",
|
|
206
|
+
"files",
|
|
207
|
+
"include",
|
|
208
|
+
"exclude"
|
|
209
|
+
],
|
|
210
|
+
pathPattern: "^$"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
order: [
|
|
214
|
+
/* Projects */
|
|
215
|
+
"incremental",
|
|
216
|
+
"composite",
|
|
217
|
+
"tsBuildInfoFile",
|
|
218
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
219
|
+
"disableSolutionSearching",
|
|
220
|
+
"disableReferencedProjectLoad",
|
|
221
|
+
/* Language and Environment */
|
|
222
|
+
"target",
|
|
223
|
+
"jsx",
|
|
224
|
+
"jsxFactory",
|
|
225
|
+
"jsxFragmentFactory",
|
|
226
|
+
"jsxImportSource",
|
|
227
|
+
"lib",
|
|
228
|
+
"moduleDetection",
|
|
229
|
+
"noLib",
|
|
230
|
+
"reactNamespace",
|
|
231
|
+
"useDefineForClassFields",
|
|
232
|
+
"emitDecoratorMetadata",
|
|
233
|
+
"experimentalDecorators",
|
|
234
|
+
/* Modules */
|
|
235
|
+
"baseUrl",
|
|
236
|
+
"rootDir",
|
|
237
|
+
"rootDirs",
|
|
238
|
+
"customConditions",
|
|
239
|
+
"module",
|
|
240
|
+
"moduleResolution",
|
|
241
|
+
"moduleSuffixes",
|
|
242
|
+
"noResolve",
|
|
243
|
+
"paths",
|
|
244
|
+
"resolveJsonModule",
|
|
245
|
+
"resolvePackageJsonExports",
|
|
246
|
+
"resolvePackageJsonImports",
|
|
247
|
+
"typeRoots",
|
|
248
|
+
"types",
|
|
249
|
+
"allowArbitraryExtensions",
|
|
250
|
+
"allowImportingTsExtensions",
|
|
251
|
+
"allowUmdGlobalAccess",
|
|
252
|
+
/* JavaScript Support */
|
|
253
|
+
"allowJs",
|
|
254
|
+
"checkJs",
|
|
255
|
+
"maxNodeModuleJsDepth",
|
|
256
|
+
/* Type Checking */
|
|
257
|
+
"strict",
|
|
258
|
+
"strictBindCallApply",
|
|
259
|
+
"strictFunctionTypes",
|
|
260
|
+
"strictNullChecks",
|
|
261
|
+
"strictPropertyInitialization",
|
|
262
|
+
"allowUnreachableCode",
|
|
263
|
+
"allowUnusedLabels",
|
|
264
|
+
"alwaysStrict",
|
|
265
|
+
"exactOptionalPropertyTypes",
|
|
266
|
+
"noFallthroughCasesInSwitch",
|
|
267
|
+
"noImplicitAny",
|
|
268
|
+
"noImplicitOverride",
|
|
269
|
+
"noImplicitReturns",
|
|
270
|
+
"noImplicitThis",
|
|
271
|
+
"noPropertyAccessFromIndexSignature",
|
|
272
|
+
"noUncheckedIndexedAccess",
|
|
273
|
+
"noUnusedLocals",
|
|
274
|
+
"noUnusedParameters",
|
|
275
|
+
"useUnknownInCatchVariables",
|
|
276
|
+
/* Emit */
|
|
277
|
+
"declaration",
|
|
278
|
+
"declarationDir",
|
|
279
|
+
"declarationMap",
|
|
280
|
+
"downlevelIteration",
|
|
281
|
+
"emitBOM",
|
|
282
|
+
"emitDeclarationOnly",
|
|
283
|
+
"importHelpers",
|
|
284
|
+
"importsNotUsedAsValues",
|
|
285
|
+
"inlineSourceMap",
|
|
286
|
+
"inlineSources",
|
|
287
|
+
"mapRoot",
|
|
288
|
+
"newLine",
|
|
289
|
+
"noEmit",
|
|
290
|
+
"noEmitHelpers",
|
|
291
|
+
"noEmitOnError",
|
|
292
|
+
"outDir",
|
|
293
|
+
"outFile",
|
|
294
|
+
"preserveConstEnums",
|
|
295
|
+
"preserveValueImports",
|
|
296
|
+
"removeComments",
|
|
297
|
+
"sourceMap",
|
|
298
|
+
"sourceRoot",
|
|
299
|
+
"stripInternal",
|
|
300
|
+
/* Interop Constraints */
|
|
301
|
+
"allowSyntheticDefaultImports",
|
|
302
|
+
"esModuleInterop",
|
|
303
|
+
"forceConsistentCasingInFileNames",
|
|
304
|
+
"isolatedModules",
|
|
305
|
+
"preserveSymlinks",
|
|
306
|
+
"verbatimModuleSyntax",
|
|
307
|
+
/* Completeness */
|
|
308
|
+
"skipDefaultLibCheck",
|
|
309
|
+
"skipLibCheck"
|
|
310
|
+
],
|
|
311
|
+
pathPattern: "^compilerOptions$"
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
],
|
|
317
|
+
((_b = options.test) != null ? _b : true) && {
|
|
318
|
+
files: GLOB_TESTS,
|
|
319
|
+
rules: {
|
|
320
|
+
"jest-formatting/padding-around-all": "error"
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
].flat().filter(Boolean);
|
|
324
|
+
};
|
|
325
|
+
|
|
160
326
|
const html = () => [
|
|
161
327
|
{
|
|
162
328
|
plugins: {
|
|
@@ -194,14 +360,21 @@ const imports = (options = {}) => [
|
|
|
194
360
|
}
|
|
195
361
|
},
|
|
196
362
|
{
|
|
197
|
-
settings:
|
|
363
|
+
settings: {
|
|
364
|
+
"import/parsers": {
|
|
365
|
+
espree: [".js", ".cjs", ".mjs", ".jsx"]
|
|
366
|
+
},
|
|
198
367
|
"import/resolver": {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
368
|
+
...options.typescript ? {
|
|
369
|
+
node: {
|
|
370
|
+
extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
|
|
371
|
+
},
|
|
372
|
+
typescript: {
|
|
373
|
+
extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
|
|
374
|
+
}
|
|
375
|
+
} : {
|
|
376
|
+
node: { extensions: [".js", ".mjs"] }
|
|
377
|
+
}
|
|
205
378
|
}
|
|
206
379
|
},
|
|
207
380
|
rules: {
|
|
@@ -471,11 +644,6 @@ const javascript = ({
|
|
|
471
644
|
ignoreConstructors: false
|
|
472
645
|
}
|
|
473
646
|
],
|
|
474
|
-
"quote-props": ["error", "consistent-as-needed"],
|
|
475
|
-
"padding-line-between-statements": [
|
|
476
|
-
"error",
|
|
477
|
-
{ blankLine: "always", prev: "*", next: "return" }
|
|
478
|
-
],
|
|
479
647
|
"prefer-exponentiation-operator": "error",
|
|
480
648
|
"prefer-rest-params": "error",
|
|
481
649
|
"prefer-spread": "error",
|
|
@@ -542,11 +710,6 @@ const javascript = ({
|
|
|
542
710
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
543
711
|
// so1ve
|
|
544
712
|
"so1ve/import-dedupe": "error",
|
|
545
|
-
"so1ve/no-useless-template-string": "error",
|
|
546
|
-
"so1ve/no-negated-comparison": "error",
|
|
547
|
-
"so1ve/no-import-promises-as": "error",
|
|
548
|
-
"so1ve/pad-after-last-import": "error",
|
|
549
|
-
"so1ve/function-style": "error",
|
|
550
713
|
"so1ve/use-async-with-await": "error",
|
|
551
714
|
// Sort Imports
|
|
552
715
|
"sort-imports/imports": ["error"],
|
|
@@ -568,34 +731,6 @@ const javascript = ({
|
|
|
568
731
|
}
|
|
569
732
|
];
|
|
570
733
|
|
|
571
|
-
const jsdoc = () => [
|
|
572
|
-
{
|
|
573
|
-
plugins: {
|
|
574
|
-
jsdoc: pluginJsdoc
|
|
575
|
-
},
|
|
576
|
-
rules: {
|
|
577
|
-
"jsdoc/check-access": "error",
|
|
578
|
-
"jsdoc/check-alignment": "error",
|
|
579
|
-
"jsdoc/check-param-names": "error",
|
|
580
|
-
"jsdoc/check-property-names": "error",
|
|
581
|
-
"jsdoc/check-types": "error",
|
|
582
|
-
"jsdoc/empty-tags": "error",
|
|
583
|
-
"jsdoc/implements-on-classes": "error",
|
|
584
|
-
"jsdoc/multiline-blocks": "error",
|
|
585
|
-
"jsdoc/no-defaults": "error",
|
|
586
|
-
"jsdoc/no-multi-asterisks": "error",
|
|
587
|
-
"jsdoc/require-param-name": "error",
|
|
588
|
-
"jsdoc/require-property": "error",
|
|
589
|
-
"jsdoc/require-property-description": "error",
|
|
590
|
-
"jsdoc/require-property-name": "error",
|
|
591
|
-
"jsdoc/require-returns-check": "error",
|
|
592
|
-
"jsdoc/require-returns-description": "error",
|
|
593
|
-
"jsdoc/require-yields-check": "error",
|
|
594
|
-
"jsdoc/valid-types": "error"
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
];
|
|
598
|
-
|
|
599
734
|
const jsonc = () => [
|
|
600
735
|
{
|
|
601
736
|
plugins: {
|
|
@@ -614,22 +749,6 @@ const jsonc = () => [
|
|
|
614
749
|
"jsonc/quotes": "off",
|
|
615
750
|
"jsonc/quotes-props": "off"
|
|
616
751
|
}
|
|
617
|
-
},
|
|
618
|
-
{
|
|
619
|
-
files: [GLOB_PACKAGEJSON],
|
|
620
|
-
rules: {
|
|
621
|
-
"jsonc/sort-keys": [
|
|
622
|
-
"error",
|
|
623
|
-
{
|
|
624
|
-
pathPattern: "^exports$",
|
|
625
|
-
order: { type: "asc" }
|
|
626
|
-
},
|
|
627
|
-
{
|
|
628
|
-
pathPattern: "^exports.*$",
|
|
629
|
-
order: ["types", "require", "import", "default"]
|
|
630
|
-
}
|
|
631
|
-
]
|
|
632
|
-
}
|
|
633
752
|
}
|
|
634
753
|
];
|
|
635
754
|
|
|
@@ -784,7 +903,6 @@ const test = ({
|
|
|
784
903
|
"vitest/prefer-to-have-length": "error",
|
|
785
904
|
"vitest/prefer-todo": "error",
|
|
786
905
|
"vitest/valid-title": ["error", { allowArguments: true }],
|
|
787
|
-
"jest-formatting/padding-around-all": "error",
|
|
788
906
|
...overrides
|
|
789
907
|
}
|
|
790
908
|
}
|
|
@@ -908,6 +1026,7 @@ function typescript({
|
|
|
908
1026
|
parser: parserTs,
|
|
909
1027
|
parserOptions: {
|
|
910
1028
|
sourceType: "module",
|
|
1029
|
+
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
911
1030
|
EXPERIMENTAL_useProjectService: true,
|
|
912
1031
|
...parserOptions
|
|
913
1032
|
}
|
|
@@ -1087,25 +1206,24 @@ const unicorn = () => [
|
|
|
1087
1206
|
unicorn: pluginUnicorn
|
|
1088
1207
|
},
|
|
1089
1208
|
rules: {
|
|
1209
|
+
"unicorn/throw-new-error": "error",
|
|
1210
|
+
"unicorn/relative-url-style": ["error", "always"],
|
|
1211
|
+
"unicorn/switch-case-braces": "error",
|
|
1212
|
+
"unicorn/number-literal-case": "error",
|
|
1213
|
+
"unicorn/numeric-separators-style": "error",
|
|
1214
|
+
"unicorn/new-for-builtins": "error",
|
|
1090
1215
|
"unicorn/error-message": "error",
|
|
1091
1216
|
"unicorn/escape-case": "error",
|
|
1217
|
+
"unicorn/explicit-length-check": "error",
|
|
1092
1218
|
"unicorn/no-instanceof-array": "error",
|
|
1093
1219
|
"unicorn/no-new-buffer": "error",
|
|
1094
1220
|
"unicorn/no-new-array": "error",
|
|
1095
|
-
"unicorn/no-unsafe-regex": "off",
|
|
1096
|
-
"unicorn/number-literal-case": "error",
|
|
1097
|
-
"unicorn/numeric-separators-style": "error",
|
|
1098
|
-
"unicorn/throw-new-error": "error",
|
|
1099
|
-
"unicorn/no-useless-spread": "error",
|
|
1100
|
-
"unicorn/relative-url-style": ["error", "always"],
|
|
1101
|
-
"unicorn/explicit-length-check": "error",
|
|
1102
|
-
"unicorn/new-for-builtins": "error",
|
|
1103
1221
|
"unicorn/no-array-for-each": "error",
|
|
1104
1222
|
"unicorn/no-array-method-this-argument": "error",
|
|
1105
1223
|
"unicorn/no-for-loop": "error",
|
|
1106
1224
|
"unicorn/no-lonely-if": "error",
|
|
1107
1225
|
"unicorn/no-negated-condition": "error",
|
|
1108
|
-
"unicorn/
|
|
1226
|
+
"unicorn/no-useless-spread": "error",
|
|
1109
1227
|
"unicorn/prefer-ternary": "error",
|
|
1110
1228
|
"unicorn/prefer-query-selector": "error",
|
|
1111
1229
|
"unicorn/prefer-modern-dom-apis": "error",
|
|
@@ -1124,8 +1242,11 @@ const unicorn = () => [
|
|
|
1124
1242
|
"unicorn/prefer-text-content": "error",
|
|
1125
1243
|
"unicorn/prefer-type-error": "error",
|
|
1126
1244
|
"unicorn/prefer-node-protocol": "error",
|
|
1245
|
+
"unicorn/prefer-negative-index": "error",
|
|
1127
1246
|
"unicorn/prefer-regexp-test": "error",
|
|
1128
|
-
"unicorn/prefer-optional-catch-binding": "error"
|
|
1247
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
1248
|
+
"unicorn/prefer-object-from-entries": "error",
|
|
1249
|
+
"unicorn/prefer-prototype-methods": "error"
|
|
1129
1250
|
}
|
|
1130
1251
|
}
|
|
1131
1252
|
];
|
|
@@ -1170,7 +1291,7 @@ const vue = ({
|
|
|
1170
1291
|
"vue/block-order": [
|
|
1171
1292
|
"error",
|
|
1172
1293
|
{
|
|
1173
|
-
order: ["script", "template", "style"]
|
|
1294
|
+
order: ["script:not([setup])", "script[setup]", "template", "style"]
|
|
1174
1295
|
}
|
|
1175
1296
|
],
|
|
1176
1297
|
"vue/component-api-style": ["error", ["script-setup", "composition"]],
|
|
@@ -1358,13 +1479,14 @@ const flatConfigProps = [
|
|
|
1358
1479
|
];
|
|
1359
1480
|
const VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
|
|
1360
1481
|
function so1ve(options = {}, ...userConfigs) {
|
|
1361
|
-
var _a, _b, _c, _d, _e;
|
|
1482
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1362
1483
|
const {
|
|
1363
1484
|
vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
|
|
1364
1485
|
solid: enableSolid = isPackageExists("solid-js"),
|
|
1365
1486
|
typescript: enableTypeScript = isPackageExists("typescript"),
|
|
1366
1487
|
gitignore: enableGitignore = true,
|
|
1367
|
-
overrides = {}
|
|
1488
|
+
overrides = {},
|
|
1489
|
+
componentExts = []
|
|
1368
1490
|
} = options;
|
|
1369
1491
|
const configs = [];
|
|
1370
1492
|
if (enableGitignore) {
|
|
@@ -1385,13 +1507,10 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1385
1507
|
node(),
|
|
1386
1508
|
onlyError(),
|
|
1387
1509
|
promise(),
|
|
1388
|
-
// jsdoc(),
|
|
1389
1510
|
sortImports(),
|
|
1390
1511
|
imports(),
|
|
1391
|
-
jsdoc(),
|
|
1392
1512
|
unicorn()
|
|
1393
1513
|
);
|
|
1394
|
-
const componentExts = [];
|
|
1395
1514
|
if (enableVue) {
|
|
1396
1515
|
componentExts.push("vue");
|
|
1397
1516
|
}
|
|
@@ -1451,6 +1570,9 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1451
1570
|
})
|
|
1452
1571
|
);
|
|
1453
1572
|
}
|
|
1573
|
+
if ((_f = options.formatting) != null ? _f : true) {
|
|
1574
|
+
configs.push(formatting(options));
|
|
1575
|
+
}
|
|
1454
1576
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
1455
1577
|
if (key in options) {
|
|
1456
1578
|
acc[key] = options[key];
|
|
@@ -1464,4 +1586,4 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1464
1586
|
return merged;
|
|
1465
1587
|
}
|
|
1466
1588
|
|
|
1467
|
-
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, combine, comments, html, ignores, imports, javascript,
|
|
1589
|
+
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, combine, comments, formatting, html, ignores, imports, javascript, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@so1ve/eslint-config",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.9",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
|
|
5
5
|
"description": "Ray's eslint config.",
|
|
6
6
|
"keywords": [
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"toml-eslint-parser": "^0.6.0",
|
|
71
71
|
"vue-eslint-parser": "^9.3.1",
|
|
72
72
|
"yaml-eslint-parser": "^1.2.2",
|
|
73
|
-
"@so1ve/eslint-plugin": "1.0.0-alpha.
|
|
74
|
-
"@so1ve/eslint-plugin-sort-imports": "1.0.0-alpha.
|
|
73
|
+
"@so1ve/eslint-plugin": "1.0.0-alpha.9",
|
|
74
|
+
"@so1ve/eslint-plugin-sort-imports": "1.0.0-alpha.9"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"eslint": "^8.46.0"
|