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

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,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 = "**/*.?([cm])[jt]s?(x)";
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 = "**/*.{md,mdx}";
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: options.typescript ? {
374
+ settings: {
375
+ "import/parsers": {
376
+ espree: [".js", ".cjs", ".mjs", ".jsx"]
377
+ },
209
378
  "import/resolver": {
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"]
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,32 +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-name": "error",
601
- "jsdoc/require-returns-check": "error",
602
- "jsdoc/require-yields-check": "error",
603
- "jsdoc/valid-types": "error"
604
- }
605
- }
606
- ];
607
-
608
745
  const jsonc = () => [
609
746
  {
610
747
  plugins: {
@@ -623,22 +760,6 @@ const jsonc = () => [
623
760
  "jsonc/quotes": "off",
624
761
  "jsonc/quotes-props": "off"
625
762
  }
626
- },
627
- {
628
- files: [GLOB_PACKAGEJSON],
629
- rules: {
630
- "jsonc/sort-keys": [
631
- "error",
632
- {
633
- pathPattern: "^exports$",
634
- order: { type: "asc" }
635
- },
636
- {
637
- pathPattern: "^exports.*$",
638
- order: ["types", "require", "import", "default"]
639
- }
640
- ]
641
- }
642
763
  }
643
764
  ];
644
765
 
@@ -793,7 +914,6 @@ const test = ({
793
914
  "vitest/prefer-to-have-length": "error",
794
915
  "vitest/prefer-todo": "error",
795
916
  "vitest/valid-title": ["error", { allowArguments: true }],
796
- "jest-formatting/padding-around-all": "error",
797
917
  ...overrides
798
918
  }
799
919
  }
@@ -1096,25 +1216,24 @@ const unicorn = () => [
1096
1216
  unicorn: pluginUnicorn__default["default"]
1097
1217
  },
1098
1218
  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",
1099
1225
  "unicorn/error-message": "error",
1100
1226
  "unicorn/escape-case": "error",
1227
+ "unicorn/explicit-length-check": "error",
1101
1228
  "unicorn/no-instanceof-array": "error",
1102
1229
  "unicorn/no-new-buffer": "error",
1103
1230
  "unicorn/no-new-array": "error",
1104
- "unicorn/no-unsafe-regex": "off",
1105
- "unicorn/number-literal-case": "error",
1106
- "unicorn/numeric-separators-style": "error",
1107
- "unicorn/throw-new-error": "error",
1108
- "unicorn/no-useless-spread": "error",
1109
- "unicorn/relative-url-style": ["error", "always"],
1110
- "unicorn/explicit-length-check": "error",
1111
- "unicorn/new-for-builtins": "error",
1112
1231
  "unicorn/no-array-for-each": "error",
1113
1232
  "unicorn/no-array-method-this-argument": "error",
1114
1233
  "unicorn/no-for-loop": "error",
1115
1234
  "unicorn/no-lonely-if": "error",
1116
1235
  "unicorn/no-negated-condition": "error",
1117
- "unicorn/switch-case-braces": "error",
1236
+ "unicorn/no-useless-spread": "error",
1118
1237
  "unicorn/prefer-ternary": "error",
1119
1238
  "unicorn/prefer-query-selector": "error",
1120
1239
  "unicorn/prefer-modern-dom-apis": "error",
@@ -1133,8 +1252,11 @@ const unicorn = () => [
1133
1252
  "unicorn/prefer-text-content": "error",
1134
1253
  "unicorn/prefer-type-error": "error",
1135
1254
  "unicorn/prefer-node-protocol": "error",
1255
+ "unicorn/prefer-negative-index": "error",
1136
1256
  "unicorn/prefer-regexp-test": "error",
1137
- "unicorn/prefer-optional-catch-binding": "error"
1257
+ "unicorn/prefer-optional-catch-binding": "error",
1258
+ "unicorn/prefer-object-from-entries": "error",
1259
+ "unicorn/prefer-prototype-methods": "error"
1138
1260
  }
1139
1261
  }
1140
1262
  ];
@@ -1179,7 +1301,7 @@ const vue = ({
1179
1301
  "vue/block-order": [
1180
1302
  "error",
1181
1303
  {
1182
- order: ["script", "template", "style"]
1304
+ order: ["script:not([setup])", "script[setup]", "template", "style"]
1183
1305
  }
1184
1306
  ],
1185
1307
  "vue/component-api-style": ["error", ["script-setup", "composition"]],
@@ -1367,7 +1489,7 @@ const flatConfigProps = [
1367
1489
  ];
1368
1490
  const VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
1369
1491
  function so1ve(options = {}, ...userConfigs) {
1370
- var _a, _b, _c, _d, _e;
1492
+ var _a, _b, _c, _d, _e, _f;
1371
1493
  const {
1372
1494
  vue: enableVue = VuePackages.some((i) => localPkg.isPackageExists(i)),
1373
1495
  solid: enableSolid = localPkg.isPackageExists("solid-js"),
@@ -1397,7 +1519,6 @@ function so1ve(options = {}, ...userConfigs) {
1397
1519
  promise(),
1398
1520
  sortImports(),
1399
1521
  imports(),
1400
- jsdoc(),
1401
1522
  unicorn()
1402
1523
  );
1403
1524
  if (enableVue) {
@@ -1459,6 +1580,9 @@ function so1ve(options = {}, ...userConfigs) {
1459
1580
  })
1460
1581
  );
1461
1582
  }
1583
+ if ((_f = options.formatting) != null ? _f : true) {
1584
+ configs.push(formatting(options));
1585
+ }
1462
1586
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
1463
1587
  if (key in options) {
1464
1588
  acc[key] = options[key];
@@ -1524,10 +1648,6 @@ Object.defineProperty(exports, 'pluginJestFormatting', {
1524
1648
  enumerable: true,
1525
1649
  get: function () { return pluginJestFormatting__default["default"]; }
1526
1650
  });
1527
- Object.defineProperty(exports, 'pluginJsdoc', {
1528
- enumerable: true,
1529
- get: function () { return pluginJsdoc__default["default"]; }
1530
- });
1531
1651
  Object.defineProperty(exports, 'pluginJsonSchemaValidator', {
1532
1652
  enumerable: true,
1533
1653
  get: function () { return pluginJsonSchemaValidator__default["default"]; }
@@ -1626,16 +1746,17 @@ exports.GLOB_STYLE = GLOB_STYLE;
1626
1746
  exports.GLOB_TESTS = GLOB_TESTS;
1627
1747
  exports.GLOB_TOML = GLOB_TOML;
1628
1748
  exports.GLOB_TS = GLOB_TS;
1749
+ exports.GLOB_TSCONFIG = GLOB_TSCONFIG;
1629
1750
  exports.GLOB_TSX = GLOB_TSX;
1630
1751
  exports.GLOB_VUE = GLOB_VUE;
1631
1752
  exports.GLOB_YAML = GLOB_YAML;
1632
1753
  exports.combine = combine;
1633
1754
  exports.comments = comments;
1755
+ exports.formatting = formatting;
1634
1756
  exports.html = html;
1635
1757
  exports.ignores = ignores;
1636
1758
  exports.imports = imports;
1637
1759
  exports.javascript = javascript;
1638
- exports.jsdoc = jsdoc;
1639
1760
  exports.jsonc = jsonc;
1640
1761
  exports.mdx = mdx;
1641
1762
  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,10 +36,6 @@ 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
40
  /**
46
41
  * Additional extensions for components.
@@ -119,6 +114,12 @@ interface Options extends OptionsComponentExts {
119
114
  * @default true
120
115
  */
121
116
  mdx?: boolean;
117
+ /**
118
+ * Enable formatting rules.
119
+ *
120
+ * @default true
121
+ */
122
+ formatting?: boolean;
122
123
  /**
123
124
  * Provide overrides for rules for each integration.
124
125
  */
@@ -135,12 +136,16 @@ interface Options extends OptionsComponentExts {
135
136
  };
136
137
  }
137
138
 
139
+ declare const formatting: (options: Options) => FlatESLintConfigItem[];
140
+
141
+ declare const html: () => FlatESLintConfigItem[];
142
+
143
+ declare const ignores: () => FlatESLintConfigItem[];
144
+
138
145
  declare const imports: (options?: Options) => FlatESLintConfigItem[];
139
146
 
140
147
  declare const javascript: ({ overrides, }?: OptionsOverrides) => FlatESLintConfigItem[];
141
148
 
142
- declare const jsdoc: () => FlatESLintConfigItem[];
143
-
144
149
  declare const jsonc: () => FlatESLintConfigItem[];
145
150
 
146
151
  declare const mdx: ({ componentExts, overrides, }?: OptionsComponentExts & OptionsOverrides) => FlatESLintConfigItem[];
@@ -187,13 +192,14 @@ declare const GLOB_JSON = "**/*.json";
187
192
  declare const GLOB_JSON5 = "**/*.json5";
188
193
  declare const GLOB_JSONC = "**/*.jsonc";
189
194
  declare const GLOB_ESLINTRC = "**/.eslintrc";
190
- declare const GLOB_MARKDOWN = "**/*.{md,mdx}";
195
+ declare const GLOB_MARKDOWN = "**/*.md?(x)";
191
196
  declare const GLOB_VUE = "**/*.vue";
192
197
  declare const GLOB_YAML = "**/*.y?(a)ml";
193
198
  declare const GLOB_TOML = "**/*.toml";
194
199
  declare const GLOB_HTML = "**/*.htm?(l)";
195
200
  declare const GLOB_PACKAGEJSON = "**/package.json";
196
- declare const GLOB_MARKDOWN_CODE = "**/*.{md,mdx}/**/*.?([cm])[jt]s?(x)";
201
+ declare const GLOB_TSCONFIG: string[];
202
+ declare const GLOB_MARKDOWN_CODE = "**/*.md?(x)/**/*.?([cm])[jt]s?(x)";
197
203
  declare const GLOB_TESTS: string[];
198
204
  declare const GLOB_ALL_SRC: string[];
199
205
  declare const GLOB_EXCLUDE: string[];
@@ -209,4 +215,4 @@ declare function recordRulesStateConfigs(configs: FlatESLintConfigItem[]): FlatE
209
215
  declare function recordRulesState(rules: FlatESLintConfigItem["rules"]): FlatESLintConfigItem["rules"];
210
216
  declare function warnUnnecessaryOffRules(): void;
211
217
 
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 };
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 };
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 = "**/*.?([cm])[jt]s?(x)";
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 = "**/*.{md,mdx}";
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: options.typescript ? {
363
+ settings: {
364
+ "import/parsers": {
365
+ espree: [".js", ".cjs", ".mjs", ".jsx"]
366
+ },
198
367
  "import/resolver": {
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"]
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,32 +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-name": "error",
590
- "jsdoc/require-returns-check": "error",
591
- "jsdoc/require-yields-check": "error",
592
- "jsdoc/valid-types": "error"
593
- }
594
- }
595
- ];
596
-
597
734
  const jsonc = () => [
598
735
  {
599
736
  plugins: {
@@ -612,22 +749,6 @@ const jsonc = () => [
612
749
  "jsonc/quotes": "off",
613
750
  "jsonc/quotes-props": "off"
614
751
  }
615
- },
616
- {
617
- files: [GLOB_PACKAGEJSON],
618
- rules: {
619
- "jsonc/sort-keys": [
620
- "error",
621
- {
622
- pathPattern: "^exports$",
623
- order: { type: "asc" }
624
- },
625
- {
626
- pathPattern: "^exports.*$",
627
- order: ["types", "require", "import", "default"]
628
- }
629
- ]
630
- }
631
752
  }
632
753
  ];
633
754
 
@@ -782,7 +903,6 @@ const test = ({
782
903
  "vitest/prefer-to-have-length": "error",
783
904
  "vitest/prefer-todo": "error",
784
905
  "vitest/valid-title": ["error", { allowArguments: true }],
785
- "jest-formatting/padding-around-all": "error",
786
906
  ...overrides
787
907
  }
788
908
  }
@@ -1085,25 +1205,24 @@ const unicorn = () => [
1085
1205
  unicorn: pluginUnicorn
1086
1206
  },
1087
1207
  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",
1088
1214
  "unicorn/error-message": "error",
1089
1215
  "unicorn/escape-case": "error",
1216
+ "unicorn/explicit-length-check": "error",
1090
1217
  "unicorn/no-instanceof-array": "error",
1091
1218
  "unicorn/no-new-buffer": "error",
1092
1219
  "unicorn/no-new-array": "error",
1093
- "unicorn/no-unsafe-regex": "off",
1094
- "unicorn/number-literal-case": "error",
1095
- "unicorn/numeric-separators-style": "error",
1096
- "unicorn/throw-new-error": "error",
1097
- "unicorn/no-useless-spread": "error",
1098
- "unicorn/relative-url-style": ["error", "always"],
1099
- "unicorn/explicit-length-check": "error",
1100
- "unicorn/new-for-builtins": "error",
1101
1220
  "unicorn/no-array-for-each": "error",
1102
1221
  "unicorn/no-array-method-this-argument": "error",
1103
1222
  "unicorn/no-for-loop": "error",
1104
1223
  "unicorn/no-lonely-if": "error",
1105
1224
  "unicorn/no-negated-condition": "error",
1106
- "unicorn/switch-case-braces": "error",
1225
+ "unicorn/no-useless-spread": "error",
1107
1226
  "unicorn/prefer-ternary": "error",
1108
1227
  "unicorn/prefer-query-selector": "error",
1109
1228
  "unicorn/prefer-modern-dom-apis": "error",
@@ -1122,8 +1241,11 @@ const unicorn = () => [
1122
1241
  "unicorn/prefer-text-content": "error",
1123
1242
  "unicorn/prefer-type-error": "error",
1124
1243
  "unicorn/prefer-node-protocol": "error",
1244
+ "unicorn/prefer-negative-index": "error",
1125
1245
  "unicorn/prefer-regexp-test": "error",
1126
- "unicorn/prefer-optional-catch-binding": "error"
1246
+ "unicorn/prefer-optional-catch-binding": "error",
1247
+ "unicorn/prefer-object-from-entries": "error",
1248
+ "unicorn/prefer-prototype-methods": "error"
1127
1249
  }
1128
1250
  }
1129
1251
  ];
@@ -1168,7 +1290,7 @@ const vue = ({
1168
1290
  "vue/block-order": [
1169
1291
  "error",
1170
1292
  {
1171
- order: ["script", "template", "style"]
1293
+ order: ["script:not([setup])", "script[setup]", "template", "style"]
1172
1294
  }
1173
1295
  ],
1174
1296
  "vue/component-api-style": ["error", ["script-setup", "composition"]],
@@ -1356,7 +1478,7 @@ const flatConfigProps = [
1356
1478
  ];
1357
1479
  const VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
1358
1480
  function so1ve(options = {}, ...userConfigs) {
1359
- var _a, _b, _c, _d, _e;
1481
+ var _a, _b, _c, _d, _e, _f;
1360
1482
  const {
1361
1483
  vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
1362
1484
  solid: enableSolid = isPackageExists("solid-js"),
@@ -1386,7 +1508,6 @@ function so1ve(options = {}, ...userConfigs) {
1386
1508
  promise(),
1387
1509
  sortImports(),
1388
1510
  imports(),
1389
- jsdoc(),
1390
1511
  unicorn()
1391
1512
  );
1392
1513
  if (enableVue) {
@@ -1448,6 +1569,9 @@ function so1ve(options = {}, ...userConfigs) {
1448
1569
  })
1449
1570
  );
1450
1571
  }
1572
+ if ((_f = options.formatting) != null ? _f : true) {
1573
+ configs.push(formatting(options));
1574
+ }
1451
1575
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
1452
1576
  if (key in options) {
1453
1577
  acc[key] = options[key];
@@ -1461,4 +1585,4 @@ function so1ve(options = {}, ...userConfigs) {
1461
1585
  return merged;
1462
1586
  }
1463
1587
 
1464
- 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 };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-config",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-alpha.6",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
5
5
  "description": "Ray's eslint config.",
6
6
  "keywords": [
@@ -48,7 +48,6 @@
48
48
  "eslint-plugin-html": "^7.1.0",
49
49
  "eslint-plugin-i": "2.28.1",
50
50
  "eslint-plugin-jest-formatting": "^3.1.0",
51
- "eslint-plugin-jsdoc": "^46.4.5",
52
51
  "eslint-plugin-json-schema-validator": "^4.6.0",
53
52
  "eslint-plugin-jsonc": "^2.9.0",
54
53
  "eslint-plugin-mdx": "^2.2.0",
@@ -67,12 +66,12 @@
67
66
  "eslint-plugin-yml": "^1.8.0",
68
67
  "globals": "^13.22.0",
69
68
  "jsonc-eslint-parser": "^2.3.0",
70
- "local-pkg": "^0.4.3",
69
+ "local-pkg": "^0.5.0",
71
70
  "toml-eslint-parser": "^0.6.0",
72
71
  "vue-eslint-parser": "^9.3.1",
73
72
  "yaml-eslint-parser": "^1.2.2",
74
- "@so1ve/eslint-plugin": "1.0.0-alpha.5",
75
- "@so1ve/eslint-plugin-sort-imports": "1.0.0-alpha.5"
73
+ "@so1ve/eslint-plugin": "1.0.0-alpha.6",
74
+ "@so1ve/eslint-plugin-sort-imports": "1.0.0-alpha.6"
76
75
  },
77
76
  "devDependencies": {
78
77
  "eslint": "^8.46.0"