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

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,34 +742,6 @@ const javascript = ({
579
742
  }
580
743
  ];
581
744
 
582
- const jsdoc = () => [
583
- {
584
- plugins: {
585
- jsdoc: pluginJsdoc__default["default"]
586
- },
587
- rules: {
588
- "jsdoc/check-access": "error",
589
- "jsdoc/check-alignment": "error",
590
- "jsdoc/check-param-names": "error",
591
- "jsdoc/check-property-names": "error",
592
- "jsdoc/check-types": "error",
593
- "jsdoc/empty-tags": "error",
594
- "jsdoc/implements-on-classes": "error",
595
- "jsdoc/multiline-blocks": "error",
596
- "jsdoc/no-defaults": "error",
597
- "jsdoc/no-multi-asterisks": "error",
598
- "jsdoc/require-param-name": "error",
599
- "jsdoc/require-property": "error",
600
- "jsdoc/require-property-description": "error",
601
- "jsdoc/require-property-name": "error",
602
- "jsdoc/require-returns-check": "error",
603
- "jsdoc/require-returns-description": "error",
604
- "jsdoc/require-yields-check": "error",
605
- "jsdoc/valid-types": "error"
606
- }
607
- }
608
- ];
609
-
610
745
  const jsonc = () => [
611
746
  {
612
747
  plugins: {
@@ -625,22 +760,6 @@ const jsonc = () => [
625
760
  "jsonc/quotes": "off",
626
761
  "jsonc/quotes-props": "off"
627
762
  }
628
- },
629
- {
630
- files: [GLOB_PACKAGEJSON],
631
- rules: {
632
- "jsonc/sort-keys": [
633
- "error",
634
- {
635
- pathPattern: "^exports$",
636
- order: { type: "asc" }
637
- },
638
- {
639
- pathPattern: "^exports.*$",
640
- order: ["types", "require", "import", "default"]
641
- }
642
- ]
643
- }
644
763
  }
645
764
  ];
646
765
 
@@ -795,7 +914,6 @@ const test = ({
795
914
  "vitest/prefer-to-have-length": "error",
796
915
  "vitest/prefer-todo": "error",
797
916
  "vitest/valid-title": ["error", { allowArguments: true }],
798
- "jest-formatting/padding-around-all": "error",
799
917
  ...overrides
800
918
  }
801
919
  }
@@ -1098,25 +1216,24 @@ const unicorn = () => [
1098
1216
  unicorn: pluginUnicorn__default["default"]
1099
1217
  },
1100
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",
1101
1225
  "unicorn/error-message": "error",
1102
1226
  "unicorn/escape-case": "error",
1227
+ "unicorn/explicit-length-check": "error",
1103
1228
  "unicorn/no-instanceof-array": "error",
1104
1229
  "unicorn/no-new-buffer": "error",
1105
1230
  "unicorn/no-new-array": "error",
1106
- "unicorn/no-unsafe-regex": "off",
1107
- "unicorn/number-literal-case": "error",
1108
- "unicorn/numeric-separators-style": "error",
1109
- "unicorn/throw-new-error": "error",
1110
- "unicorn/no-useless-spread": "error",
1111
- "unicorn/relative-url-style": ["error", "always"],
1112
- "unicorn/explicit-length-check": "error",
1113
- "unicorn/new-for-builtins": "error",
1114
1231
  "unicorn/no-array-for-each": "error",
1115
1232
  "unicorn/no-array-method-this-argument": "error",
1116
1233
  "unicorn/no-for-loop": "error",
1117
1234
  "unicorn/no-lonely-if": "error",
1118
1235
  "unicorn/no-negated-condition": "error",
1119
- "unicorn/switch-case-braces": "error",
1236
+ "unicorn/no-useless-spread": "error",
1120
1237
  "unicorn/prefer-ternary": "error",
1121
1238
  "unicorn/prefer-query-selector": "error",
1122
1239
  "unicorn/prefer-modern-dom-apis": "error",
@@ -1135,8 +1252,11 @@ const unicorn = () => [
1135
1252
  "unicorn/prefer-text-content": "error",
1136
1253
  "unicorn/prefer-type-error": "error",
1137
1254
  "unicorn/prefer-node-protocol": "error",
1255
+ "unicorn/prefer-negative-index": "error",
1138
1256
  "unicorn/prefer-regexp-test": "error",
1139
- "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"
1140
1260
  }
1141
1261
  }
1142
1262
  ];
@@ -1181,7 +1301,7 @@ const vue = ({
1181
1301
  "vue/block-order": [
1182
1302
  "error",
1183
1303
  {
1184
- order: ["script", "template", "style"]
1304
+ order: ["script:not([setup])", "script[setup]", "template", "style"]
1185
1305
  }
1186
1306
  ],
1187
1307
  "vue/component-api-style": ["error", ["script-setup", "composition"]],
@@ -1369,13 +1489,14 @@ const flatConfigProps = [
1369
1489
  ];
1370
1490
  const VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
1371
1491
  function so1ve(options = {}, ...userConfigs) {
1372
- var _a, _b, _c, _d, _e;
1492
+ var _a, _b, _c, _d, _e, _f;
1373
1493
  const {
1374
1494
  vue: enableVue = VuePackages.some((i) => localPkg.isPackageExists(i)),
1375
1495
  solid: enableSolid = localPkg.isPackageExists("solid-js"),
1376
1496
  typescript: enableTypeScript = localPkg.isPackageExists("typescript"),
1377
1497
  gitignore: enableGitignore = true,
1378
- overrides = {}
1498
+ overrides = {},
1499
+ componentExts = []
1379
1500
  } = options;
1380
1501
  const configs = [];
1381
1502
  if (enableGitignore) {
@@ -1396,13 +1517,10 @@ function so1ve(options = {}, ...userConfigs) {
1396
1517
  node(),
1397
1518
  onlyError(),
1398
1519
  promise(),
1399
- // jsdoc(),
1400
1520
  sortImports(),
1401
1521
  imports(),
1402
- jsdoc(),
1403
1522
  unicorn()
1404
1523
  );
1405
- const componentExts = [];
1406
1524
  if (enableVue) {
1407
1525
  componentExts.push("vue");
1408
1526
  }
@@ -1462,6 +1580,9 @@ function so1ve(options = {}, ...userConfigs) {
1462
1580
  })
1463
1581
  );
1464
1582
  }
1583
+ if ((_f = options.formatting) != null ? _f : true) {
1584
+ configs.push(formatting(options));
1585
+ }
1465
1586
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
1466
1587
  if (key in options) {
1467
1588
  acc[key] = options[key];
@@ -1527,10 +1648,6 @@ Object.defineProperty(exports, 'pluginJestFormatting', {
1527
1648
  enumerable: true,
1528
1649
  get: function () { return pluginJestFormatting__default["default"]; }
1529
1650
  });
1530
- Object.defineProperty(exports, 'pluginJsdoc', {
1531
- enumerable: true,
1532
- get: function () { return pluginJsdoc__default["default"]; }
1533
- });
1534
1651
  Object.defineProperty(exports, 'pluginJsonSchemaValidator', {
1535
1652
  enumerable: true,
1536
1653
  get: function () { return pluginJsonSchemaValidator__default["default"]; }
@@ -1629,16 +1746,17 @@ exports.GLOB_STYLE = GLOB_STYLE;
1629
1746
  exports.GLOB_TESTS = GLOB_TESTS;
1630
1747
  exports.GLOB_TOML = GLOB_TOML;
1631
1748
  exports.GLOB_TS = GLOB_TS;
1749
+ exports.GLOB_TSCONFIG = GLOB_TSCONFIG;
1632
1750
  exports.GLOB_TSX = GLOB_TSX;
1633
1751
  exports.GLOB_VUE = GLOB_VUE;
1634
1752
  exports.GLOB_YAML = GLOB_YAML;
1635
1753
  exports.combine = combine;
1636
1754
  exports.comments = comments;
1755
+ exports.formatting = formatting;
1637
1756
  exports.html = html;
1638
1757
  exports.ignores = ignores;
1639
1758
  exports.imports = imports;
1640
1759
  exports.javascript = javascript;
1641
- exports.jsdoc = jsdoc;
1642
1760
  exports.jsonc = jsonc;
1643
1761
  exports.mdx = mdx;
1644
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.
@@ -59,7 +54,7 @@ interface OptionsHasTypeScript {
59
54
  interface OptionsOverrides {
60
55
  overrides?: FlatESLintConfigItem["rules"];
61
56
  }
62
- interface Options {
57
+ interface Options extends OptionsComponentExts {
63
58
  /**
64
59
  * Enable gitignore support.
65
60
  *
@@ -119,6 +114,12 @@ interface Options {
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 {
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,34 +731,6 @@ const javascript = ({
568
731
  }
569
732
  ];
570
733
 
571
- const jsdoc = () => [
572
- {
573
- plugins: {
574
- jsdoc: pluginJsdoc
575
- },
576
- rules: {
577
- "jsdoc/check-access": "error",
578
- "jsdoc/check-alignment": "error",
579
- "jsdoc/check-param-names": "error",
580
- "jsdoc/check-property-names": "error",
581
- "jsdoc/check-types": "error",
582
- "jsdoc/empty-tags": "error",
583
- "jsdoc/implements-on-classes": "error",
584
- "jsdoc/multiline-blocks": "error",
585
- "jsdoc/no-defaults": "error",
586
- "jsdoc/no-multi-asterisks": "error",
587
- "jsdoc/require-param-name": "error",
588
- "jsdoc/require-property": "error",
589
- "jsdoc/require-property-description": "error",
590
- "jsdoc/require-property-name": "error",
591
- "jsdoc/require-returns-check": "error",
592
- "jsdoc/require-returns-description": "error",
593
- "jsdoc/require-yields-check": "error",
594
- "jsdoc/valid-types": "error"
595
- }
596
- }
597
- ];
598
-
599
734
  const jsonc = () => [
600
735
  {
601
736
  plugins: {
@@ -614,22 +749,6 @@ const jsonc = () => [
614
749
  "jsonc/quotes": "off",
615
750
  "jsonc/quotes-props": "off"
616
751
  }
617
- },
618
- {
619
- files: [GLOB_PACKAGEJSON],
620
- rules: {
621
- "jsonc/sort-keys": [
622
- "error",
623
- {
624
- pathPattern: "^exports$",
625
- order: { type: "asc" }
626
- },
627
- {
628
- pathPattern: "^exports.*$",
629
- order: ["types", "require", "import", "default"]
630
- }
631
- ]
632
- }
633
752
  }
634
753
  ];
635
754
 
@@ -784,7 +903,6 @@ const test = ({
784
903
  "vitest/prefer-to-have-length": "error",
785
904
  "vitest/prefer-todo": "error",
786
905
  "vitest/valid-title": ["error", { allowArguments: true }],
787
- "jest-formatting/padding-around-all": "error",
788
906
  ...overrides
789
907
  }
790
908
  }
@@ -1087,25 +1205,24 @@ const unicorn = () => [
1087
1205
  unicorn: pluginUnicorn
1088
1206
  },
1089
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",
1090
1214
  "unicorn/error-message": "error",
1091
1215
  "unicorn/escape-case": "error",
1216
+ "unicorn/explicit-length-check": "error",
1092
1217
  "unicorn/no-instanceof-array": "error",
1093
1218
  "unicorn/no-new-buffer": "error",
1094
1219
  "unicorn/no-new-array": "error",
1095
- "unicorn/no-unsafe-regex": "off",
1096
- "unicorn/number-literal-case": "error",
1097
- "unicorn/numeric-separators-style": "error",
1098
- "unicorn/throw-new-error": "error",
1099
- "unicorn/no-useless-spread": "error",
1100
- "unicorn/relative-url-style": ["error", "always"],
1101
- "unicorn/explicit-length-check": "error",
1102
- "unicorn/new-for-builtins": "error",
1103
1220
  "unicorn/no-array-for-each": "error",
1104
1221
  "unicorn/no-array-method-this-argument": "error",
1105
1222
  "unicorn/no-for-loop": "error",
1106
1223
  "unicorn/no-lonely-if": "error",
1107
1224
  "unicorn/no-negated-condition": "error",
1108
- "unicorn/switch-case-braces": "error",
1225
+ "unicorn/no-useless-spread": "error",
1109
1226
  "unicorn/prefer-ternary": "error",
1110
1227
  "unicorn/prefer-query-selector": "error",
1111
1228
  "unicorn/prefer-modern-dom-apis": "error",
@@ -1124,8 +1241,11 @@ const unicorn = () => [
1124
1241
  "unicorn/prefer-text-content": "error",
1125
1242
  "unicorn/prefer-type-error": "error",
1126
1243
  "unicorn/prefer-node-protocol": "error",
1244
+ "unicorn/prefer-negative-index": "error",
1127
1245
  "unicorn/prefer-regexp-test": "error",
1128
- "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"
1129
1249
  }
1130
1250
  }
1131
1251
  ];
@@ -1170,7 +1290,7 @@ const vue = ({
1170
1290
  "vue/block-order": [
1171
1291
  "error",
1172
1292
  {
1173
- order: ["script", "template", "style"]
1293
+ order: ["script:not([setup])", "script[setup]", "template", "style"]
1174
1294
  }
1175
1295
  ],
1176
1296
  "vue/component-api-style": ["error", ["script-setup", "composition"]],
@@ -1358,13 +1478,14 @@ const flatConfigProps = [
1358
1478
  ];
1359
1479
  const VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
1360
1480
  function so1ve(options = {}, ...userConfigs) {
1361
- var _a, _b, _c, _d, _e;
1481
+ var _a, _b, _c, _d, _e, _f;
1362
1482
  const {
1363
1483
  vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
1364
1484
  solid: enableSolid = isPackageExists("solid-js"),
1365
1485
  typescript: enableTypeScript = isPackageExists("typescript"),
1366
1486
  gitignore: enableGitignore = true,
1367
- overrides = {}
1487
+ overrides = {},
1488
+ componentExts = []
1368
1489
  } = options;
1369
1490
  const configs = [];
1370
1491
  if (enableGitignore) {
@@ -1385,13 +1506,10 @@ function so1ve(options = {}, ...userConfigs) {
1385
1506
  node(),
1386
1507
  onlyError(),
1387
1508
  promise(),
1388
- // jsdoc(),
1389
1509
  sortImports(),
1390
1510
  imports(),
1391
- jsdoc(),
1392
1511
  unicorn()
1393
1512
  );
1394
- const componentExts = [];
1395
1513
  if (enableVue) {
1396
1514
  componentExts.push("vue");
1397
1515
  }
@@ -1451,6 +1569,9 @@ function so1ve(options = {}, ...userConfigs) {
1451
1569
  })
1452
1570
  );
1453
1571
  }
1572
+ if ((_f = options.formatting) != null ? _f : true) {
1573
+ configs.push(formatting(options));
1574
+ }
1454
1575
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
1455
1576
  if (key in options) {
1456
1577
  acc[key] = options[key];
@@ -1464,4 +1585,4 @@ function so1ve(options = {}, ...userConfigs) {
1464
1585
  return merged;
1465
1586
  }
1466
1587
 
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 };
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.7",
3
+ "version": "1.0.0-alpha.8",
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.7",
74
- "@so1ve/eslint-plugin-sort-imports": "1.0.0-alpha.7"
73
+ "@so1ve/eslint-plugin-sort-imports": "1.0.0-alpha.8",
74
+ "@so1ve/eslint-plugin": "1.0.0-alpha.8"
75
75
  },
76
76
  "devDependencies": {
77
77
  "eslint": "^8.46.0"