@w5s/eslint-config 3.13.0 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -60,7 +60,7 @@ const StylisticConfig = {
60
60
  };
61
61
  //#endregion
62
62
  //#region src/config/e18e.ts
63
- const defaultFiles$11 = [sourceGlob$1];
63
+ const defaultFiles$10 = [sourceGlob$1];
64
64
  /**
65
65
  * @see https://e18e.dev
66
66
  * @param options
@@ -73,7 +73,7 @@ async function e18e(options = {}) {
73
73
  name: "w5s/e18e/setup",
74
74
  plugins: { e18e: e18ePlugin }
75
75
  }, {
76
- files: withDefaultFiles(files, defaultFiles$11),
76
+ files: withDefaultFiles(files, defaultFiles$10),
77
77
  name: "w5s/e18e/rules",
78
78
  rules: {
79
79
  ...modernization ? e18ePlugin.configs.modernization.rules : {},
@@ -102,7 +102,6 @@ const bestPractices = () => ({
102
102
  "default-case": ["error", { commentPattern: "^no default$" }],
103
103
  "default-case-last": "error",
104
104
  "default-param-last": "error",
105
- "dot-location": ["error", "property"],
106
105
  "dot-notation": ["error", { allowKeywords: true }],
107
106
  "eqeqeq": [
108
107
  "error",
@@ -155,7 +154,6 @@ const bestPractices = () => ({
155
154
  ignore: [],
156
155
  ignoreArrayIndexes: true
157
156
  }],
158
- "no-multi-spaces": ["error", { ignoreEOLComments: false }],
159
157
  "no-multi-str": "error",
160
158
  "no-native-reassign": "off",
161
159
  "no-new": "error",
@@ -300,17 +298,6 @@ const errors = () => ({
300
298
  "no-empty-character-class": "error",
301
299
  "no-ex-assign": "error",
302
300
  "no-extra-boolean-cast": "error",
303
- "no-extra-parens": [
304
- "off",
305
- "all",
306
- {
307
- conditionalAssign: true,
308
- enforceForArrowConditionals: false,
309
- ignoreJSX: "all",
310
- nestedBinaryExpressions: false,
311
- returnAssign: false
312
- }
313
- ],
314
301
  "no-extra-semi": "error",
315
302
  "no-func-assign": "error",
316
303
  "no-import-assign": "error",
@@ -344,21 +331,7 @@ const errors = () => ({
344
331
  //#endregion
345
332
  //#region src/rules/esRules/es6.ts
346
333
  const es6 = () => ({
347
- "arrow-body-style": [
348
- "error",
349
- "as-needed",
350
- { requireReturnForObjectLiteral: false }
351
- ],
352
- "arrow-parens": ["error", "always"],
353
- "arrow-spacing": ["error", {
354
- after: true,
355
- before: true
356
- }],
357
334
  "constructor-super": "error",
358
- "generator-star-spacing": ["error", {
359
- after: true,
360
- before: false
361
- }],
362
335
  "no-class-assign": "error",
363
336
  "no-confusing-arrow": ["error", { allowParens: true }],
364
337
  "no-const-assign": "error",
@@ -379,57 +352,17 @@ const es6 = () => ({
379
352
  ignoreImport: false
380
353
  }],
381
354
  "no-var": "error",
382
- "object-shorthand": [
383
- "error",
384
- "always",
385
- {
386
- avoidQuotes: true,
387
- ignoreConstructors: false
388
- }
389
- ],
390
- "prefer-arrow-callback": ["error", {
391
- allowNamedFunctions: false,
392
- allowUnboundThis: true
393
- }],
394
355
  "prefer-const": ["error", {
395
356
  destructuring: "any",
396
357
  ignoreReadBeforeAssign: true
397
358
  }],
398
- "prefer-destructuring": [
399
- "error",
400
- {
401
- AssignmentExpression: {
402
- array: true,
403
- object: false
404
- },
405
- VariableDeclarator: {
406
- array: false,
407
- object: true
408
- }
409
- },
410
- { enforceForRenamedProperties: false }
411
- ],
412
359
  "prefer-numeric-literals": "error",
413
360
  "prefer-reflect": "off",
414
361
  "prefer-rest-params": "error",
415
362
  "prefer-spread": "error",
416
363
  "prefer-template": "error",
417
364
  "require-yield": "error",
418
- "rest-spread-spacing": ["error", "never"],
419
- "sort-imports": ["off", {
420
- ignoreCase: false,
421
- ignoreDeclarationSort: false,
422
- ignoreMemberSort: false,
423
- memberSyntaxSortOrder: [
424
- "none",
425
- "all",
426
- "multiple",
427
- "single"
428
- ]
429
- }],
430
- "symbol-description": "error",
431
- "template-curly-spacing": "error",
432
- "yield-star-spacing": ["error", "after"]
365
+ "symbol-description": "error"
433
366
  });
434
367
  //#endregion
435
368
  //#region src/rules/esRules/overrides.ts
@@ -442,8 +375,7 @@ const overrides = () => ({
442
375
  "no-underscore-dangle": "off",
443
376
  "no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
444
377
  "no-use-before-define": ["error", "nofunc"],
445
- "no-void": ["error", { allowAsStatement: true }],
446
- "unicode-bom": ["error", "never"]
378
+ "no-void": ["error", { allowAsStatement: true }]
447
379
  });
448
380
  //#endregion
449
381
  //#region src/rules/esRules/strict.ts
@@ -494,7 +426,7 @@ const esRules = () => ({
494
426
  });
495
427
  //#endregion
496
428
  //#region src/config/es.ts
497
- const defaultFiles$10 = [esSourceGlob];
429
+ const defaultFiles$9 = [esSourceGlob];
498
430
  async function es(options) {
499
431
  const { recommended = true, rules = {} } = options;
500
432
  return [{
@@ -521,7 +453,7 @@ async function es(options) {
521
453
  linterOptions: { reportUnusedDisableDirectives: true },
522
454
  name: "w5s/es/setup"
523
455
  }, {
524
- files: defaultFiles$10,
456
+ files: defaultFiles$9,
525
457
  name: "w5s/es/rules",
526
458
  rules: {
527
459
  ...recommended ? es["recommended"] : {},
@@ -574,42 +506,70 @@ imports["recommended"] = {
574
506
  imports["stylistic"] = { "import/newline-after-import": ["error", { count: 1 }] };
575
507
  //#endregion
576
508
  //#region src/config/jsdoc.ts
577
- const defaultFiles$9 = [sourceGlob$1];
509
+ const defaultJsFiles = [esSourceGlob];
510
+ const defaultTsFiles = [tsSourceGlob];
578
511
  async function jsdoc(options = {}) {
579
512
  const [jsdocPlugin] = await Promise.all([interopDefault(import("eslint-plugin-jsdoc"))]);
580
513
  const { files, recommended = true, rules = {}, stylistic = true } = options;
581
514
  const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic);
582
- return [{
583
- name: "w5s/jsdoc/setup",
584
- plugins: { jsdoc: jsdocPlugin }
585
- }, {
586
- files: withDefaultFiles(files, defaultFiles$9),
587
- name: "w5s/jsdoc/rules",
588
- rules: {
589
- ...recommended ? jsdocPlugin.configs["flat/recommended-typescript-flavor"].rules : {},
590
- ...recommended ? {
591
- "jsdoc/no-undefined-types": "off",
592
- "jsdoc/require-hyphen-before-param-description": ["warn", "always"],
593
- "jsdoc/require-jsdoc": "off",
594
- "jsdoc/require-param-description": "off",
595
- "jsdoc/require-param-type": "off",
596
- "jsdoc/require-returns": "off",
597
- "jsdoc/valid-types": "off"
598
- } : {},
599
- ...stylisticEnabled ? {
600
- ...jsdocPlugin.configs["flat/stylistic-typescript"].rules,
601
- "jsdoc/check-alignment": "warn",
602
- "jsdoc/multiline-blocks": "warn",
603
- "jsdoc/tag-lines": [
604
- "warn",
605
- "any",
606
- { startLines: 1 }
607
- ]
608
- } : {},
609
- ...rules
515
+ const recommendedRules = recommended ? jsdocPlugin.configs["flat/recommended-typescript-flavor"].rules : {};
516
+ const stylisticRules = stylisticEnabled ? {
517
+ ...jsdocPlugin.configs["flat/stylistic-typescript"].rules,
518
+ "jsdoc/check-alignment": "warn",
519
+ "jsdoc/multiline-blocks": "warn",
520
+ "jsdoc/tag-lines": [
521
+ "warn",
522
+ "any",
523
+ { startLines: 1 }
524
+ ]
525
+ } : {};
526
+ return [
527
+ {
528
+ name: "w5s/jsdoc/setup",
529
+ plugins: { jsdoc: jsdocPlugin }
610
530
  },
611
- settings: { jsdoc: { mode: "typescript" } }
612
- }];
531
+ {
532
+ files: withDefaultFiles(files, defaultJsFiles),
533
+ name: "w5s/jsdoc/rules-js",
534
+ rules: {
535
+ ...recommendedRules,
536
+ ...recommended ? {
537
+ "jsdoc/no-undefined-types": "off",
538
+ "jsdoc/require-hyphen-before-param-description": ["warn", "always"],
539
+ "jsdoc/require-jsdoc": "off",
540
+ "jsdoc/require-param-description": "off",
541
+ "jsdoc/require-param-type": "off",
542
+ "jsdoc/require-returns": "off",
543
+ "jsdoc/require-returns-type": "off",
544
+ "jsdoc/valid-types": "off"
545
+ } : {},
546
+ ...stylisticRules,
547
+ ...rules
548
+ },
549
+ settings: { jsdoc: { mode: "typescript" } }
550
+ },
551
+ {
552
+ files: withDefaultFiles(files, defaultTsFiles),
553
+ name: "w5s/jsdoc/rules-ts",
554
+ rules: {
555
+ ...recommendedRules,
556
+ ...recommended ? {
557
+ "jsdoc/no-types": "warn",
558
+ "jsdoc/no-undefined-types": "off",
559
+ "jsdoc/require-hyphen-before-param-description": ["warn", "always"],
560
+ "jsdoc/require-jsdoc": "off",
561
+ "jsdoc/require-param-description": "off",
562
+ "jsdoc/require-param-type": "off",
563
+ "jsdoc/require-returns": "off",
564
+ "jsdoc/require-returns-type": "off",
565
+ "jsdoc/valid-types": "off"
566
+ } : {},
567
+ ...stylisticRules,
568
+ ...rules
569
+ },
570
+ settings: { jsdoc: { mode: "typescript" } }
571
+ }
572
+ ];
613
573
  }
614
574
  //#endregion
615
575
  //#region src/config/jsonc.ts
@@ -1050,7 +1010,6 @@ async function test(options = {}) {
1050
1010
  const tsRules = () => {
1051
1011
  const baseRules = esRules();
1052
1012
  return ESLintConfig.renameRules({
1053
- "@typescript-eslint/adjacent-overload-signatures": "error",
1054
1013
  "@typescript-eslint/ban-ts-comment": ["warn", {
1055
1014
  "minimumDescriptionLength": 3,
1056
1015
  "ts-check": false,
@@ -1058,37 +1017,14 @@ const tsRules = () => {
1058
1017
  "ts-ignore": "allow-with-description",
1059
1018
  "ts-nocheck": true
1060
1019
  }],
1061
- "@typescript-eslint/consistent-type-assertions": ["error", {
1062
- assertionStyle: "as",
1063
- objectLiteralTypeAssertions: "never"
1064
- }],
1065
1020
  "@typescript-eslint/default-param-last": baseRules["default-param-last"],
1066
1021
  "@typescript-eslint/explicit-function-return-type": "off",
1067
1022
  "@typescript-eslint/explicit-module-boundary-types": "off",
1068
- "@typescript-eslint/naming-convention": [
1069
- "error",
1070
- {
1071
- format: [
1072
- "PascalCase",
1073
- "camelCase",
1074
- "UPPER_CASE"
1075
- ],
1076
- leadingUnderscore: "allow",
1077
- selector: "variable",
1078
- trailingUnderscore: "allow"
1079
- },
1080
- {
1081
- format: ["PascalCase"],
1082
- selector: "typeLike"
1083
- }
1084
- ],
1085
1023
  "@typescript-eslint/no-dupe-class-members": baseRules["no-dupe-class-members"],
1086
1024
  "@typescript-eslint/no-empty-function": baseRules["no-empty-function"],
1087
1025
  "@typescript-eslint/no-empty-interface": ["error", { allowSingleExtends: true }],
1088
1026
  "@typescript-eslint/no-empty-object-type": "off",
1089
1027
  "@typescript-eslint/no-explicit-any": "off",
1090
- "@typescript-eslint/no-extra-parens": baseRules["no-extra-parens"],
1091
- "@typescript-eslint/no-inferrable-types": "error",
1092
1028
  "@typescript-eslint/no-loop-func": baseRules["no-loop-func"],
1093
1029
  "@typescript-eslint/no-loss-of-precision": baseRules["no-loss-of-precision"],
1094
1030
  "@typescript-eslint/no-magic-numbers": baseRules["no-magic-numbers"],
@@ -1103,7 +1039,6 @@ const tsRules = () => {
1103
1039
  "@typescript-eslint/no-unused-vars": baseRules["no-unused-vars"],
1104
1040
  "@typescript-eslint/no-use-before-define": baseRules["no-use-before-define"],
1105
1041
  "@typescript-eslint/no-useless-constructor": baseRules["no-useless-constructor"],
1106
- "@typescript-eslint/no-var-requires": "error",
1107
1042
  "@typescript-eslint/no-wrapper-object-types": "error",
1108
1043
  "@typescript-eslint/prefer-namespace-keyword": "error",
1109
1044
  "@typescript-eslint/require-await": baseRules["require-await"],
@@ -1120,6 +1055,7 @@ async function ts(options = {}) {
1120
1055
  const tsTypeCheckedRules = tsPlugin.configs["recommended-type-checked-only"].rules;
1121
1056
  const { files, rules = {}, stylistic = true, typeChecked = false } = options;
1122
1057
  const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic);
1058
+ const tsCustomRules = tsRules();
1123
1059
  return [
1124
1060
  {
1125
1061
  name: "w5s/ts/setup",
@@ -1135,8 +1071,33 @@ async function ts(options = {}) {
1135
1071
  rules: {
1136
1072
  ...ESLintConfig.renameRules(tsRecommendedRules, { "@typescript-eslint": "ts" }),
1137
1073
  ...ESLintConfig.renameRules(tsStrictRules, { "@typescript-eslint": "ts" }),
1138
- ...tsRules(),
1139
- ...stylisticEnabled ? {} : {},
1074
+ ...tsCustomRules,
1075
+ ...stylisticEnabled ? {
1076
+ ...ESLintConfig.renameRules(tsPlugin.configs["stylistic"]?.rules, { "@typescript-eslint": "ts" }),
1077
+ "ts/array-type": ["error", { default: "generic" }],
1078
+ "ts/consistent-type-assertions": ["error", {
1079
+ assertionStyle: "as",
1080
+ objectLiteralTypeAssertions: "allow"
1081
+ }],
1082
+ "ts/naming-convention": [
1083
+ "error",
1084
+ {
1085
+ format: [
1086
+ "PascalCase",
1087
+ "camelCase",
1088
+ "UPPER_CASE"
1089
+ ],
1090
+ leadingUnderscore: "allow",
1091
+ selector: "variable",
1092
+ trailingUnderscore: "allow"
1093
+ },
1094
+ {
1095
+ format: ["PascalCase"],
1096
+ selector: "typeLike"
1097
+ }
1098
+ ],
1099
+ "ts/no-empty-function": tsCustomRules["ts/no-empty-function"]
1100
+ } : {},
1140
1101
  ...rules
1141
1102
  }
1142
1103
  },
@@ -1253,7 +1214,7 @@ async function defineConfig(options = {}) {
1253
1214
  const meta = Object.freeze({
1254
1215
  buildNumber: 1,
1255
1216
  name: "@w5s/eslint-config",
1256
- version: "3.13.0"
1217
+ version: "3.14.0"
1257
1218
  });
1258
1219
  //#endregion
1259
1220
  export { StylisticConfig, defineConfig as default, defineConfig, e18e, es, ignores, imports, jsdoc, jsonc, markdown, meta, next, node, perfectionist, react, stylistic, test, ts, unicorn, yml };