@2digits/eslint-config 2.5.1 → 2.6.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.ts 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.7/packages/eslint/src/rules/type-param-names.ts
13
+ * @see https://github.com/2digits-agency/configs/blob/@2digits/eslint-plugin@2.2.9/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
  /**
@@ -2722,10 +2717,25 @@ Backward pagination arguments
2722
2717
  */
2723
2718
  'react-hooks-extra/no-direct-set-state-in-use-effect'?: Linter.RuleEntry<[]>
2724
2719
  /**
2725
- * disallow direct calls to the 'set' function of 'useState' in 'useLayoutEffect'
2726
- * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-direct-set-state-in-use-layout-effect
2720
+ * disallow direct calls to the 'set' function of 'useState' in 'useEffect'
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
@@ -3846,6 +3861,11 @@ Backward pagination arguments
3846
3861
  * @see https://typescript-eslint.io/rules/no-confusing-void-expression
3847
3862
  */
3848
3863
  'ts/no-confusing-void-expression'?: Linter.RuleEntry<TsNoConfusingVoidExpression>
3864
+ /**
3865
+ * Disallow using code marked as `@deprecated`
3866
+ * @see https://typescript-eslint.io/rules/no-deprecated
3867
+ */
3868
+ 'ts/no-deprecated'?: Linter.RuleEntry<[]>
3849
3869
  /**
3850
3870
  * Disallow duplicate class members
3851
3871
  * @see https://typescript-eslint.io/rules/no-dupe-class-members
@@ -7793,6 +7813,10 @@ type ReactStylePropObject = []|[{
7793
7813
  type RequireAtomicUpdates = []|[{
7794
7814
  allowProperties?: boolean
7795
7815
  }]
7816
+ // ----- require-unicode-regexp -----
7817
+ type RequireUnicodeRegexp = []|[{
7818
+ requireFlag?: ("u" | "v")
7819
+ }]
7796
7820
  // ----- rest-spread-spacing -----
7797
7821
  type RestSpreadSpacing = []|[("always" | "never")]
7798
7822
  // ----- semi -----
@@ -8029,6 +8053,7 @@ type TsBanTsComment = []|[{
8029
8053
  "ts-check"?: (boolean | "allow-with-description" | {
8030
8054
  descriptionFormat?: string
8031
8055
  })
8056
+
8032
8057
  minimumDescriptionLength?: number
8033
8058
  }]
8034
8059
  // ----- ts/class-literal-property-style -----
@@ -8054,29 +8079,41 @@ type TsConsistentReturn = []|[{
8054
8079
  }]
8055
8080
  // ----- ts/consistent-type-assertions -----
8056
8081
  type TsConsistentTypeAssertions = []|[({
8082
+
8057
8083
  assertionStyle: "never"
8058
8084
  } | {
8085
+
8059
8086
  assertionStyle: ("as" | "angle-bracket")
8087
+
8060
8088
  objectLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never")
8061
8089
  })]
8062
8090
  // ----- ts/consistent-type-definitions -----
8063
8091
  type TsConsistentTypeDefinitions = []|[("interface" | "type")]
8064
8092
  // ----- ts/consistent-type-exports -----
8065
8093
  type TsConsistentTypeExports = []|[{
8094
+
8066
8095
  fixMixedExportsWithInlineTypeSpecifier?: boolean
8067
8096
  }]
8068
8097
  // ----- ts/consistent-type-imports -----
8069
8098
  type TsConsistentTypeImports = []|[{
8099
+
8070
8100
  disallowTypeAnnotations?: boolean
8101
+
8071
8102
  fixStyle?: ("separate-type-imports" | "inline-type-imports")
8103
+
8072
8104
  prefer?: ("type-imports" | "no-type-imports")
8073
8105
  }]
8074
8106
  // ----- ts/dot-notation -----
8075
8107
  type TsDotNotation = []|[{
8108
+
8076
8109
  allowKeywords?: boolean
8110
+
8077
8111
  allowPattern?: string
8112
+
8078
8113
  allowPrivateClassPropertyAccess?: boolean
8114
+
8079
8115
  allowProtectedClassPropertyAccess?: boolean
8116
+
8080
8117
  allowIndexSignaturePropertyAccess?: boolean
8081
8118
  }]
8082
8119
  // ----- ts/explicit-function-return-type -----
@@ -8108,6 +8145,7 @@ type TsExplicitMemberAccessibility = []|[{
8108
8145
  properties?: ("explicit" | "no-public" | "off")
8109
8146
  parameterProperties?: ("explicit" | "no-public" | "off")
8110
8147
  }
8148
+
8111
8149
  ignoredMethodNames?: string[]
8112
8150
  }]
8113
8151
  // ----- ts/explicit-module-boundary-types -----
@@ -8129,8 +8167,11 @@ type TsInitDeclarations = ([]|["always"] | []|["never"]|["never", {
8129
8167
  }])
8130
8168
  // ----- ts/max-params -----
8131
8169
  type TsMaxParams = []|[{
8132
- maximum?: number
8170
+
8133
8171
  max?: number
8172
+
8173
+ maximum?: number
8174
+
8134
8175
  countVoidThis?: boolean
8135
8176
  }]
8136
8177
  // ----- ts/member-ordering -----
@@ -8484,30 +8525,40 @@ interface _TsNamingConvention_MatchRegexConfig {
8484
8525
  }
8485
8526
  // ----- ts/no-base-to-string -----
8486
8527
  type TsNoBaseToString = []|[{
8528
+
8487
8529
  ignoredTypeNames?: string[]
8488
8530
  }]
8489
8531
  // ----- ts/no-confusing-void-expression -----
8490
8532
  type TsNoConfusingVoidExpression = []|[{
8533
+
8491
8534
  ignoreArrowShorthand?: boolean
8535
+
8492
8536
  ignoreVoidOperator?: boolean
8493
8537
  }]
8494
8538
  // ----- ts/no-duplicate-type-constituents -----
8495
8539
  type TsNoDuplicateTypeConstituents = []|[{
8540
+
8496
8541
  ignoreIntersections?: boolean
8542
+
8497
8543
  ignoreUnions?: boolean
8498
8544
  }]
8499
8545
  // ----- ts/no-empty-function -----
8500
8546
  type TsNoEmptyFunction = []|[{
8547
+
8501
8548
  allow?: ("functions" | "arrowFunctions" | "generatorFunctions" | "methods" | "generatorMethods" | "getters" | "setters" | "constructors" | "private-constructors" | "protected-constructors" | "asyncFunctions" | "asyncMethods" | "decoratedFunctions" | "overrideMethods")[]
8502
8549
  }]
8503
8550
  // ----- ts/no-empty-interface -----
8504
8551
  type TsNoEmptyInterface = []|[{
8552
+
8505
8553
  allowSingleExtends?: boolean
8506
8554
  }]
8507
8555
  // ----- ts/no-empty-object-type -----
8508
8556
  type TsNoEmptyObjectType = []|[{
8557
+
8509
8558
  allowInterfaces?: ("always" | "never" | "with-single-extends")
8559
+
8510
8560
  allowObjectTypes?: ("always" | "never")
8561
+
8511
8562
  allowWithName?: string
8512
8563
  }]
8513
8564
  // ----- ts/no-explicit-any -----
@@ -8530,6 +8581,7 @@ type TsNoExtraneousClass = []|[{
8530
8581
  }]
8531
8582
  // ----- ts/no-floating-promises -----
8532
8583
  type TsNoFloatingPromises = []|[{
8584
+
8533
8585
  allowForKnownSafePromises?: (string | {
8534
8586
  from: "file"
8535
8587
  name: (string | [string, ...(string)[]])
@@ -8542,6 +8594,7 @@ type TsNoFloatingPromises = []|[{
8542
8594
  name: (string | [string, ...(string)[]])
8543
8595
  package: string
8544
8596
  })[]
8597
+
8545
8598
  allowForKnownSafeCalls?: (string | {
8546
8599
  from: "file"
8547
8600
  name: (string | [string, ...(string)[]])
@@ -8563,7 +8616,9 @@ type TsNoFloatingPromises = []|[{
8563
8616
  }]
8564
8617
  // ----- ts/no-inferrable-types -----
8565
8618
  type TsNoInferrableTypes = []|[{
8619
+
8566
8620
  ignoreParameters?: boolean
8621
+
8567
8622
  ignoreProperties?: boolean
8568
8623
  }]
8569
8624
  // ----- ts/no-invalid-this -----
@@ -8572,7 +8627,9 @@ type TsNoInvalidThis = []|[{
8572
8627
  }]
8573
8628
  // ----- ts/no-invalid-void-type -----
8574
8629
  type TsNoInvalidVoidType = []|[{
8630
+
8575
8631
  allowInGenericTypeArguments?: (boolean | [string, ...(string)[]])
8632
+
8576
8633
  allowAsThisParameter?: boolean
8577
8634
  }]
8578
8635
  // ----- ts/no-magic-numbers -----
@@ -8583,26 +8640,38 @@ type TsNoMagicNumbers = []|[{
8583
8640
  ignoreArrayIndexes?: boolean
8584
8641
  ignoreDefaultValues?: boolean
8585
8642
  ignoreClassFieldInitialValues?: boolean
8643
+
8586
8644
  ignoreNumericLiteralTypes?: boolean
8645
+
8587
8646
  ignoreEnums?: boolean
8647
+
8588
8648
  ignoreReadonlyClassProperties?: boolean
8649
+
8589
8650
  ignoreTypeIndexes?: boolean
8590
8651
  }]
8591
8652
  // ----- ts/no-meaningless-void-operator -----
8592
8653
  type TsNoMeaninglessVoidOperator = []|[{
8654
+
8593
8655
  checkNever?: boolean
8594
8656
  }]
8595
8657
  // ----- ts/no-misused-promises -----
8596
8658
  type TsNoMisusedPromises = []|[{
8597
8659
  checksConditionals?: boolean
8598
8660
  checksVoidReturn?: (boolean | {
8661
+
8599
8662
  arguments?: boolean
8663
+
8600
8664
  attributes?: boolean
8665
+
8601
8666
  inheritedMethods?: boolean
8667
+
8602
8668
  properties?: boolean
8669
+
8603
8670
  returns?: boolean
8671
+
8604
8672
  variables?: boolean
8605
8673
  })
8674
+
8606
8675
  checksSpreads?: boolean
8607
8676
  }]
8608
8677
  // ----- ts/no-namespace -----
@@ -8614,7 +8683,9 @@ type TsNoNamespace = []|[{
8614
8683
  }]
8615
8684
  // ----- ts/no-redeclare -----
8616
8685
  type TsNoRedeclare = []|[{
8686
+
8617
8687
  builtinGlobals?: boolean
8688
+
8618
8689
  ignoreDeclarationMerge?: boolean
8619
8690
  }]
8620
8691
  // ----- ts/no-require-imports -----
@@ -8672,11 +8743,17 @@ type TsNoRestrictedTypes = []|[{
8672
8743
  }]
8673
8744
  // ----- ts/no-shadow -----
8674
8745
  type TsNoShadow = []|[{
8746
+
8675
8747
  builtinGlobals?: boolean
8748
+
8676
8749
  hoist?: ("all" | "functions" | "never")
8750
+
8677
8751
  allow?: string[]
8752
+
8678
8753
  ignoreOnInitialization?: boolean
8754
+
8679
8755
  ignoreTypeValueShadow?: boolean
8756
+
8680
8757
  ignoreFunctionTypeParameterNameValueShadow?: boolean
8681
8758
  }]
8682
8759
  // ----- ts/no-this-alias -----
@@ -8733,24 +8810,40 @@ type TsNoUnusedExpressions = []|[{
8733
8810
  }]
8734
8811
  // ----- ts/no-unused-vars -----
8735
8812
  type TsNoUnusedVars = []|[(("all" | "local") | {
8813
+
8736
8814
  vars?: ("all" | "local")
8815
+
8737
8816
  varsIgnorePattern?: string
8817
+
8738
8818
  args?: ("all" | "after-used" | "none")
8739
- ignoreRestSiblings?: boolean
8819
+
8740
8820
  argsIgnorePattern?: string
8821
+
8741
8822
  caughtErrors?: ("all" | "none")
8823
+
8742
8824
  caughtErrorsIgnorePattern?: string
8825
+
8743
8826
  destructuredArrayIgnorePattern?: string
8827
+
8744
8828
  ignoreClassWithStaticInitBlock?: boolean
8829
+
8830
+ ignoreRestSiblings?: boolean
8831
+
8745
8832
  reportUsedIgnorePattern?: boolean
8746
8833
  })]
8747
8834
  // ----- ts/no-use-before-define -----
8748
8835
  type TsNoUseBeforeDefine = []|[("nofunc" | {
8836
+
8749
8837
  functions?: boolean
8838
+
8750
8839
  classes?: boolean
8840
+
8751
8841
  enums?: boolean
8842
+
8752
8843
  variables?: boolean
8844
+
8753
8845
  typedefs?: boolean
8846
+
8754
8847
  ignoreTypeReferences?: boolean
8755
8848
  allowNamedExports?: boolean
8756
8849
  })]
@@ -8761,12 +8854,16 @@ type TsNoVarRequires = []|[{
8761
8854
  }]
8762
8855
  // ----- ts/only-throw-error -----
8763
8856
  type TsOnlyThrowError = []|[{
8857
+
8764
8858
  allowThrowingAny?: boolean
8859
+
8765
8860
  allowThrowingUnknown?: boolean
8766
8861
  }]
8767
8862
  // ----- ts/parameter-properties -----
8768
8863
  type TsParameterProperties = []|[{
8864
+
8769
8865
  allow?: ("readonly" | "private" | "protected" | "public" | "private readonly" | "protected readonly" | "public readonly")[]
8866
+
8770
8867
  prefer?: ("class-property" | "parameter-property")
8771
8868
  }]
8772
8869
  // ----- ts/prefer-destructuring -----
@@ -8801,13 +8898,18 @@ type TsPreferDestructuring = []|[({
8801
8898
  }]
8802
8899
  // ----- ts/prefer-literal-enum-member -----
8803
8900
  type TsPreferLiteralEnumMember = []|[{
8901
+
8804
8902
  allowBitwiseExpressions?: boolean
8805
8903
  }]
8806
8904
  // ----- ts/prefer-nullish-coalescing -----
8807
8905
  type TsPreferNullishCoalescing = []|[{
8906
+
8808
8907
  allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean
8908
+
8809
8909
  ignoreConditionalTests?: boolean
8910
+
8810
8911
  ignoreMixedLogicalExpressions?: boolean
8912
+
8811
8913
  ignorePrimitives?: ({
8812
8914
  bigint?: boolean
8813
8915
  boolean?: boolean
@@ -8815,6 +8917,7 @@ type TsPreferNullishCoalescing = []|[{
8815
8917
  string?: boolean
8816
8918
  [k: string]: unknown | undefined
8817
8919
  } | true)
8920
+
8818
8921
  ignoreTernaryTests?: boolean
8819
8922
  }]
8820
8923
  // ----- ts/prefer-optional-chain -----
@@ -8838,14 +8941,17 @@ type TsPreferOptionalChain = []|[{
8838
8941
  }]
8839
8942
  // ----- ts/prefer-promise-reject-errors -----
8840
8943
  type TsPreferPromiseRejectErrors = []|[{
8944
+
8841
8945
  allowEmptyReject?: boolean
8842
8946
  }]
8843
8947
  // ----- ts/prefer-readonly -----
8844
8948
  type TsPreferReadonly = []|[{
8949
+
8845
8950
  onlyInlineLambdas?: boolean
8846
8951
  }]
8847
8952
  // ----- ts/prefer-readonly-parameter-types -----
8848
8953
  type TsPreferReadonlyParameterTypes = []|[{
8954
+
8849
8955
  allow?: (string | {
8850
8956
  from: "file"
8851
8957
  name: (string | [string, ...(string)[]])
@@ -8858,8 +8964,11 @@ type TsPreferReadonlyParameterTypes = []|[{
8858
8964
  name: (string | [string, ...(string)[]])
8859
8965
  package: string
8860
8966
  })[]
8967
+
8861
8968
  checkParameterProperties?: boolean
8969
+
8862
8970
  ignoreInferredTypes?: boolean
8971
+
8863
8972
  treatMethodsAsReadonly?: boolean
8864
8973
  }]
8865
8974
  // ----- ts/prefer-string-starts-ends-with -----
@@ -8873,9 +8982,13 @@ type TsPromiseFunctionAsync = []|[{
8873
8982
  allowAny?: boolean
8874
8983
 
8875
8984
  allowedPromiseNames?: string[]
8985
+
8876
8986
  checkArrowFunctions?: boolean
8987
+
8877
8988
  checkFunctionDeclarations?: boolean
8989
+
8878
8990
  checkFunctionExpressions?: boolean
8991
+
8879
8992
  checkMethodDeclarations?: boolean
8880
8993
  }]
8881
8994
  // ----- ts/require-array-sort-compare -----
@@ -8916,7 +9029,7 @@ type TsRestrictTemplateExpressions = []|[{
8916
9029
  allowNever?: boolean
8917
9030
  }]
8918
9031
  // ----- ts/return-await -----
8919
- type TsReturnAwait = []|[("in-try-catch" | "always" | "never" | "error-handling-correctness-only")]
9032
+ type TsReturnAwait = []|[(("always" | "error-handling-correctness-only" | "in-try-catch" | "never") & string)]
8920
9033
  // ----- ts/sort-type-constituents -----
8921
9034
  type TsSortTypeConstituents = []|[{
8922
9035
 
@@ -8930,13 +9043,21 @@ type TsSortTypeConstituents = []|[{
8930
9043
  }]
8931
9044
  // ----- ts/strict-boolean-expressions -----
8932
9045
  type TsStrictBooleanExpressions = []|[{
9046
+
8933
9047
  allowString?: boolean
9048
+
8934
9049
  allowNumber?: boolean
9050
+
8935
9051
  allowNullableObject?: boolean
9052
+
8936
9053
  allowNullableBoolean?: boolean
9054
+
8937
9055
  allowNullableString?: boolean
9056
+
8938
9057
  allowNullableNumber?: boolean
9058
+
8939
9059
  allowNullableEnum?: boolean
9060
+
8940
9061
  allowAny?: boolean
8941
9062
  allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean
8942
9063
  }]
@@ -8949,19 +9070,30 @@ type TsSwitchExhaustivenessCheck = []|[{
8949
9070
  }]
8950
9071
  // ----- ts/triple-slash-reference -----
8951
9072
  type TsTripleSlashReference = []|[{
9073
+
8952
9074
  lib?: ("always" | "never")
9075
+
8953
9076
  path?: ("always" | "never")
9077
+
8954
9078
  types?: ("always" | "never" | "prefer-import")
8955
9079
  }]
8956
9080
  // ----- ts/typedef -----
8957
9081
  type TsTypedef = []|[{
9082
+
8958
9083
  arrayDestructuring?: boolean
9084
+
8959
9085
  arrowParameter?: boolean
9086
+
8960
9087
  memberVariableDeclaration?: boolean
9088
+
8961
9089
  objectDestructuring?: boolean
9090
+
8962
9091
  parameter?: boolean
9092
+
8963
9093
  propertyDeclaration?: boolean
9094
+
8964
9095
  variableDeclaration?: boolean
9096
+
8965
9097
  variableDeclarationIgnoreFunction?: boolean
8966
9098
  }]
8967
9099
  // ----- ts/unbound-method -----
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import T from 'globals';
9
9
  import { findUp } from 'find-up';
10
10
  import { isPackageExists } from 'local-pkg';
11
11
 
12
- function C(){return [{name:"2digits:comments",plugins:{"eslint-comments":w},rules:{"eslint-comments/no-aggregating-enable":"error","eslint-comments/no-duplicate-disable":"error","eslint-comments/no-unlimited-disable":"error","eslint-comments/no-unused-enable":"error","eslint-comments/no-unused-disable":"error"}}]}var p={"@next/next":"next","@eslint-react/naming-convention":"react-naming-convention","@eslint-react/hooks-extra":"react-hooks-extra","@eslint-react/dom":"react-dom","@eslint-react/web-api":"react-web-api","@eslint-react":"react-extra","react-hooks":"react-hooks","react-compiler":"react-compiler",react:"react","@typescript-eslint":"ts",node:"node","eslint-comments":"eslint-comments",storybook:"storybook",turbo:"turbo",jsdoc:"jsdoc",unicorn:"unicorn",tailwindcss:"tailwindcss","@tanstack/query":"tanstack","@2digits":"@2digits","@graphql-eslint":"gql",sonarjs:"sonar"};async function o(e){let t=await e;return t.default||t}async function j(e={}){let{overrides:t={},files:r=["**/*.graphql","**/*.gql"]}=e,a=await o(import('@graphql-eslint/eslint-plugin')),i=renamePluginsInRules(a.flatConfigs["operations-recommended"].rules,p);return [{name:"2digits:graphql",plugins:{gql:fixupPluginRules(a)},languageOptions:{parser:{...a,meta:{name:"graphql"}}},files:r,rules:{...i,...t}}]}var S="**/*.?([cm])[jt]s?(x)",b="**/*.?([cm])ts",h="**/*.?([cm])tsx",F="**/*.stories.tsx",I=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts"];async function P(e={}){let{gitIgnore:t,ignores:r=[]}=e;return composer({ignores:[I,r].flat(),name:"2digits:ignores"},o(import('eslint-config-flat-gitignore')).then(a=>({...a(t),name:"2digits:gitignore"})))}function _(e={}){let{overrides:t={}}=e;return [{name:"2digits:javascript",languageOptions:{ecmaVersion:2022,globals:{...T.browser,...T.es2021,...T.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{reportUnusedDisableDirectives:!0},rules:{...K.configs.recommended.rules,"accessor-pairs":["error",{enforceForClassMembers:!0,setWithoutGet:!0}],"array-callback-return":"error","block-scoped-var":"error","constructor-super":"error","default-case-last":"error","dot-notation":["error",{allowKeywords:!0}],eqeqeq:["error","smart"],"new-cap":["error",{capIsNew:!1,newIsCap:!0,properties:!0}],"no-alert":"error","no-array-constructor":"error","no-async-promise-executor":"error","no-caller":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":["error","always"],"no-const-assign":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-dupe-args":"error","no-dupe-class-members":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":["error",{allowEmptyCatch:!0}],"no-empty-character-class":"error","no-empty-pattern":"error","no-eval":"error","no-ex-assign":"error","no-extend-native":"error","no-extra-bind":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-implied-eval":"error","no-import-assign":"error","no-invalid-regexp":"error","no-irregular-whitespace":"error","no-iterator":"error","no-labels":["error",{allowLoop:!1,allowSwitch:!1}],"no-lone-blocks":"error","no-loss-of-precision":"error","no-misleading-character-class":"error","no-multi-str":"error","no-new":"error","no-new-func":"error","no-new-native-nonconstructor":"error","no-new-wrappers":"error","no-obj-calls":"error","no-octal":"error","no-octal-escape":"error","no-proto":"error","no-prototype-builtins":"error","no-redeclare":["error",{builtinGlobals:!1}],"no-regex-spaces":"error","no-restricted-globals":["error",{message:"Use `globalThis` instead.",name:"global"},{message:"Use `globalThis` instead.",name:"self"}],"no-restricted-properties":["error",{message:"Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",property:"__proto__"},{message:"Use `Object.defineProperty` instead.",property:"__defineGetter__"},{message:"Use `Object.defineProperty` instead.",property:"__defineSetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupGetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupSetter__"}],"no-restricted-syntax":["error","DebuggerStatement","LabeledStatement","WithStatement","TSEnumDeclaration","TSExportAssignment"],"no-self-assign":["error",{props:!0}],"no-self-compare":"error","no-sequences":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-template-curly-in-string":"error","no-this-before-super":"error","no-throw-literal":"error","no-undef":"error","no-undef-init":"error","no-unexpected-multiline":"error","no-unmodified-loop-condition":"error","no-unneeded-ternary":["error",{defaultAssignment:!1}],"no-unreachable":"error","no-unreachable-loop":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unused-expressions":["error",{allowShortCircuit:!0,allowTaggedTemplates:!0,allowTernary:!0}],"no-unused-vars":["error",{args:"none",caughtErrors:"none",ignoreRestSiblings:!0,vars:"all"}],"no-useless-backreference":"error","no-useless-call":"error","no-useless-catch":"error","no-useless-computed-key":"error","no-useless-constructor":"error","no-useless-rename":"error","no-var":"error","no-with":"error","object-shorthand":["error","always",{avoidQuotes:!0,ignoreConstructors:!1}],"one-var":["error",{initialized:"never"}],"prefer-arrow-callback":["error",{allowNamedFunctions:!0,allowUnboundThis:!0}],"prefer-const":["error",{destructuring:"all",ignoreReadBeforeAssign:!0}],"prefer-exponentiation-operator":"error","prefer-promise-reject-errors":"error","prefer-regex-literals":["error",{disallowRedundantWrapping:!0}],"prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error","symbol-description":"error","unicode-bom":["error","never"],"use-isnan":["error",{enforceForIndexOf:!0,enforceForSwitchCase:!0}],"valid-typeof":["error",{requireStringLiterals:!0}],"vars-on-top":"error",yoda:["error","never"],...t}}]}async function q(){return [{name:"2digits:jsdoc",plugins:{jsdoc:await o(import('eslint-plugin-jsdoc'))},rules:{"jsdoc/check-access":"error","jsdoc/check-param-names":"error","jsdoc/check-property-names":"error","jsdoc/check-types":"error","jsdoc/empty-tags":"error","jsdoc/implements-on-classes":"error","jsdoc/no-defaults":"error","jsdoc/no-multi-asterisks":"error","jsdoc/require-param-name":"error","jsdoc/require-property":"error","jsdoc/require-property-description":"error","jsdoc/require-property-name":"error","jsdoc/require-returns-check":"error","jsdoc/require-returns-description":"error","jsdoc/require-yields-check":"error"}}]}async function W(e={}){let{files:t=[b,h],overrides:r={},parserOptions:a}=e,[i,c]=await Promise.all([o(import('@next/eslint-plugin-next')),o(import('@typescript-eslint/parser'))]),m=renamePluginsInRules({...i.configs.recommended.rules,...i.configs["core-web-vitals"].rules},p);return [{name:"2digits:next/setup",plugins:{next:fixupPluginRules(i)}},{name:"2digits:next/rules",files:t,languageOptions:{parser:c,parserOptions:{ecmaFeatures:{jsx:!0},projectService:!0,...a},sourceType:"module"},rules:{...m,"next/no-html-link-for-pages":"off",...r}}]}function D(){return [{name:"2digits:node",settings:{node:{version:">= 20.0.0"}},plugins:{node:v},rules:{"node/handle-callback-err":["error","^(err|error)$"],"node/no-deprecated-api":"error","node/no-exports-assign":"error","node/no-new-require":"error","node/no-path-concat":"error","node/no-unsupported-features/node-builtins":["error",{allowExperimental:!0}],"node/prefer-global/buffer":"error","node/prefer-global/process":"error","node/prefer-global/text-encoder":"error","node/prefer-global/url":"error","node/prefer-global/console":"error","node/prefer-global/url-search-params":"error","node/prefer-global/text-decoder":"error","node/process-exit-as-throw":"error"}}]}async function R(){let[e,t]=await Promise.all([o(import('eslint-config-prettier')),o(import('eslint-plugin-react'))]);return [{name:"2digits:prettier",plugins:{react:t},rules:{...e.rules,"tailwindcss/classnames-order":"off","react/jsx-newline":["error",{prevent:!1}]}}]}async function L(e={}){let{files:t=[b,h],overrides:r={},parserOptions:a,tsconfigRootDir:i,reactCompiler:c=!0}=e,[m,f,g,O,X]=await Promise.all([o(import('@eslint-react/eslint-plugin')),o(import('eslint-plugin-react-hooks')),o(import('eslint-plugin-react')),o(import('@typescript-eslint/parser')),c?o(import('eslint-plugin-react-compiler')):void 0]),y=m.configs.all.plugins,z=renamePluginsInRules({...g.configs.recommended.rules,...g.configs["jsx-runtime"].rules,...f.configs.recommended.rules,...m.configs["recommended-type-checked"].rules},p);return [{name:"2digits:react/setup",plugins:{react:g,"react-dom":y["@eslint-react/dom"],"react-web-api":y["@eslint-react/web-api"],"react-extra":y["@eslint-react"],"react-hooks":fixupPluginRules(f),"react-hooks-extra":y["@eslint-react/hooks-extra"],"react-naming-convention":y["@eslint-react/naming-convention"],...c?{"react-compiler":X}:{}},settings:{react:{version:"detect"}}},{name:"2digits:react/rules",files:t,languageOptions:{parser:O,parserOptions:{ecmaFeatures:{jsx:!0},tsconfigRootDir:i,projectService:!0,...a},sourceType:"module"},rules:{...z,...c?{"react-compiler/react-compiler":"error"}:{},"react-hooks-extra/ensure-use-memo-has-non-empty-deps":"error","react-hooks-extra/prefer-use-state-lazy-initialization":"error","react-hooks-extra/ensure-custom-hooks-using-other-hooks":"error","react-hooks-extra/ensure-use-callback-has-non-empty-deps":"error","react/jsx-curly-newline":"off","react/jsx-newline":["error",{prevent:!1}],"react/prop-types":"off",...r}}]}var re=renamePluginsInRules(k.configs.recommended.rules,p);function E(){return [{name:"2digits:sonar",plugins:{sonar:k},rules:{...re,"sonar/no-redundant-jump":"off"}}]}async function G(e={}){let{files:t=[F],overrides:r={},parserOptions:a,storybookDirectory:i=".storybook"}=e,[c,m]=await Promise.all([o(import('eslint-plugin-storybook')),o(import('@typescript-eslint/parser'))]),f={parser:m,parserOptions:{ecmaFeatures:{jsx:!0},projectService:!0,...a},sourceType:"module"};return [{name:"2digits:storybook/setup",plugins:{storybook:fixupPluginRules(c)}},{name:"2digits:storybook/rules",files:t,languageOptions:f,rules:{"storybook/await-interactions":"error","storybook/context-in-play-function":"error","storybook/csf-component":"error","storybook/default-exports":"error","storybook/hierarchy-separator":"error","storybook/no-redundant-story-name":"error","storybook/no-stories-of":"error","storybook/no-title-property-in-meta":"error","storybook/prefer-pascal-case":"error","storybook/story-exports":"error","storybook/use-storybook-expect":"error","storybook/use-storybook-testing-library":"error",...r}},{name:"2digits:storybook/disables",files:t,rules:{"react-hooks/rules-of-hooks":"off","react/display-name":"off"}},{name:"2digits:storybook/config",files:[`${i}/main.@(js|cjs|mjs|ts)`],languageOptions:f,rules:{"storybook/no-uninstalled-addons":"error"}}]}async function N(e={}){let{overrides:t={}}=e,[r,{tailwindFunctions:a},i]=await Promise.all([o(import('eslint-plugin-tailwindcss')),o(import('@2digits/constants')),findUp(["tailwind.config.ts","tailwind.config.js"])]);return [{name:"2digits:tailwind",plugins:{tailwindcss:r},settings:{tailwindcss:{callees:a,config:i}},rules:{...r.configs.recommended.rules,...t}}]}async function U(e={}){let{overrides:t={}}=e,r=await o(import('@tanstack/eslint-plugin-query'));return [{name:"2digits:tanstack",plugins:{tanstack:fixupPluginRules(r)},rules:{"tanstack/exhaustive-deps":"error","tanstack/stable-query-client":"error","tanstack/no-rest-destructuring":"error",...t}}]}async function B(e={}){let{overrides:t={}}=e;return [{name:"2digits:turbo",plugins:{turbo:await o(import('eslint-plugin-turbo'))},rules:{"turbo/no-undeclared-env-vars":"error",...t}}]}async function A(e={}){let{overrides:t={},parserOptions:r={}}=e,[{plugin:a,configs:i,parser:c},m]=await Promise.all([o(import('typescript-eslint')),o(import('@2digits/eslint-plugin'))]),f=renamePluginsInConfigs(i.strictTypeChecked,p),g=Object.fromEntries(f.flatMap(({rules:O})=>Object.entries(O??{})));return [{name:"2digits:typescript/setup",plugins:{ts:a,"@2digits":m},languageOptions:{parser:c,parserOptions:{tsconfigRootDir:process.cwd(),projectService:!0,...r},sourceType:"module"}},{name:"2digits:typescript/rules",files:[S],rules:{...g,"ts/restrict-template-expressions":["error",{allowNumber:!0}],"ts/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"ts/consistent-type-exports":["error"],"ts/consistent-type-imports":["error",{prefer:"type-imports",disallowTypeAnnotations:!1,fixStyle:"inline-type-imports"}],"ts/no-empty-interface":["error",{allowSingleExtends:!0}],"ts/no-explicit-any":["error"],"ts/no-import-type-side-effects":["error"],"ts/no-misused-promises":"off","ts/no-confusing-void-expression":"off","ts/no-unused-vars":["error",{ignoreRestSiblings:!0,argsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"ts/unbound-method":"off",...m.configs.recommended.rules,...t}},{files:["**/*.d.ts"],name:"2digits:typescript/disables/dts",rules:{"unicorn/no-abusive-eslint-disable":"off","no-duplicate-imports":"off","no-restricted-syntax":"off","ts/no-unused-vars":"off"}},{files:["**/*.{test,spec}.ts?(x)"],name:"2digits:typescript/disables/test",rules:{"no-unused-expressions":"off"}},{files:["**/*.js","**/*.cjs","**/*.cts"],name:"2digits:typescript/disables/cjs",rules:{"ts/no-require-imports":"off","ts/no-var-requires":"off"}}]}function M(){return [{name:"2digits:unicorn",plugins:{unicorn:x},rules:{...x.configs["flat/recommended"].rules,"unicorn/filename-case":["off"],"unicorn/prefer-module":["off"],"unicorn/prevent-abbreviations":["off"],"unicorn/prefer-ternary":["error","only-single-line"],"unicorn/no-useless-undefined":["error",{checkArguments:!1,checkArrowFunctionBody:!1}],"unicorn/prefer-top-level-await":["off"]}}]}function d(e,t){return typeof e=="boolean"?e:e?.enable??t??!1}function u(e){if(typeof e=="boolean"||e===void 0)return {};let{enable:t,...r}=e;return r}function ae(e={},...t){let r=new FlatConfigComposer(P(e.ignores),_(e.js),D(),C(),q(),M(),E());d(e.turbo,isPackageExists("turbo"))&&(r=r.append(B(u(e.turbo))));let{overrides:a,...i}=u(e.ts);return d(e.ts,isPackageExists("typescript"))&&(r=r.append(A(u(e.ts)))),d(e.react,isPackageExists("react"))&&(r=r.append(L({...u(e.react),...i}))),d(e.next,isPackageExists("next"))&&(r=r.append(W({...u(e.next),...i}))),d(e.storybook,isPackageExists("storybook"))&&(r=r.append(G({...u(e.storybook),...i}))),d(e.tailwind,isPackageExists("tailwindcss"))&&(r=r.append(N(u(e.tailwind)))),d(e.tanstack,isPackageExists("react-query")||isPackageExists("@tanstack/react-query")||isPackageExists("@tanstack/react-query-devtools"))&&(r=r.append(U(u(e.tanstack)))),d(e.graphql,isPackageExists("graphql"))&&(r=r.append(j(u(e.graphql)))),r=r.append(...t),isPackageExists("prettier")&&(r=r.append(R())),r.renamePlugins(p).toConfigs()}
12
+ function C(){return [{name:"2digits:comments",plugins:{"eslint-comments":w},rules:{"eslint-comments/no-aggregating-enable":"error","eslint-comments/no-duplicate-disable":"error","eslint-comments/no-unlimited-disable":"error","eslint-comments/no-unused-enable":"error","eslint-comments/no-unused-disable":"error"}}]}var p={"@next/next":"next","@eslint-react/naming-convention":"react-naming-convention","@eslint-react/hooks-extra":"react-hooks-extra","@eslint-react/dom":"react-dom","@eslint-react/web-api":"react-web-api","@eslint-react":"react-extra","react-hooks":"react-hooks","react-compiler":"react-compiler",react:"react","@typescript-eslint":"ts",node:"node","eslint-comments":"eslint-comments",storybook:"storybook",turbo:"turbo",jsdoc:"jsdoc",unicorn:"unicorn",tailwindcss:"tailwindcss","@tanstack/query":"tanstack","@2digits":"@2digits","@graphql-eslint":"gql",sonarjs:"sonar"};async function o(e){let t=await e;return t.default||t}async function j(e={}){let{overrides:t={},files:r=["**/*.graphql","**/*.gql"]}=e,a=await o(import('@graphql-eslint/eslint-plugin')),i=renamePluginsInRules(a.flatConfigs["operations-recommended"].rules,p);return [{name:"2digits:graphql",plugins:{gql:fixupPluginRules(a)},languageOptions:{parser:{...a,meta:{name:"graphql"}}},files:r,rules:{...i,...t}}]}var S="**/*.?([cm])[jt]s?(x)",b="**/*.?([cm])ts",h="**/*.?([cm])tsx",F="**/*.stories.tsx",I=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts"];async function P(e={}){let{gitIgnore:t,ignores:r=[]}=e;return composer({ignores:[I,r].flat(),name:"2digits:ignores"},o(import('eslint-config-flat-gitignore')).then(a=>a({strict:!1,...t,name:"2digits:gitignore"})))}function _(e={}){let{overrides:t={}}=e;return [{name:"2digits:javascript",languageOptions:{ecmaVersion:2022,globals:{...T.browser,...T.es2021,...T.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{reportUnusedDisableDirectives:!0},rules:{...K.configs.recommended.rules,"accessor-pairs":["error",{enforceForClassMembers:!0,setWithoutGet:!0}],"array-callback-return":"error","block-scoped-var":"error","constructor-super":"error","default-case-last":"error","dot-notation":["error",{allowKeywords:!0}],eqeqeq:["error","smart"],"new-cap":["error",{capIsNew:!1,newIsCap:!0,properties:!0}],"no-alert":"error","no-array-constructor":"error","no-async-promise-executor":"error","no-caller":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":["error","always"],"no-const-assign":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-dupe-args":"error","no-dupe-class-members":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":["error",{allowEmptyCatch:!0}],"no-empty-character-class":"error","no-empty-pattern":"error","no-eval":"error","no-ex-assign":"error","no-extend-native":"error","no-extra-bind":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-implied-eval":"error","no-import-assign":"error","no-invalid-regexp":"error","no-irregular-whitespace":"error","no-iterator":"error","no-labels":["error",{allowLoop:!1,allowSwitch:!1}],"no-lone-blocks":"error","no-loss-of-precision":"error","no-misleading-character-class":"error","no-multi-str":"error","no-new":"error","no-new-func":"error","no-new-native-nonconstructor":"error","no-new-wrappers":"error","no-obj-calls":"error","no-octal":"error","no-octal-escape":"error","no-proto":"error","no-prototype-builtins":"error","no-redeclare":["error",{builtinGlobals:!1}],"no-regex-spaces":"error","no-restricted-globals":["error",{message:"Use `globalThis` instead.",name:"global"},{message:"Use `globalThis` instead.",name:"self"}],"no-restricted-properties":["error",{message:"Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",property:"__proto__"},{message:"Use `Object.defineProperty` instead.",property:"__defineGetter__"},{message:"Use `Object.defineProperty` instead.",property:"__defineSetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupGetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupSetter__"}],"no-restricted-syntax":["error","DebuggerStatement","LabeledStatement","WithStatement","TSEnumDeclaration","TSExportAssignment"],"no-self-assign":["error",{props:!0}],"no-self-compare":"error","no-sequences":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-template-curly-in-string":"error","no-this-before-super":"error","no-throw-literal":"error","no-undef":"error","no-undef-init":"error","no-unexpected-multiline":"error","no-unmodified-loop-condition":"error","no-unneeded-ternary":["error",{defaultAssignment:!1}],"no-unreachable":"error","no-unreachable-loop":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unused-expressions":["error",{allowShortCircuit:!0,allowTaggedTemplates:!0,allowTernary:!0}],"no-unused-vars":["error",{args:"none",caughtErrors:"none",ignoreRestSiblings:!0,vars:"all"}],"no-useless-backreference":"error","no-useless-call":"error","no-useless-catch":"error","no-useless-computed-key":"error","no-useless-constructor":"error","no-useless-rename":"error","no-var":"error","no-with":"error","object-shorthand":["error","always",{avoidQuotes:!0,ignoreConstructors:!1}],"one-var":["error",{initialized:"never"}],"prefer-arrow-callback":["error",{allowNamedFunctions:!0,allowUnboundThis:!0}],"prefer-const":["error",{destructuring:"all",ignoreReadBeforeAssign:!0}],"prefer-exponentiation-operator":"error","prefer-promise-reject-errors":"error","prefer-regex-literals":["error",{disallowRedundantWrapping:!0}],"prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error","symbol-description":"error","unicode-bom":["error","never"],"use-isnan":["error",{enforceForIndexOf:!0,enforceForSwitchCase:!0}],"valid-typeof":["error",{requireStringLiterals:!0}],"vars-on-top":"error",yoda:["error","never"],...t}}]}async function q(){return [{name:"2digits:jsdoc",plugins:{jsdoc:await o(import('eslint-plugin-jsdoc'))},rules:{"jsdoc/check-access":"error","jsdoc/check-param-names":"error","jsdoc/check-property-names":"error","jsdoc/check-types":"error","jsdoc/empty-tags":"error","jsdoc/implements-on-classes":"error","jsdoc/no-defaults":"error","jsdoc/no-multi-asterisks":"error","jsdoc/require-param-name":"error","jsdoc/require-property":"error","jsdoc/require-property-description":"error","jsdoc/require-property-name":"error","jsdoc/require-returns-check":"error","jsdoc/require-returns-description":"error","jsdoc/require-yields-check":"error"}}]}async function W(e={}){let{files:t=[b,h],overrides:r={},parserOptions:a}=e,[i,c]=await Promise.all([o(import('@next/eslint-plugin-next')),o(import('@typescript-eslint/parser'))]),m=renamePluginsInRules({...i.configs.recommended.rules,...i.configs["core-web-vitals"].rules},p);return [{name:"2digits:next/setup",plugins:{next:fixupPluginRules(i)}},{name:"2digits:next/rules",files:t,languageOptions:{parser:c,parserOptions:{ecmaFeatures:{jsx:!0},projectService:!0,...a},sourceType:"module"},rules:{...m,"next/no-html-link-for-pages":"off",...r}}]}function D(){return [{name:"2digits:node",settings:{node:{version:">= 20.0.0"}},plugins:{node:v},rules:{"node/handle-callback-err":["error","^(err|error)$"],"node/no-deprecated-api":"error","node/no-exports-assign":"error","node/no-new-require":"error","node/no-path-concat":"error","node/no-unsupported-features/node-builtins":["error",{allowExperimental:!0}],"node/prefer-global/buffer":"error","node/prefer-global/process":"error","node/prefer-global/text-encoder":"error","node/prefer-global/url":"error","node/prefer-global/console":"error","node/prefer-global/url-search-params":"error","node/prefer-global/text-decoder":"error","node/process-exit-as-throw":"error"}}]}async function R(){let[e,t]=await Promise.all([o(import('eslint-config-prettier')),o(import('eslint-plugin-react'))]);return [{name:"2digits:prettier",plugins:{react:t},rules:{...e.rules,"tailwindcss/classnames-order":"off","react/jsx-newline":["error",{prevent:!1}]}}]}async function L(e={}){let{files:t=[b,h],overrides:r={},parserOptions:a,tsconfigRootDir:i,reactCompiler:c=!0}=e,[m,f,g,O,X]=await Promise.all([o(import('@eslint-react/eslint-plugin')),o(import('eslint-plugin-react-hooks')),o(import('eslint-plugin-react')),o(import('@typescript-eslint/parser')),c?o(import('eslint-plugin-react-compiler')):void 0]),y=m.configs.all.plugins,z=renamePluginsInRules({...g.configs.recommended.rules,...g.configs["jsx-runtime"].rules,...f.configs.recommended.rules,...m.configs["recommended-type-checked"].rules},p);return [{name:"2digits:react/setup",plugins:{react:g,"react-dom":y["@eslint-react/dom"],"react-web-api":y["@eslint-react/web-api"],"react-extra":y["@eslint-react"],"react-hooks":fixupPluginRules(f),"react-hooks-extra":y["@eslint-react/hooks-extra"],"react-naming-convention":y["@eslint-react/naming-convention"],...c?{"react-compiler":X}:{}},settings:{react:{version:"detect"}}},{name:"2digits:react/rules",files:t,languageOptions:{parser:O,parserOptions:{ecmaFeatures:{jsx:!0},tsconfigRootDir:i,projectService:!0,...a},sourceType:"module"},rules:{...z,...c?{"react-compiler/react-compiler":"error"}:{},"react-hooks-extra/no-unnecessary-use-callback":"error","react-hooks-extra/prefer-use-state-lazy-initialization":"error","react-hooks-extra/no-redundant-custom-hook":"error","react-hooks-extra/no-unnecessary-use-memo":"error","react/jsx-curly-newline":"off","react/jsx-newline":["error",{prevent:!1}],"react/prop-types":"off",...r}}]}var re=renamePluginsInRules(k.configs.recommended.rules,p);function E(){return [{name:"2digits:sonar",plugins:{sonar:k},rules:{...re,"sonar/no-redundant-jump":"off"}}]}async function G(e={}){let{files:t=[F],overrides:r={},parserOptions:a,storybookDirectory:i=".storybook"}=e,[c,m]=await Promise.all([o(import('eslint-plugin-storybook')),o(import('@typescript-eslint/parser'))]),f={parser:m,parserOptions:{ecmaFeatures:{jsx:!0},projectService:!0,...a},sourceType:"module"};return [{name:"2digits:storybook/setup",plugins:{storybook:fixupPluginRules(c)}},{name:"2digits:storybook/rules",files:t,languageOptions:f,rules:{"storybook/await-interactions":"error","storybook/context-in-play-function":"error","storybook/csf-component":"error","storybook/default-exports":"error","storybook/hierarchy-separator":"error","storybook/no-redundant-story-name":"error","storybook/no-stories-of":"error","storybook/no-title-property-in-meta":"error","storybook/prefer-pascal-case":"error","storybook/story-exports":"error","storybook/use-storybook-expect":"error","storybook/use-storybook-testing-library":"error",...r}},{name:"2digits:storybook/disables",files:t,rules:{"react-hooks/rules-of-hooks":"off","react/display-name":"off"}},{name:"2digits:storybook/config",files:[`${i}/main.@(js|cjs|mjs|ts)`],languageOptions:f,rules:{"storybook/no-uninstalled-addons":"error"}}]}async function N(e={}){let{overrides:t={}}=e,[r,{tailwindFunctions:a},i]=await Promise.all([o(import('eslint-plugin-tailwindcss')),o(import('@2digits/constants')),findUp(["tailwind.config.ts","tailwind.config.js"])]);return [{name:"2digits:tailwind",plugins:{tailwindcss:r},settings:{tailwindcss:{callees:a,config:i}},rules:{...r.configs.recommended.rules,...t}}]}async function U(e={}){let{overrides:t={}}=e,r=await o(import('@tanstack/eslint-plugin-query'));return [{name:"2digits:tanstack",plugins:{tanstack:fixupPluginRules(r)},rules:{"tanstack/exhaustive-deps":"error","tanstack/stable-query-client":"error","tanstack/no-rest-destructuring":"error",...t}}]}async function B(e={}){let{overrides:t={}}=e;return [{name:"2digits:turbo",plugins:{turbo:await o(import('eslint-plugin-turbo'))},rules:{"turbo/no-undeclared-env-vars":"error",...t}}]}async function A(e={}){let{overrides:t={},parserOptions:r={}}=e,[{plugin:a,configs:i,parser:c},m]=await Promise.all([o(import('typescript-eslint')),o(import('@2digits/eslint-plugin'))]),f=renamePluginsInConfigs(i.strictTypeChecked,p),g=Object.fromEntries(f.flatMap(({rules:O})=>Object.entries(O??{})));return [{name:"2digits:typescript/setup",plugins:{ts:a,"@2digits":m},languageOptions:{parser:c,parserOptions:{tsconfigRootDir:process.cwd(),projectService:!0,...r},sourceType:"module"}},{name:"2digits:typescript/rules",files:[S],rules:{...g,"ts/restrict-template-expressions":["error",{allowNumber:!0}],"ts/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"ts/consistent-type-exports":["error"],"ts/consistent-type-imports":["error",{prefer:"type-imports",disallowTypeAnnotations:!1,fixStyle:"inline-type-imports"}],"ts/no-empty-interface":["error",{allowSingleExtends:!0}],"ts/no-explicit-any":["error"],"ts/no-import-type-side-effects":["error"],"ts/no-misused-promises":"off","ts/no-confusing-void-expression":"off","ts/no-unused-vars":["error",{ignoreRestSiblings:!0,argsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"ts/unbound-method":"off",...m.configs.recommended.rules,...t}},{files:["**/*.d.ts"],name:"2digits:typescript/disables/dts",rules:{"unicorn/no-abusive-eslint-disable":"off","no-duplicate-imports":"off","no-restricted-syntax":"off","ts/no-unused-vars":"off"}},{files:["**/*.{test,spec}.ts?(x)"],name:"2digits:typescript/disables/test",rules:{"no-unused-expressions":"off"}},{files:["**/*.js","**/*.cjs","**/*.cts"],name:"2digits:typescript/disables/cjs",rules:{"ts/no-require-imports":"off","ts/no-var-requires":"off"}}]}function M(){return [{name:"2digits:unicorn",plugins:{unicorn:x},rules:{...x.configs["flat/recommended"].rules,"unicorn/filename-case":["off"],"unicorn/prefer-module":["off"],"unicorn/prevent-abbreviations":["off"],"unicorn/prefer-ternary":["error","only-single-line"],"unicorn/no-useless-undefined":["error",{checkArguments:!1,checkArrowFunctionBody:!1}],"unicorn/prefer-top-level-await":["off"]}}]}function d(e,t){return typeof e=="boolean"?e:e?.enable??t??!1}function u(e){if(typeof e=="boolean"||e===void 0)return {};let{enable:t,...r}=e;return r}function ae(e={},...t){let r=new FlatConfigComposer(P(e.ignores),_(e.js),D(),C(),q(),M(),E());d(e.turbo,isPackageExists("turbo"))&&(r=r.append(B(u(e.turbo))));let{overrides:a,...i}=u(e.ts);return d(e.ts,isPackageExists("typescript"))&&(r=r.append(A(u(e.ts)))),d(e.react,isPackageExists("react"))&&(r=r.append(L({...u(e.react),...i}))),d(e.next,isPackageExists("next"))&&(r=r.append(W({...u(e.next),...i}))),d(e.storybook,isPackageExists("storybook"))&&(r=r.append(G({...u(e.storybook),...i}))),d(e.tailwind,isPackageExists("tailwindcss"))&&(r=r.append(N(u(e.tailwind)))),d(e.tanstack,isPackageExists("react-query")||isPackageExists("@tanstack/react-query")||isPackageExists("@tanstack/react-query-devtools"))&&(r=r.append(U(u(e.tanstack)))),d(e.graphql,isPackageExists("graphql"))&&(r=r.append(j(u(e.graphql)))),r=r.append(...t),isPackageExists("prettier")&&(r=r.append(R())),r.renamePlugins(p).toConfigs()}
13
13
 
14
14
  export { C as comments, ae as default, j as graphql, P as ignores, _ as javascript, q as jsdoc, W as next, D as node, R as prettier, L as react, E as sonar, G as storybook, N as tailwind, U as tanstack, B as turbo, ae as twoDigits, A as typescript, M as unicorn };
15
15
  //# sourceMappingURL=index.js.map