@so1ve/eslint-config 1.0.0-alpha.6 → 1.0.0-alpha.7

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 CHANGED
@@ -15,6 +15,7 @@ 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');
18
19
  var pluginJsonSchemaValidator = require('eslint-plugin-json-schema-validator');
19
20
  var pluginJsonc = require('eslint-plugin-jsonc');
20
21
  var pluginMdx = require('eslint-plugin-mdx');
@@ -54,6 +55,7 @@ var pluginEtc__default = /*#__PURE__*/_interopDefaultLegacy(pluginEtc);
54
55
  var pluginHtmlJsSupport__default = /*#__PURE__*/_interopDefaultLegacy(pluginHtmlJsSupport);
55
56
  var pluginImport__default = /*#__PURE__*/_interopDefaultLegacy(pluginImport);
56
57
  var pluginJestFormatting__default = /*#__PURE__*/_interopDefaultLegacy(pluginJestFormatting);
58
+ var pluginJsdoc__default = /*#__PURE__*/_interopDefaultLegacy(pluginJsdoc);
57
59
  var pluginJsonSchemaValidator__default = /*#__PURE__*/_interopDefaultLegacy(pluginJsonSchemaValidator);
58
60
  var pluginJsonc__default = /*#__PURE__*/_interopDefaultLegacy(pluginJsonc);
59
61
  var pluginMdx__default = /*#__PURE__*/_interopDefaultLegacy(pluginMdx);
@@ -95,7 +97,7 @@ const comments = () => [
95
97
  ];
96
98
 
97
99
  const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
98
- const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
100
+ const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
99
101
  const GLOB_JS = "**/*.?([cm])js";
100
102
  const GLOB_JSX = "**/*.?([cm])jsx";
101
103
  const GLOB_TS = "**/*.?([cm])ts";
@@ -109,20 +111,17 @@ const GLOB_JSON = "**/*.json";
109
111
  const GLOB_JSON5 = "**/*.json5";
110
112
  const GLOB_JSONC = "**/*.jsonc";
111
113
  const GLOB_ESLINTRC = "**/.eslintrc";
112
- const GLOB_MARKDOWN = "**/*.md?(x)";
114
+ const GLOB_MARKDOWN = "**/*.{md,mdx}";
113
115
  const GLOB_VUE = "**/*.vue";
114
116
  const GLOB_YAML = "**/*.y?(a)ml";
115
117
  const GLOB_TOML = "**/*.toml";
116
118
  const GLOB_HTML = "**/*.htm?(l)";
117
119
  const GLOB_PACKAGEJSON = "**/package.json";
118
- const GLOB_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
119
120
  const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
120
121
  const GLOB_TESTS = [
121
122
  `**/__tests__/**/*.${GLOB_SRC_EXT}`,
122
123
  `**/*.spec.${GLOB_SRC_EXT}`,
123
- `**/*.test.${GLOB_SRC_EXT}`,
124
- `**/*.bench.${GLOB_SRC_EXT}`,
125
- `**/*.benchmark.${GLOB_SRC_EXT}`
124
+ `**/*.test.${GLOB_SRC_EXT}`
126
125
  ];
127
126
  const GLOB_ALL_SRC = [
128
127
  GLOB_SRC,
@@ -143,7 +142,6 @@ const GLOB_EXCLUDE = [
143
142
  "**/package-lock.json",
144
143
  "**/yarn.lock",
145
144
  "**/pnpm-lock.yaml",
146
- "**/bun.lockb",
147
145
  "**/coverage",
148
146
  "**/temp",
149
147
  "**/.vitepress/cache",
@@ -170,170 +168,6 @@ const GLOB_EXCLUDE = [
170
168
  "**/*.vue.tsx"
171
169
  ];
172
170
 
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
-
337
171
  const html = () => [
338
172
  {
339
173
  plugins: {
@@ -371,21 +205,14 @@ const imports = (options = {}) => [
371
205
  }
372
206
  },
373
207
  {
374
- settings: {
375
- "import/parsers": {
376
- espree: [".js", ".cjs", ".mjs", ".jsx"]
377
- },
208
+ settings: options.typescript ? {
378
209
  "import/resolver": {
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
- }
210
+ node: { extensions: [".js", ".mjs"] }
211
+ }
212
+ } : {
213
+ node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] },
214
+ typescript: {
215
+ extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
389
216
  }
390
217
  },
391
218
  rules: {
@@ -655,6 +482,11 @@ const javascript = ({
655
482
  ignoreConstructors: false
656
483
  }
657
484
  ],
485
+ "quote-props": ["error", "consistent-as-needed"],
486
+ "padding-line-between-statements": [
487
+ "error",
488
+ { blankLine: "always", prev: "*", next: "return" }
489
+ ],
658
490
  "prefer-exponentiation-operator": "error",
659
491
  "prefer-rest-params": "error",
660
492
  "prefer-spread": "error",
@@ -721,6 +553,11 @@ const javascript = ({
721
553
  "valid-typeof": ["error", { requireStringLiterals: true }],
722
554
  // so1ve
723
555
  "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",
724
561
  "so1ve/use-async-with-await": "error",
725
562
  // Sort Imports
726
563
  "sort-imports/imports": ["error"],
@@ -742,6 +579,34 @@ const javascript = ({
742
579
  }
743
580
  ];
744
581
 
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
+
745
610
  const jsonc = () => [
746
611
  {
747
612
  plugins: {
@@ -760,6 +625,22 @@ const jsonc = () => [
760
625
  "jsonc/quotes": "off",
761
626
  "jsonc/quotes-props": "off"
762
627
  }
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
+ }
763
644
  }
764
645
  ];
765
646
 
@@ -914,6 +795,7 @@ const test = ({
914
795
  "vitest/prefer-to-have-length": "error",
915
796
  "vitest/prefer-todo": "error",
916
797
  "vitest/valid-title": ["error", { allowArguments: true }],
798
+ "jest-formatting/padding-around-all": "error",
917
799
  ...overrides
918
800
  }
919
801
  }
@@ -1216,24 +1098,25 @@ const unicorn = () => [
1216
1098
  unicorn: pluginUnicorn__default["default"]
1217
1099
  },
1218
1100
  rules: {
1219
- "unicorn/throw-new-error": "error",
1220
- "unicorn/relative-url-style": ["error", "always"],
1221
- "unicorn/switch-case-braces": "error",
1222
- "unicorn/number-literal-case": "error",
1223
- "unicorn/numeric-separators-style": "error",
1224
- "unicorn/new-for-builtins": "error",
1225
1101
  "unicorn/error-message": "error",
1226
1102
  "unicorn/escape-case": "error",
1227
- "unicorn/explicit-length-check": "error",
1228
1103
  "unicorn/no-instanceof-array": "error",
1229
1104
  "unicorn/no-new-buffer": "error",
1230
1105
  "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",
1231
1114
  "unicorn/no-array-for-each": "error",
1232
1115
  "unicorn/no-array-method-this-argument": "error",
1233
1116
  "unicorn/no-for-loop": "error",
1234
1117
  "unicorn/no-lonely-if": "error",
1235
1118
  "unicorn/no-negated-condition": "error",
1236
- "unicorn/no-useless-spread": "error",
1119
+ "unicorn/switch-case-braces": "error",
1237
1120
  "unicorn/prefer-ternary": "error",
1238
1121
  "unicorn/prefer-query-selector": "error",
1239
1122
  "unicorn/prefer-modern-dom-apis": "error",
@@ -1252,11 +1135,8 @@ const unicorn = () => [
1252
1135
  "unicorn/prefer-text-content": "error",
1253
1136
  "unicorn/prefer-type-error": "error",
1254
1137
  "unicorn/prefer-node-protocol": "error",
1255
- "unicorn/prefer-negative-index": "error",
1256
1138
  "unicorn/prefer-regexp-test": "error",
1257
- "unicorn/prefer-optional-catch-binding": "error",
1258
- "unicorn/prefer-object-from-entries": "error",
1259
- "unicorn/prefer-prototype-methods": "error"
1139
+ "unicorn/prefer-optional-catch-binding": "error"
1260
1140
  }
1261
1141
  }
1262
1142
  ];
@@ -1301,7 +1181,7 @@ const vue = ({
1301
1181
  "vue/block-order": [
1302
1182
  "error",
1303
1183
  {
1304
- order: ["script:not([setup])", "script[setup]", "template", "style"]
1184
+ order: ["script", "template", "style"]
1305
1185
  }
1306
1186
  ],
1307
1187
  "vue/component-api-style": ["error", ["script-setup", "composition"]],
@@ -1489,14 +1369,13 @@ const flatConfigProps = [
1489
1369
  ];
1490
1370
  const VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
1491
1371
  function so1ve(options = {}, ...userConfigs) {
1492
- var _a, _b, _c, _d, _e, _f;
1372
+ var _a, _b, _c, _d, _e;
1493
1373
  const {
1494
1374
  vue: enableVue = VuePackages.some((i) => localPkg.isPackageExists(i)),
1495
1375
  solid: enableSolid = localPkg.isPackageExists("solid-js"),
1496
1376
  typescript: enableTypeScript = localPkg.isPackageExists("typescript"),
1497
1377
  gitignore: enableGitignore = true,
1498
- overrides = {},
1499
- componentExts = []
1378
+ overrides = {}
1500
1379
  } = options;
1501
1380
  const configs = [];
1502
1381
  if (enableGitignore) {
@@ -1517,10 +1396,13 @@ function so1ve(options = {}, ...userConfigs) {
1517
1396
  node(),
1518
1397
  onlyError(),
1519
1398
  promise(),
1399
+ // jsdoc(),
1520
1400
  sortImports(),
1521
1401
  imports(),
1402
+ jsdoc(),
1522
1403
  unicorn()
1523
1404
  );
1405
+ const componentExts = [];
1524
1406
  if (enableVue) {
1525
1407
  componentExts.push("vue");
1526
1408
  }
@@ -1580,9 +1462,6 @@ function so1ve(options = {}, ...userConfigs) {
1580
1462
  })
1581
1463
  );
1582
1464
  }
1583
- if ((_f = options.formatting) != null ? _f : true) {
1584
- configs.push(formatting(options));
1585
- }
1586
1465
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
1587
1466
  if (key in options) {
1588
1467
  acc[key] = options[key];
@@ -1648,6 +1527,10 @@ Object.defineProperty(exports, 'pluginJestFormatting', {
1648
1527
  enumerable: true,
1649
1528
  get: function () { return pluginJestFormatting__default["default"]; }
1650
1529
  });
1530
+ Object.defineProperty(exports, 'pluginJsdoc', {
1531
+ enumerable: true,
1532
+ get: function () { return pluginJsdoc__default["default"]; }
1533
+ });
1651
1534
  Object.defineProperty(exports, 'pluginJsonSchemaValidator', {
1652
1535
  enumerable: true,
1653
1536
  get: function () { return pluginJsonSchemaValidator__default["default"]; }
@@ -1746,17 +1629,16 @@ exports.GLOB_STYLE = GLOB_STYLE;
1746
1629
  exports.GLOB_TESTS = GLOB_TESTS;
1747
1630
  exports.GLOB_TOML = GLOB_TOML;
1748
1631
  exports.GLOB_TS = GLOB_TS;
1749
- exports.GLOB_TSCONFIG = GLOB_TSCONFIG;
1750
1632
  exports.GLOB_TSX = GLOB_TSX;
1751
1633
  exports.GLOB_VUE = GLOB_VUE;
1752
1634
  exports.GLOB_YAML = GLOB_YAML;
1753
1635
  exports.combine = combine;
1754
1636
  exports.comments = comments;
1755
- exports.formatting = formatting;
1756
1637
  exports.html = html;
1757
1638
  exports.ignores = ignores;
1758
1639
  exports.imports = imports;
1759
1640
  exports.javascript = javascript;
1641
+ exports.jsdoc = jsdoc;
1760
1642
  exports.jsonc = jsonc;
1761
1643
  exports.mdx = mdx;
1762
1644
  exports.node = node;
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ 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';
17
18
  export { default as pluginJsonSchemaValidator } from 'eslint-plugin-json-schema-validator';
18
19
  export { default as pluginJsonc } from 'eslint-plugin-jsonc';
19
20
  export { default as pluginMdx } from 'eslint-plugin-mdx';
@@ -36,6 +37,10 @@ export { default as parserYaml } from 'yaml-eslint-parser';
36
37
 
37
38
  declare const comments: () => FlatESLintConfigItem[];
38
39
 
40
+ declare const html: () => FlatESLintConfigItem[];
41
+
42
+ declare const ignores: () => FlatESLintConfigItem[];
43
+
39
44
  interface OptionsComponentExts {
40
45
  /**
41
46
  * Additional extensions for components.
@@ -54,7 +59,7 @@ interface OptionsHasTypeScript {
54
59
  interface OptionsOverrides {
55
60
  overrides?: FlatESLintConfigItem["rules"];
56
61
  }
57
- interface Options extends OptionsComponentExts {
62
+ interface Options {
58
63
  /**
59
64
  * Enable gitignore support.
60
65
  *
@@ -114,12 +119,6 @@ interface Options extends OptionsComponentExts {
114
119
  * @default true
115
120
  */
116
121
  mdx?: boolean;
117
- /**
118
- * Enable formatting rules.
119
- *
120
- * @default true
121
- */
122
- formatting?: boolean;
123
122
  /**
124
123
  * Provide overrides for rules for each integration.
125
124
  */
@@ -136,16 +135,12 @@ interface Options extends OptionsComponentExts {
136
135
  };
137
136
  }
138
137
 
139
- declare const formatting: (options: Options) => FlatESLintConfigItem[];
140
-
141
- declare const html: () => FlatESLintConfigItem[];
142
-
143
- declare const ignores: () => FlatESLintConfigItem[];
144
-
145
138
  declare const imports: (options?: Options) => FlatESLintConfigItem[];
146
139
 
147
140
  declare const javascript: ({ overrides, }?: OptionsOverrides) => FlatESLintConfigItem[];
148
141
 
142
+ declare const jsdoc: () => FlatESLintConfigItem[];
143
+
149
144
  declare const jsonc: () => FlatESLintConfigItem[];
150
145
 
151
146
  declare const mdx: ({ componentExts, overrides, }?: OptionsComponentExts & OptionsOverrides) => FlatESLintConfigItem[];
@@ -192,14 +187,13 @@ declare const GLOB_JSON = "**/*.json";
192
187
  declare const GLOB_JSON5 = "**/*.json5";
193
188
  declare const GLOB_JSONC = "**/*.jsonc";
194
189
  declare const GLOB_ESLINTRC = "**/.eslintrc";
195
- declare const GLOB_MARKDOWN = "**/*.md?(x)";
190
+ declare const GLOB_MARKDOWN = "**/*.{md,mdx}";
196
191
  declare const GLOB_VUE = "**/*.vue";
197
192
  declare const GLOB_YAML = "**/*.y?(a)ml";
198
193
  declare const GLOB_TOML = "**/*.toml";
199
194
  declare const GLOB_HTML = "**/*.htm?(l)";
200
195
  declare const GLOB_PACKAGEJSON = "**/package.json";
201
- declare const GLOB_TSCONFIG: string[];
202
- declare const GLOB_MARKDOWN_CODE = "**/*.md?(x)/**/*.?([cm])[jt]s?(x)";
196
+ declare const GLOB_MARKDOWN_CODE = "**/*.{md,mdx}/**/*.?([cm])[jt]s?(x)";
203
197
  declare const GLOB_TESTS: string[];
204
198
  declare const GLOB_ALL_SRC: string[];
205
199
  declare const GLOB_EXCLUDE: string[];
@@ -215,4 +209,4 @@ declare function recordRulesStateConfigs(configs: FlatESLintConfigItem[]): FlatE
215
209
  declare function recordRulesState(rules: FlatESLintConfigItem["rules"]): FlatESLintConfigItem["rules"];
216
210
  declare function warnUnnecessaryOffRules(): void;
217
211
 
218
- 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 };
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, jsdoc, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
package/dist/index.mjs CHANGED
@@ -23,6 +23,8 @@ 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';
26
28
  import pluginJsonSchemaValidator from 'eslint-plugin-json-schema-validator';
27
29
  export { default as pluginJsonSchemaValidator } from 'eslint-plugin-json-schema-validator';
28
30
  import pluginJsonc from 'eslint-plugin-jsonc';
@@ -84,7 +86,7 @@ const comments = () => [
84
86
  ];
85
87
 
86
88
  const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
87
- const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
89
+ const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
88
90
  const GLOB_JS = "**/*.?([cm])js";
89
91
  const GLOB_JSX = "**/*.?([cm])jsx";
90
92
  const GLOB_TS = "**/*.?([cm])ts";
@@ -98,20 +100,17 @@ const GLOB_JSON = "**/*.json";
98
100
  const GLOB_JSON5 = "**/*.json5";
99
101
  const GLOB_JSONC = "**/*.jsonc";
100
102
  const GLOB_ESLINTRC = "**/.eslintrc";
101
- const GLOB_MARKDOWN = "**/*.md?(x)";
103
+ const GLOB_MARKDOWN = "**/*.{md,mdx}";
102
104
  const GLOB_VUE = "**/*.vue";
103
105
  const GLOB_YAML = "**/*.y?(a)ml";
104
106
  const GLOB_TOML = "**/*.toml";
105
107
  const GLOB_HTML = "**/*.htm?(l)";
106
108
  const GLOB_PACKAGEJSON = "**/package.json";
107
- const GLOB_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
108
109
  const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
109
110
  const GLOB_TESTS = [
110
111
  `**/__tests__/**/*.${GLOB_SRC_EXT}`,
111
112
  `**/*.spec.${GLOB_SRC_EXT}`,
112
- `**/*.test.${GLOB_SRC_EXT}`,
113
- `**/*.bench.${GLOB_SRC_EXT}`,
114
- `**/*.benchmark.${GLOB_SRC_EXT}`
113
+ `**/*.test.${GLOB_SRC_EXT}`
115
114
  ];
116
115
  const GLOB_ALL_SRC = [
117
116
  GLOB_SRC,
@@ -132,7 +131,6 @@ const GLOB_EXCLUDE = [
132
131
  "**/package-lock.json",
133
132
  "**/yarn.lock",
134
133
  "**/pnpm-lock.yaml",
135
- "**/bun.lockb",
136
134
  "**/coverage",
137
135
  "**/temp",
138
136
  "**/.vitepress/cache",
@@ -159,170 +157,6 @@ const GLOB_EXCLUDE = [
159
157
  "**/*.vue.tsx"
160
158
  ];
161
159
 
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
-
326
160
  const html = () => [
327
161
  {
328
162
  plugins: {
@@ -360,21 +194,14 @@ const imports = (options = {}) => [
360
194
  }
361
195
  },
362
196
  {
363
- settings: {
364
- "import/parsers": {
365
- espree: [".js", ".cjs", ".mjs", ".jsx"]
366
- },
197
+ settings: options.typescript ? {
367
198
  "import/resolver": {
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
- }
199
+ node: { extensions: [".js", ".mjs"] }
200
+ }
201
+ } : {
202
+ node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] },
203
+ typescript: {
204
+ extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
378
205
  }
379
206
  },
380
207
  rules: {
@@ -644,6 +471,11 @@ const javascript = ({
644
471
  ignoreConstructors: false
645
472
  }
646
473
  ],
474
+ "quote-props": ["error", "consistent-as-needed"],
475
+ "padding-line-between-statements": [
476
+ "error",
477
+ { blankLine: "always", prev: "*", next: "return" }
478
+ ],
647
479
  "prefer-exponentiation-operator": "error",
648
480
  "prefer-rest-params": "error",
649
481
  "prefer-spread": "error",
@@ -710,6 +542,11 @@ const javascript = ({
710
542
  "valid-typeof": ["error", { requireStringLiterals: true }],
711
543
  // so1ve
712
544
  "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",
713
550
  "so1ve/use-async-with-await": "error",
714
551
  // Sort Imports
715
552
  "sort-imports/imports": ["error"],
@@ -731,6 +568,34 @@ const javascript = ({
731
568
  }
732
569
  ];
733
570
 
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
+
734
599
  const jsonc = () => [
735
600
  {
736
601
  plugins: {
@@ -749,6 +614,22 @@ const jsonc = () => [
749
614
  "jsonc/quotes": "off",
750
615
  "jsonc/quotes-props": "off"
751
616
  }
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
+ }
752
633
  }
753
634
  ];
754
635
 
@@ -903,6 +784,7 @@ const test = ({
903
784
  "vitest/prefer-to-have-length": "error",
904
785
  "vitest/prefer-todo": "error",
905
786
  "vitest/valid-title": ["error", { allowArguments: true }],
787
+ "jest-formatting/padding-around-all": "error",
906
788
  ...overrides
907
789
  }
908
790
  }
@@ -1205,24 +1087,25 @@ const unicorn = () => [
1205
1087
  unicorn: pluginUnicorn
1206
1088
  },
1207
1089
  rules: {
1208
- "unicorn/throw-new-error": "error",
1209
- "unicorn/relative-url-style": ["error", "always"],
1210
- "unicorn/switch-case-braces": "error",
1211
- "unicorn/number-literal-case": "error",
1212
- "unicorn/numeric-separators-style": "error",
1213
- "unicorn/new-for-builtins": "error",
1214
1090
  "unicorn/error-message": "error",
1215
1091
  "unicorn/escape-case": "error",
1216
- "unicorn/explicit-length-check": "error",
1217
1092
  "unicorn/no-instanceof-array": "error",
1218
1093
  "unicorn/no-new-buffer": "error",
1219
1094
  "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",
1220
1103
  "unicorn/no-array-for-each": "error",
1221
1104
  "unicorn/no-array-method-this-argument": "error",
1222
1105
  "unicorn/no-for-loop": "error",
1223
1106
  "unicorn/no-lonely-if": "error",
1224
1107
  "unicorn/no-negated-condition": "error",
1225
- "unicorn/no-useless-spread": "error",
1108
+ "unicorn/switch-case-braces": "error",
1226
1109
  "unicorn/prefer-ternary": "error",
1227
1110
  "unicorn/prefer-query-selector": "error",
1228
1111
  "unicorn/prefer-modern-dom-apis": "error",
@@ -1241,11 +1124,8 @@ const unicorn = () => [
1241
1124
  "unicorn/prefer-text-content": "error",
1242
1125
  "unicorn/prefer-type-error": "error",
1243
1126
  "unicorn/prefer-node-protocol": "error",
1244
- "unicorn/prefer-negative-index": "error",
1245
1127
  "unicorn/prefer-regexp-test": "error",
1246
- "unicorn/prefer-optional-catch-binding": "error",
1247
- "unicorn/prefer-object-from-entries": "error",
1248
- "unicorn/prefer-prototype-methods": "error"
1128
+ "unicorn/prefer-optional-catch-binding": "error"
1249
1129
  }
1250
1130
  }
1251
1131
  ];
@@ -1290,7 +1170,7 @@ const vue = ({
1290
1170
  "vue/block-order": [
1291
1171
  "error",
1292
1172
  {
1293
- order: ["script:not([setup])", "script[setup]", "template", "style"]
1173
+ order: ["script", "template", "style"]
1294
1174
  }
1295
1175
  ],
1296
1176
  "vue/component-api-style": ["error", ["script-setup", "composition"]],
@@ -1478,14 +1358,13 @@ const flatConfigProps = [
1478
1358
  ];
1479
1359
  const VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
1480
1360
  function so1ve(options = {}, ...userConfigs) {
1481
- var _a, _b, _c, _d, _e, _f;
1361
+ var _a, _b, _c, _d, _e;
1482
1362
  const {
1483
1363
  vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
1484
1364
  solid: enableSolid = isPackageExists("solid-js"),
1485
1365
  typescript: enableTypeScript = isPackageExists("typescript"),
1486
1366
  gitignore: enableGitignore = true,
1487
- overrides = {},
1488
- componentExts = []
1367
+ overrides = {}
1489
1368
  } = options;
1490
1369
  const configs = [];
1491
1370
  if (enableGitignore) {
@@ -1506,10 +1385,13 @@ function so1ve(options = {}, ...userConfigs) {
1506
1385
  node(),
1507
1386
  onlyError(),
1508
1387
  promise(),
1388
+ // jsdoc(),
1509
1389
  sortImports(),
1510
1390
  imports(),
1391
+ jsdoc(),
1511
1392
  unicorn()
1512
1393
  );
1394
+ const componentExts = [];
1513
1395
  if (enableVue) {
1514
1396
  componentExts.push("vue");
1515
1397
  }
@@ -1569,9 +1451,6 @@ function so1ve(options = {}, ...userConfigs) {
1569
1451
  })
1570
1452
  );
1571
1453
  }
1572
- if ((_f = options.formatting) != null ? _f : true) {
1573
- configs.push(formatting(options));
1574
- }
1575
1454
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
1576
1455
  if (key in options) {
1577
1456
  acc[key] = options[key];
@@ -1585,4 +1464,4 @@ function so1ve(options = {}, ...userConfigs) {
1585
1464
  return merged;
1586
1465
  }
1587
1466
 
1588
- 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 };
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, jsdoc, 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.6",
3
+ "version": "1.0.0-alpha.7",
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.6",
74
- "@so1ve/eslint-plugin-sort-imports": "1.0.0-alpha.6"
73
+ "@so1ve/eslint-plugin": "1.0.0-alpha.7",
74
+ "@so1ve/eslint-plugin-sort-imports": "1.0.0-alpha.7"
75
75
  },
76
76
  "devDependencies": {
77
77
  "eslint": "^8.46.0"