@2digits/eslint-config 2.5.2 → 2.7.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.d.cts CHANGED
@@ -10,7 +10,7 @@ import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
10
10
  interface RuleOptions {
11
11
  /**
12
12
  * Enforce giving proper names to type parameters when there are two or more
13
- * @see https://github.com/2digits-agency/configs/blob/@2digits/eslint-plugin@2.2.8/packages/eslint/src/rules/type-param-names.ts
13
+ * @see https://github.com/2digits-agency/configs/blob/@2digits/eslint-plugin@2.3.0/packages/eslint/src/rules/type-param-names.ts
14
14
  */
15
15
  '@2digits/type-param-names'?: Linter.RuleEntry<[]>
16
16
  /**
@@ -2702,18 +2702,13 @@ Backward pagination arguments
2702
2702
  */
2703
2703
  'react-extra/prefer-shorthand-fragment'?: Linter.RuleEntry<[]>
2704
2704
  /**
2705
- * enforce custom hooks using other hooks
2706
- * @see https://eslint-react.xyz/docs/rules/hooks-extra-ensure-custom-hooks-using-other-hooks
2705
+ * enforce custom hooks to use at least one other hook inside
2706
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-redundant-custom-hook
2707
2707
  */
2708
2708
  'react-hooks-extra/ensure-custom-hooks-using-other-hooks'?: Linter.RuleEntry<[]>
2709
2709
  /**
2710
- * enforce 'useCallback' has non-empty dependencies array
2711
- * @see https://eslint-react.xyz/docs/rules/hooks-extra-ensure-use-callback-has-non-empty-deps
2712
- */
2713
- 'react-hooks-extra/ensure-use-callback-has-non-empty-deps'?: Linter.RuleEntry<[]>
2714
- /**
2715
- * enforce 'useMemo' has non-empty dependencies array
2716
- * @see https://eslint-react.xyz/docs/rules/hooks-extra-ensure-use-memo-has-non-empty-deps
2710
+ * disallow unnecessary usage of 'useMemo'
2711
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-memo
2717
2712
  */
2718
2713
  'react-hooks-extra/ensure-use-memo-has-non-empty-deps'?: Linter.RuleEntry<[]>
2719
2714
  /**
@@ -2726,6 +2721,21 @@ Backward pagination arguments
2726
2721
  * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-direct-set-state-in-use-effect
2727
2722
  */
2728
2723
  'react-hooks-extra/no-direct-set-state-in-use-layout-effect'?: Linter.RuleEntry<[]>
2724
+ /**
2725
+ * enforce custom hooks to use at least one other hook inside
2726
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-redundant-custom-hook
2727
+ */
2728
+ 'react-hooks-extra/no-redundant-custom-hook'?: Linter.RuleEntry<[]>
2729
+ /**
2730
+ * disallow unnecessary usage of 'useCallback'
2731
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-callback
2732
+ */
2733
+ 'react-hooks-extra/no-unnecessary-use-callback'?: Linter.RuleEntry<[]>
2734
+ /**
2735
+ * disallow unnecessary usage of 'useMemo'
2736
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-memo
2737
+ */
2738
+ 'react-hooks-extra/no-unnecessary-use-memo'?: Linter.RuleEntry<[]>
2729
2739
  /**
2730
2740
  * disallow function calls in 'useState' that aren't wrapped in an initializer function
2731
2741
  * @see https://eslint-react.xyz/docs/rules/hooks-extra-prefer-use-state-lazy-initialization
@@ -2771,6 +2781,11 @@ Backward pagination arguments
2771
2781
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
2772
2782
  */
2773
2783
  'react-web-api/no-leaked-interval'?: Linter.RuleEntry<[]>
2784
+ /**
2785
+ * enforce cleanup of 'ResizeObserver' instances in components and custom hooks.
2786
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-resize-observer
2787
+ */
2788
+ 'react-web-api/no-leaked-resize-observer'?: Linter.RuleEntry<[]>
2774
2789
  /**
2775
2790
  * enforce that every 'setTimeout' in a component or custom hook has a corresponding 'clearTimeout'.
2776
2791
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
@@ -3302,7 +3317,7 @@ Backward pagination arguments
3302
3317
  * Enforce the use of `u` or `v` flag on RegExp
3303
3318
  * @see https://eslint.org/docs/latest/rules/require-unicode-regexp
3304
3319
  */
3305
- 'require-unicode-regexp'?: Linter.RuleEntry<[]>
3320
+ 'require-unicode-regexp'?: Linter.RuleEntry<RequireUnicodeRegexp>
3306
3321
  /**
3307
3322
  * Require generator functions to contain `yield`
3308
3323
  * @see https://eslint.org/docs/latest/rules/require-yield
@@ -7798,6 +7813,10 @@ type ReactStylePropObject = []|[{
7798
7813
  type RequireAtomicUpdates = []|[{
7799
7814
  allowProperties?: boolean
7800
7815
  }]
7816
+ // ----- require-unicode-regexp -----
7817
+ type RequireUnicodeRegexp = []|[{
7818
+ requireFlag?: ("u" | "v")
7819
+ }]
7801
7820
  // ----- rest-spread-spacing -----
7802
7821
  type RestSpreadSpacing = []|[("always" | "never")]
7803
7822
  // ----- semi -----
@@ -8034,6 +8053,7 @@ type TsBanTsComment = []|[{
8034
8053
  "ts-check"?: (boolean | "allow-with-description" | {
8035
8054
  descriptionFormat?: string
8036
8055
  })
8056
+
8037
8057
  minimumDescriptionLength?: number
8038
8058
  }]
8039
8059
  // ----- ts/class-literal-property-style -----
@@ -8059,29 +8079,41 @@ type TsConsistentReturn = []|[{
8059
8079
  }]
8060
8080
  // ----- ts/consistent-type-assertions -----
8061
8081
  type TsConsistentTypeAssertions = []|[({
8082
+
8062
8083
  assertionStyle: "never"
8063
8084
  } | {
8085
+
8064
8086
  assertionStyle: ("as" | "angle-bracket")
8087
+
8065
8088
  objectLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never")
8066
8089
  })]
8067
8090
  // ----- ts/consistent-type-definitions -----
8068
8091
  type TsConsistentTypeDefinitions = []|[("interface" | "type")]
8069
8092
  // ----- ts/consistent-type-exports -----
8070
8093
  type TsConsistentTypeExports = []|[{
8094
+
8071
8095
  fixMixedExportsWithInlineTypeSpecifier?: boolean
8072
8096
  }]
8073
8097
  // ----- ts/consistent-type-imports -----
8074
8098
  type TsConsistentTypeImports = []|[{
8099
+
8075
8100
  disallowTypeAnnotations?: boolean
8101
+
8076
8102
  fixStyle?: ("separate-type-imports" | "inline-type-imports")
8103
+
8077
8104
  prefer?: ("type-imports" | "no-type-imports")
8078
8105
  }]
8079
8106
  // ----- ts/dot-notation -----
8080
8107
  type TsDotNotation = []|[{
8108
+
8081
8109
  allowKeywords?: boolean
8110
+
8082
8111
  allowPattern?: string
8112
+
8083
8113
  allowPrivateClassPropertyAccess?: boolean
8114
+
8084
8115
  allowProtectedClassPropertyAccess?: boolean
8116
+
8085
8117
  allowIndexSignaturePropertyAccess?: boolean
8086
8118
  }]
8087
8119
  // ----- ts/explicit-function-return-type -----
@@ -8113,6 +8145,7 @@ type TsExplicitMemberAccessibility = []|[{
8113
8145
  properties?: ("explicit" | "no-public" | "off")
8114
8146
  parameterProperties?: ("explicit" | "no-public" | "off")
8115
8147
  }
8148
+
8116
8149
  ignoredMethodNames?: string[]
8117
8150
  }]
8118
8151
  // ----- ts/explicit-module-boundary-types -----
@@ -8134,8 +8167,11 @@ type TsInitDeclarations = ([]|["always"] | []|["never"]|["never", {
8134
8167
  }])
8135
8168
  // ----- ts/max-params -----
8136
8169
  type TsMaxParams = []|[{
8137
- maximum?: number
8170
+
8138
8171
  max?: number
8172
+
8173
+ maximum?: number
8174
+
8139
8175
  countVoidThis?: boolean
8140
8176
  }]
8141
8177
  // ----- ts/member-ordering -----
@@ -8489,30 +8525,40 @@ interface _TsNamingConvention_MatchRegexConfig {
8489
8525
  }
8490
8526
  // ----- ts/no-base-to-string -----
8491
8527
  type TsNoBaseToString = []|[{
8528
+
8492
8529
  ignoredTypeNames?: string[]
8493
8530
  }]
8494
8531
  // ----- ts/no-confusing-void-expression -----
8495
8532
  type TsNoConfusingVoidExpression = []|[{
8533
+
8496
8534
  ignoreArrowShorthand?: boolean
8535
+
8497
8536
  ignoreVoidOperator?: boolean
8498
8537
  }]
8499
8538
  // ----- ts/no-duplicate-type-constituents -----
8500
8539
  type TsNoDuplicateTypeConstituents = []|[{
8540
+
8501
8541
  ignoreIntersections?: boolean
8542
+
8502
8543
  ignoreUnions?: boolean
8503
8544
  }]
8504
8545
  // ----- ts/no-empty-function -----
8505
8546
  type TsNoEmptyFunction = []|[{
8547
+
8506
8548
  allow?: ("functions" | "arrowFunctions" | "generatorFunctions" | "methods" | "generatorMethods" | "getters" | "setters" | "constructors" | "private-constructors" | "protected-constructors" | "asyncFunctions" | "asyncMethods" | "decoratedFunctions" | "overrideMethods")[]
8507
8549
  }]
8508
8550
  // ----- ts/no-empty-interface -----
8509
8551
  type TsNoEmptyInterface = []|[{
8552
+
8510
8553
  allowSingleExtends?: boolean
8511
8554
  }]
8512
8555
  // ----- ts/no-empty-object-type -----
8513
8556
  type TsNoEmptyObjectType = []|[{
8557
+
8514
8558
  allowInterfaces?: ("always" | "never" | "with-single-extends")
8559
+
8515
8560
  allowObjectTypes?: ("always" | "never")
8561
+
8516
8562
  allowWithName?: string
8517
8563
  }]
8518
8564
  // ----- ts/no-explicit-any -----
@@ -8535,6 +8581,7 @@ type TsNoExtraneousClass = []|[{
8535
8581
  }]
8536
8582
  // ----- ts/no-floating-promises -----
8537
8583
  type TsNoFloatingPromises = []|[{
8584
+
8538
8585
  allowForKnownSafePromises?: (string | {
8539
8586
  from: "file"
8540
8587
  name: (string | [string, ...(string)[]])
@@ -8547,6 +8594,7 @@ type TsNoFloatingPromises = []|[{
8547
8594
  name: (string | [string, ...(string)[]])
8548
8595
  package: string
8549
8596
  })[]
8597
+
8550
8598
  allowForKnownSafeCalls?: (string | {
8551
8599
  from: "file"
8552
8600
  name: (string | [string, ...(string)[]])
@@ -8568,7 +8616,9 @@ type TsNoFloatingPromises = []|[{
8568
8616
  }]
8569
8617
  // ----- ts/no-inferrable-types -----
8570
8618
  type TsNoInferrableTypes = []|[{
8619
+
8571
8620
  ignoreParameters?: boolean
8621
+
8572
8622
  ignoreProperties?: boolean
8573
8623
  }]
8574
8624
  // ----- ts/no-invalid-this -----
@@ -8577,7 +8627,9 @@ type TsNoInvalidThis = []|[{
8577
8627
  }]
8578
8628
  // ----- ts/no-invalid-void-type -----
8579
8629
  type TsNoInvalidVoidType = []|[{
8630
+
8580
8631
  allowInGenericTypeArguments?: (boolean | [string, ...(string)[]])
8632
+
8581
8633
  allowAsThisParameter?: boolean
8582
8634
  }]
8583
8635
  // ----- ts/no-magic-numbers -----
@@ -8588,26 +8640,38 @@ type TsNoMagicNumbers = []|[{
8588
8640
  ignoreArrayIndexes?: boolean
8589
8641
  ignoreDefaultValues?: boolean
8590
8642
  ignoreClassFieldInitialValues?: boolean
8643
+
8591
8644
  ignoreNumericLiteralTypes?: boolean
8645
+
8592
8646
  ignoreEnums?: boolean
8647
+
8593
8648
  ignoreReadonlyClassProperties?: boolean
8649
+
8594
8650
  ignoreTypeIndexes?: boolean
8595
8651
  }]
8596
8652
  // ----- ts/no-meaningless-void-operator -----
8597
8653
  type TsNoMeaninglessVoidOperator = []|[{
8654
+
8598
8655
  checkNever?: boolean
8599
8656
  }]
8600
8657
  // ----- ts/no-misused-promises -----
8601
8658
  type TsNoMisusedPromises = []|[{
8602
8659
  checksConditionals?: boolean
8603
8660
  checksVoidReturn?: (boolean | {
8661
+
8604
8662
  arguments?: boolean
8663
+
8605
8664
  attributes?: boolean
8665
+
8606
8666
  inheritedMethods?: boolean
8667
+
8607
8668
  properties?: boolean
8669
+
8608
8670
  returns?: boolean
8671
+
8609
8672
  variables?: boolean
8610
8673
  })
8674
+
8611
8675
  checksSpreads?: boolean
8612
8676
  }]
8613
8677
  // ----- ts/no-namespace -----
@@ -8619,7 +8683,9 @@ type TsNoNamespace = []|[{
8619
8683
  }]
8620
8684
  // ----- ts/no-redeclare -----
8621
8685
  type TsNoRedeclare = []|[{
8686
+
8622
8687
  builtinGlobals?: boolean
8688
+
8623
8689
  ignoreDeclarationMerge?: boolean
8624
8690
  }]
8625
8691
  // ----- ts/no-require-imports -----
@@ -8677,11 +8743,17 @@ type TsNoRestrictedTypes = []|[{
8677
8743
  }]
8678
8744
  // ----- ts/no-shadow -----
8679
8745
  type TsNoShadow = []|[{
8746
+
8680
8747
  builtinGlobals?: boolean
8748
+
8681
8749
  hoist?: ("all" | "functions" | "never")
8750
+
8682
8751
  allow?: string[]
8752
+
8683
8753
  ignoreOnInitialization?: boolean
8754
+
8684
8755
  ignoreTypeValueShadow?: boolean
8756
+
8685
8757
  ignoreFunctionTypeParameterNameValueShadow?: boolean
8686
8758
  }]
8687
8759
  // ----- ts/no-this-alias -----
@@ -8738,24 +8810,40 @@ type TsNoUnusedExpressions = []|[{
8738
8810
  }]
8739
8811
  // ----- ts/no-unused-vars -----
8740
8812
  type TsNoUnusedVars = []|[(("all" | "local") | {
8813
+
8741
8814
  vars?: ("all" | "local")
8815
+
8742
8816
  varsIgnorePattern?: string
8817
+
8743
8818
  args?: ("all" | "after-used" | "none")
8744
- ignoreRestSiblings?: boolean
8819
+
8745
8820
  argsIgnorePattern?: string
8821
+
8746
8822
  caughtErrors?: ("all" | "none")
8823
+
8747
8824
  caughtErrorsIgnorePattern?: string
8825
+
8748
8826
  destructuredArrayIgnorePattern?: string
8827
+
8749
8828
  ignoreClassWithStaticInitBlock?: boolean
8829
+
8830
+ ignoreRestSiblings?: boolean
8831
+
8750
8832
  reportUsedIgnorePattern?: boolean
8751
8833
  })]
8752
8834
  // ----- ts/no-use-before-define -----
8753
8835
  type TsNoUseBeforeDefine = []|[("nofunc" | {
8836
+
8754
8837
  functions?: boolean
8838
+
8755
8839
  classes?: boolean
8840
+
8756
8841
  enums?: boolean
8842
+
8757
8843
  variables?: boolean
8844
+
8758
8845
  typedefs?: boolean
8846
+
8759
8847
  ignoreTypeReferences?: boolean
8760
8848
  allowNamedExports?: boolean
8761
8849
  })]
@@ -8766,12 +8854,16 @@ type TsNoVarRequires = []|[{
8766
8854
  }]
8767
8855
  // ----- ts/only-throw-error -----
8768
8856
  type TsOnlyThrowError = []|[{
8857
+
8769
8858
  allowThrowingAny?: boolean
8859
+
8770
8860
  allowThrowingUnknown?: boolean
8771
8861
  }]
8772
8862
  // ----- ts/parameter-properties -----
8773
8863
  type TsParameterProperties = []|[{
8864
+
8774
8865
  allow?: ("readonly" | "private" | "protected" | "public" | "private readonly" | "protected readonly" | "public readonly")[]
8866
+
8775
8867
  prefer?: ("class-property" | "parameter-property")
8776
8868
  }]
8777
8869
  // ----- ts/prefer-destructuring -----
@@ -8806,13 +8898,18 @@ type TsPreferDestructuring = []|[({
8806
8898
  }]
8807
8899
  // ----- ts/prefer-literal-enum-member -----
8808
8900
  type TsPreferLiteralEnumMember = []|[{
8901
+
8809
8902
  allowBitwiseExpressions?: boolean
8810
8903
  }]
8811
8904
  // ----- ts/prefer-nullish-coalescing -----
8812
8905
  type TsPreferNullishCoalescing = []|[{
8906
+
8813
8907
  allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean
8908
+
8814
8909
  ignoreConditionalTests?: boolean
8910
+
8815
8911
  ignoreMixedLogicalExpressions?: boolean
8912
+
8816
8913
  ignorePrimitives?: ({
8817
8914
  bigint?: boolean
8818
8915
  boolean?: boolean
@@ -8820,6 +8917,7 @@ type TsPreferNullishCoalescing = []|[{
8820
8917
  string?: boolean
8821
8918
  [k: string]: unknown | undefined
8822
8919
  } | true)
8920
+
8823
8921
  ignoreTernaryTests?: boolean
8824
8922
  }]
8825
8923
  // ----- ts/prefer-optional-chain -----
@@ -8843,14 +8941,17 @@ type TsPreferOptionalChain = []|[{
8843
8941
  }]
8844
8942
  // ----- ts/prefer-promise-reject-errors -----
8845
8943
  type TsPreferPromiseRejectErrors = []|[{
8944
+
8846
8945
  allowEmptyReject?: boolean
8847
8946
  }]
8848
8947
  // ----- ts/prefer-readonly -----
8849
8948
  type TsPreferReadonly = []|[{
8949
+
8850
8950
  onlyInlineLambdas?: boolean
8851
8951
  }]
8852
8952
  // ----- ts/prefer-readonly-parameter-types -----
8853
8953
  type TsPreferReadonlyParameterTypes = []|[{
8954
+
8854
8955
  allow?: (string | {
8855
8956
  from: "file"
8856
8957
  name: (string | [string, ...(string)[]])
@@ -8863,8 +8964,11 @@ type TsPreferReadonlyParameterTypes = []|[{
8863
8964
  name: (string | [string, ...(string)[]])
8864
8965
  package: string
8865
8966
  })[]
8967
+
8866
8968
  checkParameterProperties?: boolean
8969
+
8867
8970
  ignoreInferredTypes?: boolean
8971
+
8868
8972
  treatMethodsAsReadonly?: boolean
8869
8973
  }]
8870
8974
  // ----- ts/prefer-string-starts-ends-with -----
@@ -8878,9 +8982,13 @@ type TsPromiseFunctionAsync = []|[{
8878
8982
  allowAny?: boolean
8879
8983
 
8880
8984
  allowedPromiseNames?: string[]
8985
+
8881
8986
  checkArrowFunctions?: boolean
8987
+
8882
8988
  checkFunctionDeclarations?: boolean
8989
+
8883
8990
  checkFunctionExpressions?: boolean
8991
+
8884
8992
  checkMethodDeclarations?: boolean
8885
8993
  }]
8886
8994
  // ----- ts/require-array-sort-compare -----
@@ -8921,7 +9029,7 @@ type TsRestrictTemplateExpressions = []|[{
8921
9029
  allowNever?: boolean
8922
9030
  }]
8923
9031
  // ----- ts/return-await -----
8924
- type TsReturnAwait = []|[("in-try-catch" | "always" | "never" | "error-handling-correctness-only")]
9032
+ type TsReturnAwait = []|[(("always" | "error-handling-correctness-only" | "in-try-catch" | "never") & string)]
8925
9033
  // ----- ts/sort-type-constituents -----
8926
9034
  type TsSortTypeConstituents = []|[{
8927
9035
 
@@ -8935,13 +9043,21 @@ type TsSortTypeConstituents = []|[{
8935
9043
  }]
8936
9044
  // ----- ts/strict-boolean-expressions -----
8937
9045
  type TsStrictBooleanExpressions = []|[{
9046
+
8938
9047
  allowString?: boolean
9048
+
8939
9049
  allowNumber?: boolean
9050
+
8940
9051
  allowNullableObject?: boolean
9052
+
8941
9053
  allowNullableBoolean?: boolean
9054
+
8942
9055
  allowNullableString?: boolean
9056
+
8943
9057
  allowNullableNumber?: boolean
9058
+
8944
9059
  allowNullableEnum?: boolean
9060
+
8945
9061
  allowAny?: boolean
8946
9062
  allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean
8947
9063
  }]
@@ -8954,19 +9070,30 @@ type TsSwitchExhaustivenessCheck = []|[{
8954
9070
  }]
8955
9071
  // ----- ts/triple-slash-reference -----
8956
9072
  type TsTripleSlashReference = []|[{
9073
+
8957
9074
  lib?: ("always" | "never")
9075
+
8958
9076
  path?: ("always" | "never")
9077
+
8959
9078
  types?: ("always" | "never" | "prefer-import")
8960
9079
  }]
8961
9080
  // ----- ts/typedef -----
8962
9081
  type TsTypedef = []|[{
9082
+
8963
9083
  arrayDestructuring?: boolean
9084
+
8964
9085
  arrowParameter?: boolean
9086
+
8965
9087
  memberVariableDeclaration?: boolean
9088
+
8966
9089
  objectDestructuring?: boolean
9090
+
8967
9091
  parameter?: boolean
9092
+
8968
9093
  propertyDeclaration?: boolean
9094
+
8969
9095
  variableDeclaration?: boolean
9096
+
8970
9097
  variableDeclarationIgnoreFunction?: boolean
8971
9098
  }]
8972
9099
  // ----- ts/unbound-method -----