@ntnyq/eslint-config 2.0.0-beta.17 → 2.0.0-beta.19

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.js CHANGED
@@ -29,7 +29,12 @@ var GLOB_ALL_SRC = [
29
29
  ];
30
30
  var GLOB_NODE_MODULES = "**/node_modules/**";
31
31
  var GLOB_DIST = "**/dist/**";
32
- var GLOB_LOCKFILE = ["**/package-lock.json", "**/yarn.lock", "**/pnpm-lock.yaml"];
32
+ var GLOB_LOCKFILE = [
33
+ "**/package-lock.json",
34
+ "**/yarn.lock",
35
+ "**/pnpm-lock.yaml",
36
+ "**/bun.lockb"
37
+ ];
33
38
  var GLOB_EXCLUDE = [
34
39
  GLOB_NODE_MODULES,
35
40
  GLOB_DIST,
@@ -53,436 +58,417 @@ var GLOB_EXCLUDE = [
53
58
  "**/.yarnrc"
54
59
  ];
55
60
 
56
- // src/configs/js.ts
57
- import globals from "globals";
58
- import jsConfig from "@eslint/js";
59
- import importPlugin from "eslint-plugin-import";
60
- import unicornPlugin from "eslint-plugin-unicorn";
61
- var js = [
62
- jsConfig.configs.recommended,
61
+ // src/configs/vue.ts
62
+ import { getPackageInfoSync } from "local-pkg";
63
+
64
+ // src/parsers.ts
65
+ import * as parserYml from "yaml-eslint-parser";
66
+ import * as parserVue from "vue-eslint-parser";
67
+ import * as parserJsonc from "jsonc-eslint-parser";
68
+ import * as parserAstro from "astro-eslint-parser";
69
+ import * as parserTypescript from "@typescript-eslint/parser";
70
+
71
+ // src/plugins.ts
72
+ import * as _pluginVue from "eslint-plugin-vue";
73
+ import * as _pluginReact from "eslint-plugin-react";
74
+ import * as _pluginUnoCSS from "@unocss/eslint-plugin";
75
+ import * as _pluginUnicorn from "eslint-plugin-unicorn";
76
+ import * as _pluginPrettier from "eslint-plugin-prettier";
77
+ import * as _pluginMarkdown from "eslint-plugin-markdown";
78
+ import * as _pluginReactHooks from "eslint-plugin-react-hooks";
79
+ import * as _pluginComments from "eslint-plugin-eslint-comments";
80
+ import * as _pluginTypeScript from "@typescript-eslint/eslint-plugin";
81
+ import * as pluginYml from "eslint-plugin-yml";
82
+ import * as pluginAstro from "eslint-plugin-astro";
83
+ import * as pluginJsonc from "eslint-plugin-jsonc";
84
+ import * as pluginImport from "eslint-plugin-import";
85
+ function interopDefault(mod) {
86
+ return mod.default || mod;
87
+ }
88
+ var pluginVue = interopDefault(_pluginVue);
89
+ var pluginReact = interopDefault(_pluginReact);
90
+ var pluginUnoCSS = interopDefault(_pluginUnoCSS);
91
+ var pluginUnicorn = interopDefault(_pluginUnicorn);
92
+ var pluginPrettier = interopDefault(_pluginPrettier);
93
+ var pluginMarkdown = interopDefault(_pluginMarkdown);
94
+ var pluginComments = interopDefault(_pluginComments);
95
+ var pluginReactHooks = interopDefault(_pluginReactHooks);
96
+ var pluginTypescript = interopDefault(_pluginTypeScript);
97
+
98
+ // src/configs/typescript.ts
99
+ var typescript = [
63
100
  {
101
+ files: [GLOB_TS, GLOB_TSX],
64
102
  languageOptions: {
65
- globals: {
66
- ...globals.browser,
67
- ...globals.es2021,
68
- ...globals.node
69
- },
70
- sourceType: "module"
103
+ parser: parserTypescript,
104
+ parserOptions: {
105
+ sourceType: "module"
106
+ }
107
+ },
108
+ plugins: {
109
+ "@typescript-eslint": pluginTypescript
71
110
  },
72
111
  rules: {
73
- // standard v 17.0.0
74
- "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
75
- "array-bracket-spacing": ["error", "never"],
76
- "arrow-spacing": ["error", { before: true, after: true }],
77
- "block-spacing": ["error", "always"],
78
- "brace-style": ["error", "1tbs", { allowSingleLine: true }],
79
- camelcase: [
80
- "error",
81
- {
82
- allow: ["^UNSAFE_"],
83
- properties: "never",
84
- ignoreGlobals: true
85
- }
86
- ],
87
- "comma-spacing": ["error", { before: false, after: true }],
88
- "comma-style": ["error", "last"],
89
- "computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
90
- "constructor-super": "error",
91
- curly: ["error", "multi-line"],
92
- "default-case-last": "error",
93
- "dot-location": ["error", "property"],
94
- "dot-notation": ["error", { allowKeywords: true }],
95
- "eol-last": "error",
96
- "func-call-spacing": ["error", "never"],
97
- indent: [
98
- "error",
99
- 2,
100
- {
101
- SwitchCase: 1,
102
- VariableDeclarator: 1,
103
- outerIIFEBody: 1,
104
- MemberExpression: 1,
105
- FunctionDeclaration: { parameters: 1, body: 1 },
106
- FunctionExpression: { parameters: 1, body: 1 },
107
- CallExpression: { arguments: 1 },
108
- ArrayExpression: 1,
109
- ObjectExpression: 1,
110
- ImportDeclaration: 1,
111
- flatTernaryExpressions: false,
112
- ignoreComments: false,
113
- ignoredNodes: [
114
- "TemplateLiteral *",
115
- "JSXElement",
116
- "JSXElement > *",
117
- "JSXAttribute",
118
- "JSXIdentifier",
119
- "JSXNamespacedName",
120
- "JSXMemberExpression",
121
- "JSXSpreadAttribute",
122
- "JSXExpressionContainer",
123
- "JSXOpeningElement",
124
- "JSXClosingElement",
125
- "JSXFragment",
126
- "JSXOpeningFragment",
127
- "JSXClosingFragment",
128
- "JSXText",
129
- "JSXEmptyExpression",
130
- "JSXSpreadChild"
131
- ],
132
- offsetTernaryExpressions: true
133
- }
134
- ],
135
- "key-spacing": ["error", { beforeColon: false, afterColon: true }],
136
- "keyword-spacing": ["error", { before: true, after: true }],
137
- "lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
138
- "multiline-ternary": ["error", "always-multiline"],
139
- "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
140
- "new-parens": "error",
141
- "no-array-constructor": "error",
142
- "no-async-promise-executor": "error",
143
- "no-caller": "error",
144
- "no-class-assign": "error",
145
- "no-compare-neg-zero": "error",
146
- "no-cond-assign": "error",
147
- "no-const-assign": "error",
148
- "no-constant-condition": ["error", { checkLoops: false }],
149
- "no-control-regex": "error",
150
- "no-debugger": "error",
151
- "no-delete-var": "error",
152
- "no-dupe-args": "error",
153
- "no-dupe-class-members": "error",
154
- "no-dupe-keys": "error",
155
- "no-duplicate-case": "error",
156
- "no-useless-backreference": "error",
157
- "no-empty": ["error", { allowEmptyCatch: true }],
158
- "no-empty-character-class": "error",
159
- "no-empty-pattern": "error",
160
- "no-eval": "error",
161
- "no-ex-assign": "error",
162
- "no-extend-native": "error",
163
- "no-extra-bind": "error",
164
- "no-extra-boolean-cast": "error",
165
- "no-extra-parens": ["error", "functions"],
166
- "no-fallthrough": "error",
167
- "no-floating-decimal": "error",
168
- "no-func-assign": "error",
169
- "no-global-assign": "error",
170
- "no-implied-eval": "error",
171
- "no-import-assign": "error",
172
- "no-invalid-regexp": "error",
173
- "no-irregular-whitespace": "error",
174
- "no-iterator": "error",
175
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
176
- "no-lone-blocks": "error",
177
- "no-loss-of-precision": "error",
178
- "no-misleading-character-class": "error",
179
- "no-prototype-builtins": "error",
180
- "no-useless-catch": "error",
181
- "no-mixed-operators": [
112
+ ...pluginTypescript.configs.recommended.rules,
113
+ ...pluginTypescript.configs.stylistic.rules,
114
+ "@typescript-eslint/no-unused-vars": "error",
115
+ "@typescript-eslint/no-redeclare": "error",
116
+ "@typescript-eslint/consistent-type-imports": [
182
117
  "error",
183
118
  {
184
- groups: [
185
- ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
186
- ["&&", "||"],
187
- ["in", "instanceof"]
188
- ],
189
- allowSamePrecedence: true
119
+ prefer: "type-imports",
120
+ fixStyle: "separate-type-imports",
121
+ disallowTypeAnnotations: false
190
122
  }
191
123
  ],
192
- "no-mixed-spaces-and-tabs": "error",
193
- "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
194
- "no-new": "error",
195
- "no-new-func": "error",
196
- "no-new-object": "error",
197
- "no-new-symbol": "error",
198
- "no-new-wrappers": "error",
199
- "no-obj-calls": "error",
200
- "no-octal": "error",
201
- "no-octal-escape": "error",
202
- "no-proto": "error",
203
- "no-redeclare": ["error", { builtinGlobals: false }],
204
- "no-regex-spaces": "error",
205
- "no-self-assign": ["error", { props: true }],
206
- "no-self-compare": "error",
207
- "no-sequences": "error",
208
- "no-shadow-restricted-names": "error",
209
- "no-sparse-arrays": "error",
210
- "no-tabs": "error",
211
- "no-template-curly-in-string": "error",
212
- "no-this-before-super": "error",
213
- "no-throw-literal": "error",
214
- "no-trailing-spaces": "error",
215
- "no-undef": "error",
216
- "no-undef-init": "error",
217
- "no-unexpected-multiline": "error",
218
- "no-unmodified-loop-condition": "error",
219
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
220
- "no-unreachable": "error",
221
- "no-unreachable-loop": "error",
222
- "no-unsafe-finally": "error",
223
- "no-unsafe-negation": "error",
224
- "no-unused-expressions": [
124
+ "@typescript-eslint/consistent-type-assertions": [
225
125
  "error",
226
126
  {
227
- allowShortCircuit: true,
228
- allowTernary: true,
229
- allowTaggedTemplates: true
127
+ assertionStyle: "as",
128
+ objectLiteralTypeAssertions: "allow-as-parameter"
230
129
  }
231
130
  ],
232
- "no-unused-vars": [
233
- "error",
234
- {
235
- args: "none",
236
- caughtErrors: "none",
237
- ignoreRestSiblings: true,
238
- vars: "all"
131
+ "@typescript-eslint/prefer-as-const": "warn",
132
+ "@typescript-eslint/ban-types": "off",
133
+ "@typescript-eslint/camelcase": "off",
134
+ "@typescript-eslint/no-namespace": "off",
135
+ "@typescript-eslint/ban-ts-ignore": "off",
136
+ "@typescript-eslint/ban-ts-comment": "off",
137
+ "@typescript-eslint/no-explicit-any": "off",
138
+ "@typescript-eslint/no-empty-function": "off",
139
+ "@typescript-eslint/naming-convention": "off",
140
+ "@typescript-eslint/no-empty-interface": "off",
141
+ "@typescript-eslint/no-non-null-assertion": "off",
142
+ "@typescript-eslint/triple-slash-reference": "off",
143
+ "@typescript-eslint/no-parameter-properties": "off",
144
+ "@typescript-eslint/explicit-member-accessibility": "off",
145
+ "@typescript-eslint/explicit-function-return-type": "off",
146
+ "@typescript-eslint/explicit-module-boundary-types": "off",
147
+ "@typescript-eslint/consistent-indexed-object-style": "off"
148
+ }
149
+ },
150
+ {
151
+ files: ["**/*.d.ts"],
152
+ rules: {
153
+ "import/no-duplicates": "off",
154
+ "import/newline-after-import": "off"
155
+ }
156
+ },
157
+ {
158
+ files: ["**/*.{spec,test}.ts?(x)"],
159
+ rules: {
160
+ "no-unused-expressions": "off",
161
+ "max-lines-per-function": "off"
162
+ }
163
+ },
164
+ {
165
+ files: ["**/*.js", "**/*.cjs"],
166
+ rules: {
167
+ "@typescript-eslint/no-var-requires": "off"
168
+ }
169
+ }
170
+ ];
171
+
172
+ // src/configs/vue.ts
173
+ function getVueVersion() {
174
+ const pkg = getPackageInfoSync("vue", { paths: [process.cwd()] });
175
+ if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
176
+ return +pkg.version[0];
177
+ }
178
+ return 3;
179
+ }
180
+ var isVue3 = getVueVersion() === 3;
181
+ var vueBaseRules = {};
182
+ var vue2Rules = {
183
+ ...vueBaseRules
184
+ };
185
+ var vue3Rules = {
186
+ ...vueBaseRules
187
+ };
188
+ var vue = [
189
+ {
190
+ files: [GLOB_VUE],
191
+ plugins: {
192
+ vue: pluginVue,
193
+ "@typescript-eslint": pluginTypescript
194
+ },
195
+ languageOptions: {
196
+ parser: parserVue,
197
+ parserOptions: {
198
+ parser: "@typescript-eslint/parser",
199
+ sourceType: "module",
200
+ extraFileExtensions: [".vue"],
201
+ ecmaFeatures: {
202
+ jsx: true
239
203
  }
240
- ],
241
- "no-useless-call": "error",
242
- "no-useless-computed-key": "error",
243
- "no-useless-constructor": "error",
244
- "no-useless-rename": "error",
245
- "no-useless-return": "error",
246
- "no-whitespace-before-property": "error",
247
- "object-curly-newline": ["error", { multiline: true, consistent: true }],
248
- "object-curly-spacing": ["error", "always"],
249
- "object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
250
- "padded-blocks": ["error", { blocks: "never", switches: "never", classes: "never" }],
251
- "prefer-promise-reject-errors": "error",
252
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
253
- "quote-props": ["error", "as-needed"],
254
- "rest-spread-spacing": ["error", "never"],
255
- semi: ["error", "never"],
256
- "semi-spacing": ["error", { before: false, after: true }],
257
- "space-before-blocks": ["error", "always"],
258
- "space-before-function-paren": ["error", "always"],
259
- "space-in-parens": ["error", "never"],
260
- "space-infix-ops": "error",
261
- "space-unary-ops": ["error", { words: true, nonwords: false }],
262
- "symbol-description": "error",
263
- "template-tag-spacing": ["error", "never"],
264
- "unicode-bom": ["error", "never"],
265
- "use-isnan": [
266
- "error",
267
- {
268
- enforceForSwitchCase: true,
269
- enforceForIndexOf: true
270
- }
271
- ],
272
- "valid-typeof": ["error", { requireStringLiterals: true }],
273
- "wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
274
- "yield-star-spacing": ["error", "both"],
275
- yoda: ["error", "never"],
276
- // es6+
277
- "no-var": "error",
278
- "prefer-rest-params": "error",
279
- "prefer-spread": "error",
280
- "prefer-template": "error",
281
- "template-curly-spacing": "error",
282
- "generator-star-spacing": "off",
283
- "no-empty-static-block": "error",
284
- "no-new-native-nonconstructor": "error",
285
- "arrow-parens": [
286
- "error",
287
- "as-needed",
288
- {
289
- requireForBlockBody: false
290
- }
291
- ],
292
- quotes: [
293
- "error",
294
- "single",
295
- {
296
- avoidEscape: true,
297
- allowTemplateLiterals: false
298
- }
299
- ],
300
- "prefer-const": [
301
- "error",
302
- {
303
- destructuring: "all",
304
- ignoreReadBeforeAssign: true
305
- }
306
- ],
307
- "prefer-arrow-callback": [
308
- "error",
309
- {
310
- allowNamedFunctions: false,
311
- allowUnboundThis: true
312
- }
313
- ],
314
- "object-shorthand": [
315
- "error",
316
- "always",
317
- {
318
- ignoreConstructors: false,
319
- avoidQuotes: true
320
- }
321
- ],
322
- "spaced-comment": [
323
- "error",
324
- "always",
325
- {
326
- line: {
327
- markers: ["/"],
328
- exceptions: ["/", "#"]
329
- },
330
- block: {
331
- markers: ["!"],
332
- exceptions: ["*"],
333
- balanced: true
334
- }
335
- }
336
- ],
337
- // best-practice
338
- eqeqeq: ["error", "smart"],
339
- complexity: ["error", { max: 30 }],
340
- "array-callback-return": "error",
341
- "block-scoped-var": "error",
342
- "consistent-return": "off",
343
- "no-alert": "error",
344
- "no-case-declarations": "error",
345
- "no-multi-spaces": "error",
346
- "no-multi-str": "error",
347
- "no-with": "error",
348
- "no-void": "error",
349
- "no-useless-escape": "off",
350
- "vars-on-top": "error",
351
- "require-await": "off",
352
- "no-return-assign": "off",
353
- "one-var": ["error", "never"],
354
- "operator-linebreak": ["error", "before"],
355
- "comma-dangle": ["error", "always-multiline"],
356
- "max-params": ["error", { max: 5 }],
357
- "max-depth": ["error", { max: 5 }],
358
- "max-nested-callbacks": ["error", { max: 10 }],
359
- "max-statements-per-line": ["error", { max: 2 }],
360
- "max-lines": [
361
- "error",
362
- {
363
- max: 1e3,
364
- skipComments: true,
365
- skipBlankLines: true
366
- }
367
- ],
368
- "max-lines-per-function": [
369
- "error",
370
- {
371
- max: 100,
372
- skipComments: true,
373
- skipBlankLines: true
374
- }
375
- ],
376
- "no-use-before-define": [
377
- "error",
378
- {
379
- functions: false,
380
- classes: false,
381
- variables: true
382
- }
383
- ],
384
- "max-len": [
385
- "error",
386
- {
387
- code: 200,
388
- tabWidth: 2,
389
- comments: 200,
390
- ignoreUrls: true,
391
- ignoreStrings: true,
392
- ignoreRegExpLiterals: true,
393
- ignoreTemplateLiterals: true,
394
- ignoreTrailingComments: true
395
- }
396
- ],
397
- "sort-imports": [
398
- "error",
399
- {
400
- ignoreCase: false,
401
- ignoreDeclarationSort: true,
402
- ignoreMemberSort: false,
403
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
404
- allowSeparatedGroups: false
405
- }
406
- ]
407
- }
408
- },
409
- {
410
- files: ["**/scripts/*", "**/cli.*"],
204
+ }
205
+ },
206
+ processor: pluginVue.processors[".vue"],
411
207
  rules: {
412
- "no-console": "off"
208
+ ...typescript[0].rules
413
209
  }
414
210
  },
415
211
  {
416
- files: ["**/*.{test,spec}.js?(x)"],
212
+ plugins: {
213
+ vue: pluginVue
214
+ },
215
+ rules: isVue3 ? vue3Rules : vue2Rules
216
+ }
217
+ ];
218
+
219
+ // src/configs/yml.ts
220
+ var yml = [
221
+ {
222
+ files: [GLOB_YAML],
223
+ languageOptions: {
224
+ parser: parserYml
225
+ },
226
+ plugins: {
227
+ yml: pluginYml
228
+ },
417
229
  rules: {
418
- "no-unused-expressions": "off",
419
- "max-lines-per-function": "off"
230
+ ...pluginYml.configs.standard.rules,
231
+ ...pluginYml.configs.prettier.rules,
232
+ "yml/no-empty-mapping-value": "off"
420
233
  }
421
234
  }
422
235
  ];
423
- var jsx = [
236
+
237
+ // src/configs/react.ts
238
+ var react = [
424
239
  {
425
- files: ["**/*.jsx"],
240
+ files: [GLOB_JSX, GLOB_TSX],
241
+ plugins: {
242
+ react: pluginReact,
243
+ "react-hooks": pluginReactHooks
244
+ },
245
+ settings: {
246
+ react: {
247
+ version: "18.0"
248
+ }
249
+ },
426
250
  languageOptions: {
427
251
  parserOptions: {
428
252
  ecmaFeatures: {
429
253
  jsx: true
430
254
  }
431
255
  }
256
+ },
257
+ rules: {
258
+ ...pluginReact.configs.recommended.rules,
259
+ ...pluginReactHooks.configs.recommended.rules,
260
+ "jsx-quotes": ["error", "prefer-double"],
261
+ "react/react-in-jsx-scope": "off"
432
262
  }
433
263
  }
434
264
  ];
435
- var imports = [
265
+
266
+ // src/configs/astro.ts
267
+ var astro = [
436
268
  {
269
+ files: [GLOB_ASTRO],
437
270
  plugins: {
438
- import: importPlugin
271
+ astro: pluginAstro
439
272
  },
440
- settings: {
441
- "import/resolver": {
442
- node: { extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts"] }
273
+ languageOptions: {
274
+ parser: parserAstro,
275
+ parserOptions: {
276
+ parser: "@typescript-eslint/parser",
277
+ extraFileExtensions: [".astro"]
443
278
  }
444
279
  },
445
280
  rules: {
446
- "import/no-unresolved": "off",
447
- "import/no-absolute-path": "off",
448
- "import/no-named-as-default-member": "off",
449
- "import/first": "error",
450
- "import/no-duplicates": "error",
451
- "import/no-mutable-exports": "error",
452
- "import/newline-after-import": "error",
453
- "import/order": [
454
- "error",
455
- {
456
- groups: [
457
- "builtin",
458
- "external",
459
- "internal",
460
- "parent",
461
- "sibling",
462
- "index",
463
- "object",
464
- "type"
465
- ],
466
- "newlines-between": "never",
467
- pathGroups: [{ pattern: "@/**", group: "internal" }],
468
- pathGroupsExcludedImportTypes: ["type"]
469
- }
470
- ]
281
+ ...pluginAstro.configs.recommended.rules
471
282
  }
472
283
  }
473
284
  ];
474
- var unicorn = [
285
+
286
+ // src/configs/jsonc.ts
287
+ var jsonc = [
475
288
  {
289
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
476
290
  plugins: {
477
- unicorn: unicornPlugin
291
+ jsonc: pluginJsonc
292
+ },
293
+ languageOptions: {
294
+ parser: parserJsonc
478
295
  },
479
296
  rules: {
480
- "unicorn/no-unsafe-regex": "off",
481
- "unicorn/error-message": "error",
482
- "unicorn/escape-case": "error",
483
- "unicorn/no-new-buffer": "error",
484
- "unicorn/number-literal-case": "error",
485
- "unicorn/prefer-includes": "error",
297
+ ...pluginJsonc.configs["recommended-with-jsonc"].rules,
298
+ "jsonc/array-bracket-spacing": ["error", "never"],
299
+ "jsonc/comma-dangle": ["error", "never"],
300
+ "jsonc/comma-style": ["error", "last"],
301
+ "jsonc/indent": ["error", 2],
302
+ "jsonc/key-spacing": [
303
+ "error",
304
+ {
305
+ beforeColon: false,
306
+ afterColon: true
307
+ }
308
+ ],
309
+ "jsonc/no-octal-escape": "error",
310
+ "jsonc/object-curly-newline": [
311
+ "error",
312
+ {
313
+ multiline: true,
314
+ consistent: true
315
+ }
316
+ ],
317
+ "jsonc/object-curly-spacing": ["error", "always"],
318
+ "jsonc/object-property-newline": [
319
+ "error",
320
+ {
321
+ allowMultiplePropertiesPerLine: true
322
+ }
323
+ ]
324
+ }
325
+ }
326
+ ];
327
+ var jsonOrder = [
328
+ {
329
+ files: ["**/package.json"],
330
+ rules: {
331
+ "jsonc/sort-keys": [
332
+ "error",
333
+ {
334
+ pathPattern: "^$",
335
+ order: [
336
+ "publisher",
337
+ "name",
338
+ "displayName",
339
+ "type",
340
+ "version",
341
+ "private",
342
+ "packageManager",
343
+ "description",
344
+ "keywords",
345
+ "license",
346
+ "author",
347
+ "homepage",
348
+ "repository",
349
+ "funding",
350
+ "exports",
351
+ "main",
352
+ "module",
353
+ "unpkg",
354
+ "jsdelivr",
355
+ // workaround for `type: "module"` with TS `moduleResolution: "node16"`
356
+ "types",
357
+ "typesVersions",
358
+ "bin",
359
+ "icon",
360
+ "files",
361
+ "sideEffects",
362
+ "scripts",
363
+ "peerDependencies",
364
+ "peerDependenciesMeta",
365
+ "dependencies",
366
+ "optionalDependencies",
367
+ "devDependencies",
368
+ "activationEvents",
369
+ "contributes",
370
+ "categories",
371
+ "engines",
372
+ "pnpm",
373
+ "overrides",
374
+ "resolutions",
375
+ "husky",
376
+ "prettier",
377
+ "nano-staged",
378
+ "lint-staged",
379
+ "eslintConfig"
380
+ ]
381
+ },
382
+ {
383
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$",
384
+ order: { type: "asc" }
385
+ },
386
+ {
387
+ pathPattern: "^exports.*$",
388
+ order: ["types", "import", "require", "default"]
389
+ },
390
+ {
391
+ pathPattern: "^scripts$",
392
+ order: { type: "asc" }
393
+ }
394
+ ],
395
+ "jsonc/sort-array-values": [
396
+ "error",
397
+ {
398
+ pathPattern: "^files$",
399
+ order: { type: "asc" }
400
+ }
401
+ ]
402
+ }
403
+ }
404
+ ];
405
+
406
+ // src/configs/imports.ts
407
+ var imports = [
408
+ {
409
+ plugins: {
410
+ import: pluginImport
411
+ },
412
+ settings: {
413
+ "import/resolver": {
414
+ node: { extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts"] }
415
+ }
416
+ },
417
+ rules: {
418
+ "import/no-unresolved": "off",
419
+ "import/no-absolute-path": "off",
420
+ "import/no-named-as-default-member": "off",
421
+ "import/first": "error",
422
+ "import/no-duplicates": "error",
423
+ "import/no-mutable-exports": "error",
424
+ "import/newline-after-import": "error",
425
+ "import/order": [
426
+ "error",
427
+ {
428
+ groups: [
429
+ "builtin",
430
+ "external",
431
+ "internal",
432
+ "parent",
433
+ "sibling",
434
+ "index",
435
+ "object",
436
+ "type"
437
+ ],
438
+ "newlines-between": "never",
439
+ pathGroups: [{ pattern: "{{@,~}/,#}**", group: "internal" }],
440
+ pathGroupsExcludedImportTypes: ["type"]
441
+ }
442
+ ]
443
+ }
444
+ }
445
+ ];
446
+
447
+ // src/configs/unocss.ts
448
+ var unocss = [
449
+ {
450
+ plugins: {
451
+ "@unocss": pluginUnoCSS
452
+ },
453
+ rules: {
454
+ ...pluginUnoCSS.configs.recommended.rules
455
+ }
456
+ }
457
+ ];
458
+
459
+ // src/configs/unicorn.ts
460
+ var unicorn = [
461
+ {
462
+ plugins: {
463
+ unicorn: pluginUnicorn
464
+ },
465
+ rules: {
466
+ "unicorn/no-unsafe-regex": "off",
467
+ "unicorn/error-message": "error",
468
+ "unicorn/escape-case": "error",
469
+ "unicorn/no-new-buffer": "error",
470
+ "unicorn/number-literal-case": "error",
471
+ "unicorn/prefer-includes": "error",
486
472
  "unicorn/prefer-type-error": "error",
487
473
  "unicorn/throw-new-error": "error",
488
474
  "unicorn/no-unnecessary-await": "error",
@@ -545,466 +531,503 @@ var unicorn = [
545
531
  }
546
532
  ];
547
533
 
548
- // src/configs/ts.ts
549
- import * as tsParser from "@typescript-eslint/parser";
550
- import tsPlugin from "@typescript-eslint/eslint-plugin";
551
- var ts = [
534
+ // src/configs/prettier.ts
535
+ import prettierConfig from "eslint-config-prettier";
536
+ var prettier = [
552
537
  {
553
- files: [GLOB_TS, GLOB_TSX],
554
- languageOptions: {
555
- parser: tsParser,
556
- parserOptions: {
557
- sourceType: "module"
558
- }
559
- },
560
538
  plugins: {
561
- "@typescript-eslint": tsPlugin
539
+ prettier: pluginPrettier
562
540
  },
563
541
  rules: {
564
- ...tsPlugin.configs.recommended.rules,
565
- ...tsPlugin.configs.stylistic.rules,
566
- "@typescript-eslint/no-unused-vars": "error",
567
- "@typescript-eslint/no-redeclare": "error",
568
- "@typescript-eslint/consistent-type-imports": [
569
- "error",
570
- {
571
- prefer: "type-imports",
572
- fixStyle: "separate-type-imports",
573
- disallowTypeAnnotations: false
574
- }
575
- ],
576
- "@typescript-eslint/prefer-as-const": "warn",
577
- "@typescript-eslint/ban-types": "off",
578
- "@typescript-eslint/camelcase": "off",
579
- "@typescript-eslint/no-namespace": "off",
580
- "@typescript-eslint/ban-ts-ignore": "off",
581
- "@typescript-eslint/ban-ts-comment": "off",
582
- "@typescript-eslint/no-explicit-any": "off",
583
- "@typescript-eslint/no-empty-function": "off",
584
- "@typescript-eslint/naming-convention": "off",
585
- "@typescript-eslint/no-empty-interface": "off",
586
- "@typescript-eslint/no-non-null-assertion": "off",
587
- "@typescript-eslint/triple-slash-reference": "off",
588
- "@typescript-eslint/no-parameter-properties": "off",
589
- "@typescript-eslint/explicit-member-accessibility": "off",
590
- "@typescript-eslint/explicit-function-return-type": "off",
591
- "@typescript-eslint/explicit-module-boundary-types": "off",
592
- "@typescript-eslint/consistent-indexed-object-style": "off"
593
- }
594
- },
595
- {
596
- files: ["**/*.d.ts"],
597
- rules: {
598
- "import/no-duplicates": "off",
599
- "import/newline-after-import": "off"
600
- }
601
- },
602
- {
603
- files: ["**/*.{spec,test}.ts?(x)"],
604
- rules: {
605
- "no-unused-expressions": "off",
606
- "max-lines-per-function": "off"
607
- }
608
- },
609
- {
610
- files: ["**/*.js", "**/*.cjs"],
611
- rules: {
612
- "@typescript-eslint/no-var-requires": "off"
542
+ ...prettierConfig.rules,
543
+ ...pluginPrettier.configs.recommended.rules,
544
+ "prettier/prettier": "warn"
613
545
  }
614
546
  }
615
547
  ];
616
548
 
617
- // src/configs/vue.ts
618
- import { getPackageInfoSync } from "local-pkg";
619
- import vuePlugin from "eslint-plugin-vue";
620
- import vueParser from "vue-eslint-parser";
621
- import tsPlugin2 from "@typescript-eslint/eslint-plugin";
622
- function getVueVersion() {
623
- const pkg = getPackageInfoSync("vue", { paths: [process.cwd()] });
624
- if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
625
- return +pkg.version[0];
626
- }
627
- return 3;
628
- }
629
- var isVue3 = getVueVersion() === 3;
630
- var vueBaseRules = {};
631
- var vue2Rules = {
632
- ...vueBaseRules
633
- };
634
- var vue3Rules = {
635
- ...vueBaseRules
636
- };
637
- var vue = [
549
+ // src/configs/markdown.ts
550
+ var markdown = [
638
551
  {
639
- files: [GLOB_VUE],
552
+ files: [GLOB_MARKDOWN],
640
553
  plugins: {
641
- vue: vuePlugin,
642
- "@typescript-eslint": tsPlugin2
554
+ markdown: pluginMarkdown
643
555
  },
556
+ processor: "markdown/markdown"
557
+ },
558
+ {
559
+ files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
644
560
  languageOptions: {
645
- parser: vueParser,
646
561
  parserOptions: {
647
- parser: "@typescript-eslint/parser",
648
- sourceType: "module",
649
- extraFileExtensions: [".vue"],
650
562
  ecmaFeatures: {
651
- jsx: true
563
+ impliedStrict: true
652
564
  }
653
565
  }
654
566
  },
655
- processor: vuePlugin.processors[".vue"],
656
- rules: {
657
- // @ts-expect-error 2339
658
- ...ts[0].rules
659
- }
660
- },
661
- {
662
- plugins: {
663
- vue: vuePlugin
664
- },
665
- rules: isVue3 ? vue3Rules : vue2Rules
666
- }
667
- ];
668
-
669
- // src/configs/yml.ts
670
- import ymlPlugin, { configs } from "eslint-plugin-yml";
671
- import * as ymlParser from "yaml-eslint-parser";
672
- var yml = [
673
- {
674
- files: [GLOB_YAML],
675
- languageOptions: {
676
- parser: ymlParser
677
- },
678
567
  plugins: {
679
- yml: ymlPlugin
568
+ "@typescript-eslint": pluginTypescript
680
569
  },
681
- // @ts-expect-error 2322
682
570
  rules: {
683
- ...configs.standard.rules,
684
- ...configs.prettier.rules,
685
- "yml/no-empty-mapping-value": "off"
686
- }
687
- }
688
- ];
689
-
690
- // src/configs/react.ts
691
- import reactPlugin from "eslint-plugin-react";
692
- import reactHooksPlugin from "eslint-plugin-react-hooks";
693
- var react = [
694
- {
695
- files: [GLOB_JSX, GLOB_TSX],
696
- plugins: {
697
- react: reactPlugin,
698
- "react-hooks": reactHooksPlugin
699
- },
700
- settings: {
701
- react: {
702
- version: "18.0"
703
- }
704
- },
705
- languageOptions: {
706
- parserOptions: {
707
- ecmaFeatures: {
708
- jsx: true
709
- }
710
- }
711
- },
712
- rules: {
713
- ...reactPlugin.configs.recommended.rules,
714
- ...reactHooksPlugin.configs.recommended.rules,
715
- "jsx-quotes": ["error", "prefer-double"],
716
- "react/react-in-jsx-scope": "off"
571
+ ...pluginMarkdown.configs.recommended.overrides[1].rules,
572
+ "no-undef": "off",
573
+ "no-alert": "off",
574
+ "no-console": "off",
575
+ "no-unused-vars": "off",
576
+ "no-unused-expressions": "off",
577
+ "no-restricted-imports": "off",
578
+ "import/no-unresolved": "off",
579
+ "@typescript-eslint/comma-dangle": "off",
580
+ "@typescript-eslint/no-redeclare": "off",
581
+ "@typescript-eslint/no-unused-vars": "off",
582
+ "@typescript-eslint/no-var-requires": "off",
583
+ "@typescript-eslint/no-extraneous-class": "off",
584
+ "@typescript-eslint/no-use-before-define": "off",
585
+ "unused-imports/no-unused-imports": "off",
586
+ "unused-imports/no-unused-vars": "off"
717
587
  }
718
588
  }
719
589
  ];
720
590
 
721
- // src/configs/astro.ts
722
- import astroPlugin, { configs as configs2 } from "eslint-plugin-astro";
723
- import astroParser from "astro-eslint-parser";
724
- var astro = [
591
+ // src/configs/comments.ts
592
+ var comments = [
725
593
  {
726
- files: [GLOB_ASTRO],
727
594
  plugins: {
728
- astro: astroPlugin
595
+ "eslint-comments": pluginComments
729
596
  },
730
- languageOptions: {
731
- parser: astroParser,
732
- parserOptions: {
733
- parser: "@typescript-eslint/parser",
734
- extraFileExtensions: [".astro"]
735
- }
736
- },
737
- // @ts-expect-error 2322
738
597
  rules: {
739
- ...configs2.recommended.rules
598
+ ...pluginComments.configs.recommended.rules,
599
+ "eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
740
600
  }
741
601
  }
742
602
  ];
743
603
 
744
- // src/configs/jsonc.ts
745
- import jsoncPlugin, { configs as configs3 } from "eslint-plugin-jsonc";
746
- import jsoncParser from "jsonc-eslint-parser";
747
- var jsonc = [
604
+ // src/configs/javascript.ts
605
+ import globals from "globals";
606
+ import jsConfig from "@eslint/js";
607
+ var javascript = [
608
+ jsConfig.configs.recommended,
748
609
  {
749
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
750
- plugins: {
751
- jsonc: jsoncPlugin
752
- },
753
610
  languageOptions: {
754
- parser: jsoncParser
611
+ globals: {
612
+ ...globals.browser,
613
+ ...globals.es2021,
614
+ ...globals.node
615
+ },
616
+ sourceType: "module"
755
617
  },
756
- // @ts-expect-error 2322
757
618
  rules: {
758
- ...configs3["recommended-with-jsonc"].rules,
759
- "jsonc/array-bracket-spacing": ["error", "never"],
760
- "jsonc/comma-dangle": ["error", "never"],
761
- "jsonc/comma-style": ["error", "last"],
762
- "jsonc/indent": ["error", 2],
763
- "jsonc/key-spacing": [
619
+ // standard v 17.0.0
620
+ "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
621
+ "array-bracket-spacing": ["error", "never"],
622
+ "arrow-spacing": ["error", { before: true, after: true }],
623
+ "block-spacing": ["error", "always"],
624
+ "brace-style": ["error", "1tbs", { allowSingleLine: true }],
625
+ camelcase: [
626
+ "error",
627
+ {
628
+ allow: ["^UNSAFE_"],
629
+ properties: "never",
630
+ ignoreGlobals: true
631
+ }
632
+ ],
633
+ "comma-spacing": ["error", { before: false, after: true }],
634
+ "comma-style": ["error", "last"],
635
+ "computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
636
+ "constructor-super": "error",
637
+ curly: ["error", "multi-line"],
638
+ "default-case-last": "error",
639
+ "dot-location": ["error", "property"],
640
+ "dot-notation": ["error", { allowKeywords: true }],
641
+ "eol-last": "error",
642
+ "func-call-spacing": ["error", "never"],
643
+ indent: [
644
+ "error",
645
+ 2,
646
+ {
647
+ SwitchCase: 1,
648
+ VariableDeclarator: 1,
649
+ outerIIFEBody: 1,
650
+ MemberExpression: 1,
651
+ FunctionDeclaration: { parameters: 1, body: 1 },
652
+ FunctionExpression: { parameters: 1, body: 1 },
653
+ CallExpression: { arguments: 1 },
654
+ ArrayExpression: 1,
655
+ ObjectExpression: 1,
656
+ ImportDeclaration: 1,
657
+ flatTernaryExpressions: false,
658
+ ignoreComments: false,
659
+ ignoredNodes: [
660
+ "TemplateLiteral *",
661
+ "JSXElement",
662
+ "JSXElement > *",
663
+ "JSXAttribute",
664
+ "JSXIdentifier",
665
+ "JSXNamespacedName",
666
+ "JSXMemberExpression",
667
+ "JSXSpreadAttribute",
668
+ "JSXExpressionContainer",
669
+ "JSXOpeningElement",
670
+ "JSXClosingElement",
671
+ "JSXFragment",
672
+ "JSXOpeningFragment",
673
+ "JSXClosingFragment",
674
+ "JSXText",
675
+ "JSXEmptyExpression",
676
+ "JSXSpreadChild"
677
+ ],
678
+ offsetTernaryExpressions: true
679
+ }
680
+ ],
681
+ "key-spacing": ["error", { beforeColon: false, afterColon: true }],
682
+ "keyword-spacing": ["error", { before: true, after: true }],
683
+ "lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
684
+ "multiline-ternary": ["error", "always-multiline"],
685
+ "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
686
+ "new-parens": "error",
687
+ "no-array-constructor": "error",
688
+ "no-async-promise-executor": "error",
689
+ "no-caller": "error",
690
+ "no-class-assign": "error",
691
+ "no-compare-neg-zero": "error",
692
+ "no-cond-assign": "error",
693
+ "no-const-assign": "error",
694
+ "no-constant-condition": ["error", { checkLoops: false }],
695
+ "no-control-regex": "error",
696
+ "no-debugger": "error",
697
+ "no-delete-var": "error",
698
+ "no-dupe-args": "error",
699
+ "no-dupe-class-members": "error",
700
+ "no-dupe-keys": "error",
701
+ "no-duplicate-case": "error",
702
+ "no-useless-backreference": "error",
703
+ "no-empty": ["error", { allowEmptyCatch: true }],
704
+ "no-empty-character-class": "error",
705
+ "no-empty-pattern": "error",
706
+ "no-eval": "error",
707
+ "no-ex-assign": "error",
708
+ "no-extend-native": "error",
709
+ "no-extra-bind": "error",
710
+ "no-extra-boolean-cast": "error",
711
+ "no-extra-parens": ["error", "functions"],
712
+ "no-fallthrough": "error",
713
+ "no-floating-decimal": "error",
714
+ "no-func-assign": "error",
715
+ "no-global-assign": "error",
716
+ "no-implied-eval": "error",
717
+ "no-import-assign": "error",
718
+ "no-invalid-regexp": "error",
719
+ "no-irregular-whitespace": "error",
720
+ "no-iterator": "error",
721
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
722
+ "no-lone-blocks": "error",
723
+ "no-loss-of-precision": "error",
724
+ "no-misleading-character-class": "error",
725
+ "no-prototype-builtins": "error",
726
+ "no-useless-catch": "error",
727
+ "no-mixed-operators": [
728
+ "error",
729
+ {
730
+ groups: [
731
+ ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
732
+ ["&&", "||"],
733
+ ["in", "instanceof"]
734
+ ],
735
+ allowSamePrecedence: true
736
+ }
737
+ ],
738
+ "no-mixed-spaces-and-tabs": "error",
739
+ "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
740
+ "no-new": "error",
741
+ "no-new-func": "error",
742
+ "no-new-object": "error",
743
+ "no-new-symbol": "error",
744
+ "no-new-wrappers": "error",
745
+ "no-obj-calls": "error",
746
+ "no-octal": "error",
747
+ "no-octal-escape": "error",
748
+ "no-proto": "error",
749
+ "no-redeclare": ["error", { builtinGlobals: false }],
750
+ "no-regex-spaces": "error",
751
+ "no-self-assign": ["error", { props: true }],
752
+ "no-self-compare": "error",
753
+ "no-sequences": "error",
754
+ "no-shadow-restricted-names": "error",
755
+ "no-sparse-arrays": "error",
756
+ "no-tabs": "error",
757
+ "no-template-curly-in-string": "error",
758
+ "no-this-before-super": "error",
759
+ "no-throw-literal": "error",
760
+ "no-trailing-spaces": "error",
761
+ "no-undef": "error",
762
+ "no-undef-init": "error",
763
+ "no-unexpected-multiline": "error",
764
+ "no-unmodified-loop-condition": "error",
765
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
766
+ "no-unreachable": "error",
767
+ "no-unreachable-loop": "error",
768
+ "no-unsafe-finally": "error",
769
+ "no-unsafe-negation": "error",
770
+ "no-unused-expressions": [
771
+ "error",
772
+ {
773
+ allowShortCircuit: true,
774
+ allowTernary: true,
775
+ allowTaggedTemplates: true
776
+ }
777
+ ],
778
+ "no-unused-vars": [
779
+ "error",
780
+ {
781
+ args: "none",
782
+ caughtErrors: "none",
783
+ ignoreRestSiblings: true,
784
+ vars: "all"
785
+ }
786
+ ],
787
+ "no-useless-call": "error",
788
+ "no-useless-computed-key": "error",
789
+ "no-useless-constructor": "error",
790
+ "no-useless-rename": "error",
791
+ "no-useless-return": "error",
792
+ "no-whitespace-before-property": "error",
793
+ "object-curly-newline": ["error", { multiline: true, consistent: true }],
794
+ "object-curly-spacing": ["error", "always"],
795
+ "object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
796
+ "padded-blocks": ["error", { blocks: "never", switches: "never", classes: "never" }],
797
+ "prefer-promise-reject-errors": "error",
798
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
799
+ "quote-props": ["error", "as-needed"],
800
+ "rest-spread-spacing": ["error", "never"],
801
+ semi: ["error", "never"],
802
+ "semi-spacing": ["error", { before: false, after: true }],
803
+ "space-before-blocks": ["error", "always"],
804
+ "space-before-function-paren": ["error", "never"],
805
+ "space-in-parens": ["error", "never"],
806
+ "space-infix-ops": "error",
807
+ "space-unary-ops": ["error", { words: true, nonwords: false }],
808
+ "symbol-description": "error",
809
+ "template-tag-spacing": ["error", "never"],
810
+ "unicode-bom": ["error", "never"],
811
+ "use-isnan": [
812
+ "error",
813
+ {
814
+ enforceForSwitchCase: true,
815
+ enforceForIndexOf: true
816
+ }
817
+ ],
818
+ "valid-typeof": ["error", { requireStringLiterals: true }],
819
+ "wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
820
+ "yield-star-spacing": ["error", "both"],
821
+ yoda: ["error", "never"],
822
+ // es6+
823
+ "no-var": "error",
824
+ "prefer-rest-params": "error",
825
+ "prefer-spread": "error",
826
+ "prefer-template": "error",
827
+ "template-curly-spacing": "error",
828
+ "generator-star-spacing": "off",
829
+ "no-empty-static-block": "error",
830
+ "no-new-native-nonconstructor": "error",
831
+ "arrow-parens": [
764
832
  "error",
833
+ "as-needed",
765
834
  {
766
- beforeColon: false,
767
- afterColon: true
835
+ requireForBlockBody: false
768
836
  }
769
837
  ],
770
- "jsonc/no-octal-escape": "error",
771
- "jsonc/object-curly-newline": [
838
+ quotes: [
772
839
  "error",
840
+ "single",
773
841
  {
774
- multiline: true,
775
- consistent: true
842
+ avoidEscape: true,
843
+ allowTemplateLiterals: false
776
844
  }
777
845
  ],
778
- "jsonc/object-curly-spacing": ["error", "always"],
779
- "jsonc/object-property-newline": [
846
+ "prefer-const": [
780
847
  "error",
781
848
  {
782
- allowMultiplePropertiesPerLine: true
849
+ destructuring: "all",
850
+ ignoreReadBeforeAssign: true
783
851
  }
784
- ]
785
- }
786
- }
787
- ];
788
- var pkgOrder = [
789
- {
790
- files: ["**/package.json"],
791
- rules: {
792
- "jsonc/sort-keys": [
852
+ ],
853
+ "prefer-arrow-callback": [
793
854
  "error",
794
855
  {
795
- pathPattern: "^$",
796
- order: [
797
- "publisher",
798
- "name",
799
- "displayName",
800
- "type",
801
- "version",
802
- "private",
803
- "packageManager",
804
- "description",
805
- "keywords",
806
- "license",
807
- "author",
808
- "homepage",
809
- "repository",
810
- "funding",
811
- "exports",
812
- "main",
813
- "module",
814
- "unpkg",
815
- "jsdelivr",
816
- // workaround for `type: "module"` with TS `moduleResolution: "node16"`
817
- "types",
818
- "typesVersions",
819
- "bin",
820
- "icon",
821
- "files",
822
- "sideEffects",
823
- "scripts",
824
- "peerDependencies",
825
- "peerDependenciesMeta",
826
- "dependencies",
827
- "optionalDependencies",
828
- "devDependencies",
829
- "activationEvents",
830
- "contributes",
831
- "categories",
832
- "engines",
833
- "pnpm",
834
- "overrides",
835
- "resolutions",
836
- "husky",
837
- "prettier",
838
- "nano-staged",
839
- "lint-staged",
840
- "eslintConfig"
841
- ]
842
- },
856
+ allowNamedFunctions: false,
857
+ allowUnboundThis: true
858
+ }
859
+ ],
860
+ "object-shorthand": [
861
+ "error",
862
+ "always",
843
863
  {
844
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$",
845
- order: { type: "asc" }
846
- },
864
+ ignoreConstructors: false,
865
+ avoidQuotes: true
866
+ }
867
+ ],
868
+ "spaced-comment": [
869
+ "error",
870
+ "always",
847
871
  {
848
- pathPattern: "^exports.*$",
849
- order: ["types", "import", "require", "default"]
850
- },
872
+ line: {
873
+ markers: ["/"],
874
+ exceptions: ["/", "#"]
875
+ },
876
+ block: {
877
+ markers: ["!"],
878
+ exceptions: ["*"],
879
+ balanced: true
880
+ }
881
+ }
882
+ ],
883
+ // best-practice
884
+ eqeqeq: ["error", "smart"],
885
+ complexity: ["error", { max: 30 }],
886
+ "array-callback-return": "error",
887
+ "block-scoped-var": "error",
888
+ "consistent-return": "off",
889
+ "no-alert": "error",
890
+ "no-case-declarations": "error",
891
+ "no-multi-spaces": "error",
892
+ "no-multi-str": "error",
893
+ "no-with": "error",
894
+ "no-void": "error",
895
+ "no-useless-escape": "off",
896
+ "vars-on-top": "error",
897
+ "require-await": "off",
898
+ "no-return-assign": "off",
899
+ "one-var": ["error", "never"],
900
+ "operator-linebreak": ["error", "before"],
901
+ "comma-dangle": ["error", "always-multiline"],
902
+ "max-params": ["error", { max: 5 }],
903
+ "max-depth": ["error", { max: 5 }],
904
+ "max-nested-callbacks": ["error", { max: 10 }],
905
+ "max-statements-per-line": ["error", { max: 2 }],
906
+ "max-lines": [
907
+ "error",
851
908
  {
852
- pathPattern: "^scripts$",
853
- order: { type: "asc" }
909
+ max: 1e3,
910
+ skipComments: true,
911
+ skipBlankLines: true
854
912
  }
855
913
  ],
856
- "jsonc/sort-array-values": [
914
+ "max-lines-per-function": [
857
915
  "error",
858
916
  {
859
- pathPattern: "^files$",
860
- order: { type: "asc" }
917
+ max: 100,
918
+ skipComments: true,
919
+ skipBlankLines: true
920
+ }
921
+ ],
922
+ "no-use-before-define": [
923
+ "error",
924
+ {
925
+ functions: false,
926
+ classes: false,
927
+ variables: true
928
+ }
929
+ ],
930
+ "max-len": [
931
+ "error",
932
+ {
933
+ code: 200,
934
+ tabWidth: 2,
935
+ comments: 200,
936
+ ignoreUrls: true,
937
+ ignoreStrings: true,
938
+ ignoreRegExpLiterals: true,
939
+ ignoreTemplateLiterals: true,
940
+ ignoreTrailingComments: true
941
+ }
942
+ ],
943
+ "sort-imports": [
944
+ "error",
945
+ {
946
+ ignoreCase: false,
947
+ ignoreDeclarationSort: true,
948
+ ignoreMemberSort: false,
949
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
950
+ allowSeparatedGroups: false
861
951
  }
862
952
  ]
863
953
  }
864
- }
865
- ];
866
-
867
- // src/configs/unocss.ts
868
- import unocssPlugin from "@unocss/eslint-plugin";
869
- var unocss = [
954
+ },
870
955
  {
871
- plugins: {
872
- "@unocss": unocssPlugin
873
- },
956
+ files: ["**/scripts/*", "**/cli.*"],
874
957
  rules: {
875
- ...unocssPlugin.configs.recommended.rules
958
+ "no-console": "off"
876
959
  }
877
- }
878
- ];
879
-
880
- // src/configs/prettier.ts
881
- import prettierPlugin from "eslint-plugin-prettier";
882
- import prettierConfig from "eslint-config-prettier";
883
- var prettier = [
960
+ },
884
961
  {
885
- plugins: {
886
- prettier: prettierPlugin
887
- },
962
+ files: ["**/*.{test,spec}.js?(x)"],
888
963
  rules: {
889
- ...prettierConfig.rules,
890
- ...prettierPlugin.configs.recommended.rules,
891
- "prettier/prettier": "warn"
964
+ "no-unused-expressions": "off",
965
+ "max-lines-per-function": "off"
892
966
  }
893
967
  }
894
968
  ];
895
-
896
- // src/configs/markdown.ts
897
- import markdownPlugin from "eslint-plugin-markdown";
898
- import tsPlugin3 from "@typescript-eslint/eslint-plugin";
899
- var markdown = [
900
- {
901
- files: [GLOB_MARKDOWN],
902
- plugins: {
903
- markdown: markdownPlugin
904
- },
905
- processor: "markdown/markdown"
906
- },
969
+ var jsx = [
907
970
  {
908
- files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
971
+ files: ["**/*.jsx"],
909
972
  languageOptions: {
910
973
  parserOptions: {
911
974
  ecmaFeatures: {
912
- impliedStrict: true
975
+ jsx: true
913
976
  }
914
977
  }
915
- },
916
- plugins: {
917
- "@typescript-eslint": tsPlugin3
918
- },
919
- rules: {
920
- ...markdownPlugin.configs.recommended.overrides[1].rules,
921
- "no-undef": "off",
922
- "no-alert": "off",
923
- "no-console": "off",
924
- "no-unused-vars": "off",
925
- "no-unused-expressions": "off",
926
- "no-restricted-imports": "off",
927
- "import/no-unresolved": "off",
928
- "@typescript-eslint/comma-dangle": "off",
929
- "@typescript-eslint/no-redeclare": "off",
930
- "@typescript-eslint/no-unused-vars": "off",
931
- "@typescript-eslint/no-var-requires": "off",
932
- "@typescript-eslint/no-extraneous-class": "off",
933
- "@typescript-eslint/no-use-before-define": "off",
934
- "unused-imports/no-unused-imports": "off",
935
- "unused-imports/no-unused-vars": "off"
936
978
  }
937
979
  }
938
980
  ];
939
981
 
940
- // src/configs/eslint-comments.ts
941
- import commentsPlugin from "eslint-plugin-eslint-comments";
942
- var eslintComments = [
982
+ // src/configs/ignores.ts
983
+ var ignores = [
943
984
  {
944
- plugins: {
945
- "eslint-comments": commentsPlugin
946
- },
947
- rules: {
948
- ...commentsPlugin.configs.recommended.rules,
949
- "eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
950
- }
985
+ ignores: GLOB_EXCLUDE
951
986
  }
952
987
  ];
953
988
 
954
989
  // src/presets.ts
955
- var GLOBAL_IGNORE = { ignores: GLOB_EXCLUDE };
956
990
  var basic = [
957
- GLOBAL_IGNORE,
958
- ...js,
991
+ ...ignores,
992
+ ...javascript,
959
993
  ...jsx,
960
- ...ts,
961
- ...yml,
994
+ ...typescript,
962
995
  ...imports,
963
996
  ...unicorn,
964
- ...jsonc,
965
- ...pkgOrder,
966
- ...eslintComments
997
+ ...comments
967
998
  ];
968
- var all = [
999
+ var common = [
969
1000
  ...basic,
970
- ...vue,
971
- ...react,
972
- ...astro,
973
- ...unocss,
1001
+ ...yml,
1002
+ ...jsonc,
1003
+ ...jsonOrder,
974
1004
  ...prettier,
975
1005
  ...markdown
976
1006
  ];
1007
+ var all = [...common, ...vue, ...react, ...astro, ...unocss];
977
1008
  function ntnyq(config = [], {
978
1009
  vue: enableVue = false,
979
1010
  react: enableReact = false,
980
1011
  astro: enableAstro = false,
981
- prettier: enablePrettier = false,
982
- markdown: enableMarkdown = false,
983
1012
  unocss: enableUnoCSS = false
984
1013
  } = {}) {
985
- const configs4 = [...basic];
1014
+ const configs = [...common];
986
1015
  if (enableVue) {
987
- configs4.push(...vue);
1016
+ configs.push(...vue);
988
1017
  }
989
1018
  if (enableReact) {
990
- configs4.push(...react);
1019
+ configs.push(...react);
991
1020
  }
992
1021
  if (enableAstro) {
993
- configs4.push(...astro);
1022
+ configs.push(...astro);
994
1023
  }
995
1024
  if (enableUnoCSS) {
996
- configs4.push(...unocss);
997
- }
998
- if (enableMarkdown) {
999
- configs4.push(...markdown);
1000
- }
1001
- if (enablePrettier) {
1002
- configs4.push(...prettier);
1025
+ configs.push(...unocss);
1003
1026
  }
1004
1027
  if (Object.keys(config).length > 0) {
1005
- configs4.push(...Array.isArray(config) ? config : [config]);
1028
+ configs.push(...Array.isArray(config) ? config : [config]);
1006
1029
  }
1007
- return configs4;
1030
+ return configs;
1008
1031
  }
1009
1032
  export {
1010
1033
  GLOB_ALL_SRC,
@@ -1033,26 +1056,40 @@ export {
1033
1056
  all,
1034
1057
  astro,
1035
1058
  basic,
1036
- eslintComments,
1059
+ comments,
1060
+ common,
1037
1061
  getVueVersion,
1062
+ ignores,
1038
1063
  imports,
1039
- js,
1064
+ javascript,
1065
+ jsonOrder,
1040
1066
  jsonc,
1041
1067
  jsx,
1042
1068
  markdown,
1043
1069
  ntnyq,
1044
- pkgOrder,
1070
+ parserAstro,
1071
+ parserJsonc,
1072
+ parserTypescript,
1073
+ parserVue,
1074
+ parserYml,
1075
+ pluginAstro,
1076
+ pluginComments,
1077
+ pluginImport,
1078
+ pluginJsonc,
1079
+ pluginMarkdown,
1080
+ pluginPrettier,
1081
+ pluginReact,
1082
+ pluginReactHooks,
1083
+ pluginTypescript,
1084
+ pluginUnicorn,
1085
+ pluginUnoCSS,
1086
+ pluginVue,
1087
+ pluginYml,
1045
1088
  prettier,
1046
1089
  react,
1047
- reactHooksPlugin,
1048
- reactPlugin,
1049
- ts,
1050
- tsParser,
1051
- tsPlugin,
1090
+ typescript,
1052
1091
  unicorn,
1053
1092
  unocss,
1054
1093
  vue,
1055
- vueParser,
1056
- vuePlugin,
1057
1094
  yml
1058
1095
  };