@w5s/eslint-config 3.2.1 → 3.3.1

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.d.ts CHANGED
@@ -1723,6 +1723,8 @@ type JsdocTypeFormatting = []|[{
1723
1723
 
1724
1724
  objectFieldSeparatorTrailingPunctuation?: boolean
1725
1725
 
1726
+ objectTypeBracketSpacing?: string
1727
+
1726
1728
  parameterDefaultValueSpacing?: string
1727
1729
 
1728
1730
  postMethodNameSpacing?: string
@@ -1733,6 +1735,8 @@ type JsdocTypeFormatting = []|[{
1733
1735
 
1734
1736
  stringQuotes?: ("double" | "single")
1735
1737
 
1738
+ trailingPunctuationMultilineOnly?: boolean
1739
+
1736
1740
  typeBracketSpacing?: string
1737
1741
 
1738
1742
  unionSpacing?: string
@@ -2432,6 +2436,11 @@ interface RuleOptions$5 {
2432
2436
  * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-global/console.md
2433
2437
  */
2434
2438
  'node/prefer-global/console'?: Linter.RuleEntry<NodePreferGlobalConsole>
2439
+ /**
2440
+ * enforce either `crypto` or `require("crypto").webcrypto`
2441
+ * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-global/crypto.md
2442
+ */
2443
+ 'node/prefer-global/crypto'?: Linter.RuleEntry<NodePreferGlobalCrypto>
2435
2444
  /**
2436
2445
  * enforce either `process` or `require("process")`
2437
2446
  * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-global/process.md
@@ -2447,6 +2456,11 @@ interface RuleOptions$5 {
2447
2456
  * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-global/text-encoder.md
2448
2457
  */
2449
2458
  'node/prefer-global/text-encoder'?: Linter.RuleEntry<NodePreferGlobalTextEncoder>
2459
+ /**
2460
+ * enforce either global timer functions or `require("timers")`
2461
+ * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-global/timers.md
2462
+ */
2463
+ 'node/prefer-global/timers'?: Linter.RuleEntry<NodePreferGlobalTimers>
2450
2464
  /**
2451
2465
  * enforce either `URL` or `require("url").URL`
2452
2466
  * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-global/url.md
@@ -2755,12 +2769,16 @@ type NodeNoUnsupportedFeaturesNodeBuiltins = []|[{
2755
2769
  type NodePreferGlobalBuffer = []|[("always" | "never")]
2756
2770
  // ----- node/prefer-global/console -----
2757
2771
  type NodePreferGlobalConsole = []|[("always" | "never")]
2772
+ // ----- node/prefer-global/crypto -----
2773
+ type NodePreferGlobalCrypto = []|[("always" | "never")]
2758
2774
  // ----- node/prefer-global/process -----
2759
2775
  type NodePreferGlobalProcess = []|[("always" | "never")]
2760
2776
  // ----- node/prefer-global/text-decoder -----
2761
2777
  type NodePreferGlobalTextDecoder = []|[("always" | "never")]
2762
2778
  // ----- node/prefer-global/text-encoder -----
2763
2779
  type NodePreferGlobalTextEncoder = []|[("always" | "never")]
2780
+ // ----- node/prefer-global/timers -----
2781
+ type NodePreferGlobalTimers = []|[("always" | "never")]
2764
2782
  // ----- node/prefer-global/url -----
2765
2783
  type NodePreferGlobalUrl = []|[("always" | "never")]
2766
2784
  // ----- node/prefer-global/url-search-params -----
@@ -2882,6 +2900,11 @@ interface RuleOptions$4 {
2882
2900
  * @see https://eslint.style/rules/eol-last
2883
2901
  */
2884
2902
  'style/eol-last'?: Linter.RuleEntry<StyleEolLast>
2903
+ /**
2904
+ * Enforce consistent line break styles for JSX props
2905
+ * @see https://eslint.style/rules/jsx-props-style
2906
+ */
2907
+ 'style/exp-jsx-props-style'?: Linter.RuleEntry<StyleExpJsxPropsStyle>
2885
2908
  /**
2886
2909
  * Enforce consistent spacing and line break styles inside brackets.
2887
2910
  * @see https://eslint.style/rules/list-style
@@ -3479,15 +3502,25 @@ type StyleCurlyNewline = []|[(("always" | "never") | {
3479
3502
  type StyleDotLocation = []|[("object" | "property")]
3480
3503
  // ----- style/eol-last -----
3481
3504
  type StyleEolLast = []|[("always" | "never" | "unix" | "windows")]
3505
+ // ----- style/exp-jsx-props-style -----
3506
+ type StyleExpJsxPropsStyle = []|[{
3507
+ singleLine?: {
3508
+ maxItems?: number
3509
+ }
3510
+ multiLine?: {
3511
+ minItems?: number
3512
+ maxItemsPerLine?: number
3513
+ }
3514
+ }]
3482
3515
  // ----- style/exp-list-style -----
3483
3516
  type StyleExpListStyle = []|[{
3484
3517
  singleLine?: _StyleExpListStyle_SingleLineConfig
3485
3518
  multiLine?: _StyleExpListStyle_MultiLineConfig
3486
3519
  overrides?: {
3520
+ "()"?: _StyleExpListStyle_BaseConfig
3487
3521
  "[]"?: _StyleExpListStyle_BaseConfig
3488
3522
  "{}"?: _StyleExpListStyle_BaseConfig
3489
3523
  "<>"?: _StyleExpListStyle_BaseConfig
3490
- "()"?: _StyleExpListStyle_BaseConfig
3491
3524
  ArrayExpression?: _StyleExpListStyle_BaseConfig
3492
3525
  ArrayPattern?: _StyleExpListStyle_BaseConfig
3493
3526
  ArrowFunctionExpression?: _StyleExpListStyle_BaseConfig
@@ -3495,21 +3528,22 @@ type StyleExpListStyle = []|[{
3495
3528
  ExportNamedDeclaration?: _StyleExpListStyle_BaseConfig
3496
3529
  FunctionDeclaration?: _StyleExpListStyle_BaseConfig
3497
3530
  FunctionExpression?: _StyleExpListStyle_BaseConfig
3498
- ImportDeclaration?: _StyleExpListStyle_BaseConfig
3531
+ IfStatement?: _StyleExpListStyle_BaseConfig
3499
3532
  ImportAttributes?: _StyleExpListStyle_BaseConfig
3533
+ ImportDeclaration?: _StyleExpListStyle_BaseConfig
3534
+ JSONArrayExpression?: _StyleExpListStyle_BaseConfig
3535
+ JSONObjectExpression?: _StyleExpListStyle_BaseConfig
3500
3536
  NewExpression?: _StyleExpListStyle_BaseConfig
3501
3537
  ObjectExpression?: _StyleExpListStyle_BaseConfig
3502
3538
  ObjectPattern?: _StyleExpListStyle_BaseConfig
3503
3539
  TSDeclareFunction?: _StyleExpListStyle_BaseConfig
3540
+ TSEnumBody?: _StyleExpListStyle_BaseConfig
3504
3541
  TSFunctionType?: _StyleExpListStyle_BaseConfig
3505
3542
  TSInterfaceBody?: _StyleExpListStyle_BaseConfig
3506
- TSEnumBody?: _StyleExpListStyle_BaseConfig
3507
3543
  TSTupleType?: _StyleExpListStyle_BaseConfig
3508
3544
  TSTypeLiteral?: _StyleExpListStyle_BaseConfig
3509
3545
  TSTypeParameterDeclaration?: _StyleExpListStyle_BaseConfig
3510
3546
  TSTypeParameterInstantiation?: _StyleExpListStyle_BaseConfig
3511
- JSONArrayExpression?: _StyleExpListStyle_BaseConfig
3512
- JSONObjectExpression?: _StyleExpListStyle_BaseConfig
3513
3547
  }
3514
3548
  }]
3515
3549
  interface _StyleExpListStyle_SingleLineConfig {
@@ -5571,7 +5605,7 @@ interface RuleOptions$2 {
5571
5605
  * Disallow default values that will never be used
5572
5606
  * @see https://typescript-eslint.io/rules/no-useless-default-assignment
5573
5607
  */
5574
- 'ts/no-useless-default-assignment'?: Linter.RuleEntry<[]>
5608
+ 'ts/no-useless-default-assignment'?: Linter.RuleEntry<TsNoUselessDefaultAssignment>
5575
5609
  /**
5576
5610
  * Disallow empty exports that don't change anything in a module file
5577
5611
  * @see https://typescript-eslint.io/rules/no-useless-empty-export
@@ -6678,6 +6712,11 @@ type TsNoUseBeforeDefine = []|[("nofunc" | {
6678
6712
 
6679
6713
  variables?: boolean
6680
6714
  })]
6715
+ // ----- ts/no-useless-default-assignment -----
6716
+ type TsNoUselessDefaultAssignment = []|[{
6717
+
6718
+ allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean
6719
+ }]
6681
6720
  // ----- ts/no-var-requires -----
6682
6721
  type TsNoVarRequires = []|[{
6683
6722
 
package/dist/index.js CHANGED
@@ -375,13 +375,6 @@ var require_src = __commonJS({
375
375
 
376
376
  // src/config/es.ts
377
377
  var import_js = __toESM(require_src());
378
- function createRules(prefix) {
379
- return ESLintConfig.renameRules({
380
- "no-unused-vars": ["error", { argsIgnorePattern: "^_" }]
381
- }, {
382
- "": prefix
383
- });
384
- }
385
378
 
386
379
  // src/rules/esRules/bestPractices.ts
387
380
  var bestPractices = () => ({
@@ -1150,7 +1143,6 @@ async function es(options) {
1150
1143
  files: defaultFiles,
1151
1144
  rules: {
1152
1145
  ...import_js.default.configs.recommended.rules,
1153
- ...createRules(""),
1154
1146
  ...esRules(),
1155
1147
  ...rules
1156
1148
  }
@@ -1640,6 +1632,138 @@ async function test(options = {}) {
1640
1632
  }
1641
1633
  ];
1642
1634
  }
1635
+ var tsRules = () => {
1636
+ const baseRules = esRules();
1637
+ return ESLintConfig.renameRules(
1638
+ {
1639
+ // '@typescript-eslint/comma-dangle': [
1640
+ // baseRules['comma-dangle'][0],
1641
+ // {
1642
+ // ...baseRules['comma-dangle'][1],
1643
+ // enums: baseRules['comma-dangle'][1].arrays,
1644
+ // generics: baseRules['comma-dangle'][1].arrays,
1645
+ // tuples: baseRules['comma-dangle'][1].arrays,
1646
+ // },
1647
+ // ],
1648
+ "@typescript-eslint/adjacent-overload-signatures": "error",
1649
+ "@typescript-eslint/ban-ts-comment": [
1650
+ "warn",
1651
+ {
1652
+ "minimumDescriptionLength": 3,
1653
+ "ts-check": false,
1654
+ "ts-expect-error": "allow-with-description",
1655
+ "ts-ignore": "allow-with-description",
1656
+ "ts-nocheck": true
1657
+ }
1658
+ ],
1659
+ // '@typescript-eslint/brace-style': baseRules['brace-style'],
1660
+ // '@typescript-eslint/comma-dangle': [
1661
+ // baseRules['comma-dangle'][0],
1662
+ // {
1663
+ // ...baseRules['comma-dangle'][1],
1664
+ // enums: baseRules['comma-dangle'][1].arrays,
1665
+ // generics: baseRules['comma-dangle'][1].arrays,
1666
+ // tuples: baseRules['comma-dangle'][1].arrays,
1667
+ // },
1668
+ // ],
1669
+ // '@typescript-eslint/comma-spacing': baseRules['comma-spacing'],
1670
+ "@typescript-eslint/consistent-type-assertions": [
1671
+ "error",
1672
+ { assertionStyle: "as", objectLiteralTypeAssertions: "never" }
1673
+ ],
1674
+ "@typescript-eslint/default-param-last": baseRules["default-param-last"],
1675
+ // '@typescript-eslint/dot-notation': baseRules['dot-notation'], // TODO: Stylistic typechecked
1676
+ "@typescript-eslint/explicit-function-return-type": "off",
1677
+ "@typescript-eslint/explicit-module-boundary-types": "off",
1678
+ // '@typescript-eslint/func-call-spacing': baseRules['func-call-spacing'],
1679
+ // '@typescript-eslint/indent': baseRules.indent,
1680
+ // '@typescript-eslint/keyword-spacing': baseRules['keyword-spacing'],
1681
+ // '@typescript-eslint/lines-between-class-members': baseRules['lines-between-class-members'],
1682
+ // '@typescript-eslint/member-delimiter-style': 'error', // TODO: @stylistic/member-delimiter-style
1683
+ "@typescript-eslint/naming-convention": [
1684
+ "error",
1685
+ // {
1686
+ // format: ['PascalCase', 'camelCase'],
1687
+ // leadingUnderscore: 'allow',
1688
+ // selector: 'default',
1689
+ // trailingUnderscore: 'allow',
1690
+ // },
1691
+ {
1692
+ format: ["PascalCase", "camelCase", "UPPER_CASE"],
1693
+ leadingUnderscore: "allow",
1694
+ selector: "variable",
1695
+ trailingUnderscore: "allow"
1696
+ },
1697
+ // {
1698
+ // format: ['PascalCase', 'camelCase', 'UPPER_CASE'],
1699
+ // leadingUnderscore: 'allowSingleOrDouble',
1700
+ // selector: 'memberLike',
1701
+ // trailingUnderscore: 'allowDouble',
1702
+ // },
1703
+ {
1704
+ format: ["PascalCase"],
1705
+ selector: "typeLike"
1706
+ }
1707
+ ],
1708
+ // '@typescript-eslint/no-array-constructor': baseRules['no-array-constructor'],
1709
+ // '@typescript-eslint/no-base-to-string': 'error', // TODO: require type check
1710
+ "@typescript-eslint/no-dupe-class-members": baseRules["no-dupe-class-members"],
1711
+ "@typescript-eslint/no-empty-function": baseRules["no-empty-function"],
1712
+ "@typescript-eslint/no-empty-interface": ["error", { allowSingleExtends: true }],
1713
+ "@typescript-eslint/no-empty-object-type": "off",
1714
+ "@typescript-eslint/no-explicit-any": "off",
1715
+ // if any is explicit then it's wanted
1716
+ "@typescript-eslint/no-extra-parens": baseRules["no-extra-parens"],
1717
+ // '@typescript-eslint/no-extra-semi': baseRules['no-extra-semi'], // TODO: @stylistic/no-extra-semi
1718
+ "@typescript-eslint/no-inferrable-types": "error",
1719
+ "@typescript-eslint/no-loop-func": baseRules["no-loop-func"],
1720
+ "@typescript-eslint/no-loss-of-precision": baseRules["no-loss-of-precision"],
1721
+ "@typescript-eslint/no-magic-numbers": baseRules["no-magic-numbers"],
1722
+ "@typescript-eslint/no-misused-new": "error",
1723
+ "@typescript-eslint/no-namespace": "off",
1724
+ // We don't agree with community, namespaces are great and not deprecated
1725
+ "@typescript-eslint/no-non-null-assertion": "error",
1726
+ "@typescript-eslint/no-redeclare": ESLintConfig.fixme(baseRules["no-redeclare"]),
1727
+ "@typescript-eslint/no-require-imports": "error",
1728
+ "@typescript-eslint/no-shadow": baseRules["no-shadow"],
1729
+ "@typescript-eslint/no-this-alias": "error",
1730
+ // '@typescript-eslint/no-unnecessary-condition': 'error',// TODO: require type check
1731
+ // '@typescript-eslint/no-unsafe-argument': 'error', // TODO: recommended type check
1732
+ "@typescript-eslint/no-unused-expressions": baseRules["no-unused-expressions"],
1733
+ "@typescript-eslint/no-unused-vars": baseRules["no-unused-vars"],
1734
+ "@typescript-eslint/no-use-before-define": baseRules["no-use-before-define"],
1735
+ "@typescript-eslint/no-useless-constructor": baseRules["no-useless-constructor"],
1736
+ "@typescript-eslint/no-var-requires": "error",
1737
+ "@typescript-eslint/no-wrapper-object-types": "error",
1738
+ // '@typescript-eslint/object-curly-spacing': baseRules['object-curly-spacing'],
1739
+ // '@typescript-eslint/only-throw-error': baseRules['no-throw-literal'], //TODO: Recommended type check
1740
+ "@typescript-eslint/prefer-namespace-keyword": "error",
1741
+ // '@typescript-eslint/prefer-reduce-type-parameter': 'error', // TODO: strict type check
1742
+ // '@typescript-eslint/quotes': baseRules.quotes,
1743
+ "@typescript-eslint/require-await": baseRules["require-await"],
1744
+ // '@typescript-eslint/return-await': baseRules['no-return-await'], // TODO: strict type check
1745
+ // '@typescript-eslint/semi': baseRules.semi,
1746
+ // '@typescript-eslint/space-before-function-paren': baseRules['space-before-function-paren'],
1747
+ // '@typescript-eslint/space-infix-ops': baseRules['space-infix-ops'],
1748
+ // '@typescript-eslint/strict-boolean-expressions': [
1749
+ // 'error',
1750
+ // {
1751
+ // allowNullableObject: false,
1752
+ // allowNumber: false,
1753
+ // allowString: false,
1754
+ // },
1755
+ // ], //TODO: require typing
1756
+ // '@typescript-eslint/switch-exhaustiveness-check': 'error',//TODO: require type check
1757
+ "@typescript-eslint/triple-slash-reference": "error"
1758
+ // '@typescript-eslint/type-annotation-spacing': 'error',// TODO: @stylistic/type-annotation-spacing
1759
+ },
1760
+ {
1761
+ "@typescript-eslint": "ts"
1762
+ }
1763
+ );
1764
+ };
1765
+
1766
+ // src/config/ts.ts
1643
1767
  var defaultFiles4 = [`**/${Project.extensionsToGlob(Project.queryExtensions(["typescript", "typescriptreact"]))}`];
1644
1768
  async function ts(options = {}) {
1645
1769
  const [tsPlugin, tsParser] = await Promise.all([
@@ -1679,45 +1803,23 @@ async function ts(options = {}) {
1679
1803
  },
1680
1804
  name: "w5s/ts/rules",
1681
1805
  rules: {
1682
- ...ESLintConfig.renameRules(
1683
- tsRecommendedRules,
1684
- { "@typescript-eslint": "ts" }
1685
- ),
1686
- ...ESLintConfig.renameRules(
1687
- tsStrictRules,
1688
- { "@typescript-eslint": "ts" }
1689
- ),
1690
- "ts/ban-ts-comment": [
1691
- "warn",
1692
- {
1693
- "minimumDescriptionLength": 3,
1694
- "ts-check": false,
1695
- "ts-expect-error": "allow-with-description",
1696
- "ts-ignore": "allow-with-description",
1697
- "ts-nocheck": true
1698
- }
1699
- ],
1700
- "ts/no-empty-object-type": "off",
1701
- "ts/no-explicit-any": "off",
1702
- // if any is explicit then it's wanted
1703
- "ts/no-namespace": "off",
1704
- // We don't agree with community, namespaces are great and not deprecated
1705
- ...createRules("ts/"),
1806
+ ...ESLintConfig.renameRules(tsRecommendedRules, { "@typescript-eslint": "ts" }),
1807
+ ...ESLintConfig.renameRules(tsStrictRules, { "@typescript-eslint": "ts" }),
1808
+ ...tsRules(),
1706
1809
  ...stylisticEnabled ? {} : {},
1707
1810
  ...rules
1708
1811
  }
1709
1812
  },
1710
- ...typeChecked ? [{
1711
- files: defaultFiles4,
1712
- // ignores: ignoresTypeAware,
1713
- name: "w5s/ts/rules-type-checked",
1714
- rules: {
1715
- ...ESLintConfig.renameRules(
1716
- tsTypeCheckedRules,
1717
- { "@typescript-eslint": "ts" }
1718
- )
1813
+ ...typeChecked ? [
1814
+ {
1815
+ files: defaultFiles4,
1816
+ // ignores: ignoresTypeAware,
1817
+ name: "w5s/ts/rules-type-checked",
1818
+ rules: {
1819
+ ...ESLintConfig.renameRules(tsTypeCheckedRules, { "@typescript-eslint": "ts" })
1820
+ }
1719
1821
  }
1720
- }] : []
1822
+ ] : []
1721
1823
  ];
1722
1824
  }
1723
1825
  async function unicorn(options = {}) {
@@ -1843,8 +1945,10 @@ async function yml(options = {}) {
1843
1945
  // src/defineConfig.ts
1844
1946
  async function defineConfig(options = {}) {
1845
1947
  const stylisticOptions = typeof options.stylistic === "boolean" ? { enabled: options.stylistic } : { enabled: true, ...options.stylistic };
1846
- const withDefaultStylistic = (options2) => ({ stylistic: stylisticOptions, ...options2 });
1847
- const toOption = (optionsOrBoolean) => withDefaultStylistic(typeof optionsOrBoolean === "boolean" ? { enabled: optionsOrBoolean } : { enabled: true, ...optionsOrBoolean });
1948
+ const withDefaultStylistic = (_options) => ({ stylistic: stylisticOptions, ..._options });
1949
+ const toOption = (optionsOrBoolean) => withDefaultStylistic(
1950
+ typeof optionsOrBoolean === "boolean" ? { enabled: optionsOrBoolean } : { enabled: true, ...optionsOrBoolean }
1951
+ );
1848
1952
  const esOptions = toOption(options.es);
1849
1953
  const importOptions = toOption(options.import);
1850
1954
  const jsdocOptions = toOption(options.jsdoc);