@2digits/eslint-config 2.10.9 → 2.12.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.3.18/packages/eslint/src/rules/type-param-names.ts
13
+ * @see https://github.com/2digits-agency/configs/blob/@2digits/eslint-plugin@2.3.19/packages/eslint/src/rules/type-param-names.ts
14
14
  */
15
15
  '@2digits/type-param-names'?: Linter.RuleEntry<[]>
16
16
  /**
@@ -271,6 +271,16 @@ interface RuleOptions {
271
271
  * @see https://eslint.org/docs/latest/rules/dot-notation
272
272
  */
273
273
  'dot-notation'?: Linter.RuleEntry<DotNotation>
274
+ /**
275
+ * Enforce that `delete` method is used with `where` to avoid deleting all the rows in a table.
276
+ * @see https://github.com/drizzle-team/eslint-plugin-drizzle
277
+ */
278
+ 'drizzle/enforce-delete-with-where'?: Linter.RuleEntry<DrizzleEnforceDeleteWithWhere>
279
+ /**
280
+ * Enforce that `update` method is used with `where` to avoid deleting all the rows in a table.
281
+ * @see https://github.com/drizzle-team/eslint-plugin-drizzle
282
+ */
283
+ 'drizzle/enforce-update-with-where'?: Linter.RuleEntry<DrizzleEnforceUpdateWithWhere>
274
284
  /**
275
285
  * Require or disallow newline at the end of files
276
286
  * @see https://eslint.org/docs/latest/rules/eol-last
@@ -2469,8 +2479,8 @@ Backward pagination arguments
2469
2479
  */
2470
2480
  'react-compiler/react-compiler'?: Linter.RuleEntry<ReactCompilerReactCompiler>
2471
2481
  /**
2472
- * disallow passing 'children' to void DOM elements
2473
- * @see https://eslint-react.xyz/docs/rules/dom-no-children-in-void-dom-elements
2482
+ * disallow void elements (AKA self-closing elements) from having children
2483
+ * @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
2474
2484
  */
2475
2485
  'react-dom/no-children-in-void-dom-elements'?: Linter.RuleEntry<[]>
2476
2486
  /**
@@ -2528,6 +2538,11 @@ Backward pagination arguments
2528
2538
  * @see https://eslint-react.xyz/docs/rules/dom-no-unsafe-target-blank
2529
2539
  */
2530
2540
  'react-dom/no-unsafe-target-blank'?: Linter.RuleEntry<[]>
2541
+ /**
2542
+ * disallow void elements (AKA self-closing elements) from having children
2543
+ * @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
2544
+ */
2545
+ 'react-dom/no-void-elements-with-children'?: Linter.RuleEntry<[]>
2531
2546
  /**
2532
2547
  * disallow using shorthand boolean attributes
2533
2548
  * @see https://eslint-react.xyz/docs/rules/avoid-shorthand-boolean
@@ -2545,12 +2560,12 @@ Backward pagination arguments
2545
2560
  'react-extra/ensure-forward-ref-using-ref'?: Linter.RuleEntry<[]>
2546
2561
  /**
2547
2562
  * disallow duplicate props
2548
- * @see https://eslint-react.xyz/docs/rules/jsx-no-duplicate-props
2563
+ * @see https://eslint-react.xyz/docs/rules/no-duplicate-jsx-props
2549
2564
  */
2550
2565
  'react-extra/jsx-no-duplicate-props'?: Linter.RuleEntry<[]>
2551
2566
  /**
2552
- * a helper rule to mark variables as used
2553
- * @see https://eslint-react.xyz/docs/rules/jsx-uses-vars
2567
+ * helpes `eslint/no-unused-vars` to correctly mark JSX variables as used.
2568
+ * @see https://eslint-react.xyz/docs/rules/use-jsx-vars
2554
2569
  */
2555
2570
  'react-extra/jsx-uses-vars'?: Linter.RuleEntry<[]>
2556
2571
  /**
@@ -2653,6 +2668,11 @@ Backward pagination arguments
2653
2668
  * @see https://eslint-react.xyz/docs/rules/no-direct-mutation-state
2654
2669
  */
2655
2670
  'react-extra/no-direct-mutation-state'?: Linter.RuleEntry<[]>
2671
+ /**
2672
+ * disallow duplicate props
2673
+ * @see https://eslint-react.xyz/docs/rules/no-duplicate-jsx-props
2674
+ */
2675
+ 'react-extra/no-duplicate-jsx-props'?: Linter.RuleEntry<[]>
2656
2676
  /**
2657
2677
  * disallow duplicate keys when rendering list
2658
2678
  * @see https://eslint-react.xyz/docs/rules/no-duplicate-key
@@ -2784,10 +2804,20 @@ Backward pagination arguments
2784
2804
  */
2785
2805
  'react-extra/prefer-shorthand-fragment'?: Linter.RuleEntry<[]>
2786
2806
  /**
2787
- * enforce custom hooks to use at least one other hook inside
2788
- * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-redundant-custom-hook
2807
+ * helpes `eslint/no-unused-vars` to correctly mark JSX variables as used.
2808
+ * @see https://eslint-react.xyz/docs/rules/use-jsx-vars
2809
+ */
2810
+ 'react-extra/use-jsx-vars'?: Linter.RuleEntry<[]>
2811
+ /**
2812
+ * enforce custom Hooks to use at least one other hook inside
2813
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-useless-custom-hooks
2789
2814
  */
2790
2815
  'react-hooks-extra/ensure-custom-hooks-using-other-hooks'?: Linter.RuleEntry<[]>
2816
+ /**
2817
+ * disallow unnecessary usage of 'useCallback'
2818
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-callback
2819
+ */
2820
+ 'react-hooks-extra/ensure-use-callback-has-non-empty-deps'?: Linter.RuleEntry<[]>
2791
2821
  /**
2792
2822
  * disallow unnecessary usage of 'useMemo'
2793
2823
  * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-memo
@@ -2804,8 +2834,8 @@ Backward pagination arguments
2804
2834
  */
2805
2835
  'react-hooks-extra/no-direct-set-state-in-use-layout-effect'?: Linter.RuleEntry<[]>
2806
2836
  /**
2807
- * enforce custom hooks to use at least one other hook inside
2808
- * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-redundant-custom-hook
2837
+ * enforce custom Hooks to use at least one other hook inside
2838
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-useless-custom-hooks
2809
2839
  */
2810
2840
  'react-hooks-extra/no-redundant-custom-hook'?: Linter.RuleEntry<[]>
2811
2841
  /**
@@ -2818,6 +2848,11 @@ Backward pagination arguments
2818
2848
  * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-memo
2819
2849
  */
2820
2850
  'react-hooks-extra/no-unnecessary-use-memo'?: Linter.RuleEntry<[]>
2851
+ /**
2852
+ * enforce custom Hooks to use at least one other hook inside
2853
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-useless-custom-hooks
2854
+ */
2855
+ 'react-hooks-extra/no-useless-custom-hooks'?: Linter.RuleEntry<[]>
2821
2856
  /**
2822
2857
  * disallow function calls in 'useState' that aren't wrapped in an initializer function
2823
2858
  * @see https://eslint-react.xyz/docs/rules/hooks-extra-prefer-use-state-lazy-initialization
@@ -2854,22 +2889,22 @@ Backward pagination arguments
2854
2889
  */
2855
2890
  'react-naming-convention/use-state'?: Linter.RuleEntry<[]>
2856
2891
  /**
2857
- * enforce that every 'addEventListener' in a component or custom hook has a corresponding 'removeEventListener'.
2892
+ * enforce that every 'addEventListener' in a component or custom Hook has a corresponding 'removeEventListener'.
2858
2893
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
2859
2894
  */
2860
2895
  'react-web-api/no-leaked-event-listener'?: Linter.RuleEntry<[]>
2861
2896
  /**
2862
- * enforce that every 'setInterval' in a component or custom hook has a corresponding 'clearInterval'.
2897
+ * enforce that every 'setInterval' in a component or custom Hook has a corresponding 'clearInterval'.
2863
2898
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
2864
2899
  */
2865
2900
  'react-web-api/no-leaked-interval'?: Linter.RuleEntry<[]>
2866
2901
  /**
2867
- * enforce cleanup of 'ResizeObserver' instances in components and custom hooks.
2902
+ * enforce cleanup of 'ResizeObserver' instances in components and custom Hooks.
2868
2903
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-resize-observer
2869
2904
  */
2870
2905
  'react-web-api/no-leaked-resize-observer'?: Linter.RuleEntry<[]>
2871
2906
  /**
2872
- * enforce that every 'setTimeout' in a component or custom hook has a corresponding 'clearTimeout'.
2907
+ * enforce that every 'setTimeout' in a component or custom Hook has a corresponding 'clearTimeout'.
2873
2908
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
2874
2909
  */
2875
2910
  'react-web-api/no-leaked-timeout'?: Linter.RuleEntry<[]>
@@ -5801,6 +5836,14 @@ type DotNotation = []|[{
5801
5836
  allowKeywords?: boolean
5802
5837
  allowPattern?: string
5803
5838
  }]
5839
+ // ----- drizzle/enforce-delete-with-where -----
5840
+ type DrizzleEnforceDeleteWithWhere = []|[{
5841
+ drizzleObjectName?: (string | unknown[])
5842
+ }]
5843
+ // ----- drizzle/enforce-update-with-where -----
5844
+ type DrizzleEnforceUpdateWithWhere = []|[{
5845
+ drizzleObjectName?: (string | unknown[])
5846
+ }]
5804
5847
  // ----- eol-last -----
5805
5848
  type EolLast = []|[("always" | "never" | "unix" | "windows")]
5806
5849
  // ----- eqeqeq -----
@@ -8833,7 +8876,7 @@ type TsConsistentTypeAssertions = []|[({
8833
8876
  assertionStyle: "never"
8834
8877
  } | {
8835
8878
 
8836
- assertionStyle: ("as" | "angle-bracket")
8879
+ assertionStyle?: ("as" | "angle-bracket")
8837
8880
 
8838
8881
  objectLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never")
8839
8882
  })]
@@ -10138,7 +10181,7 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
10138
10181
  onlyEquality?: boolean
10139
10182
  }]
10140
10183
  // Names of all the configs
10141
- type ConfigNames = '2digits:antfu' | '2digits:comments' | '2digits:graphql' | '2digits:ignores' | '2digits:gitignore' | '2digits:javascript' | '2digits:jsdoc' | '2digits:next/setup' | '2digits:next/rules' | '2digits:node' | '2digits:prettier' | '2digits:react/setup' | '2digits:react/rules' | '2digits:regexp' | '2digits:sonar' | '2digits:storybook/setup' | '2digits:storybook/rules' | '2digits:storybook/disables' | '2digits:storybook/config' | '2digits:tailwind' | '2digits:tanstack' | '2digits:turbo' | '2digits:typescript/setup' | '2digits:typescript/rules' | '2digits:typescript/disables/dts' | '2digits:typescript/disables/test' | '2digits:typescript/disables/cjs' | '2digits:unicorn'
10184
+ type ConfigNames = '2digits:antfu' | '2digits:comments' | '2digits:drizzle' | '2digits:graphql' | '2digits:ignores' | '2digits:gitignore' | '2digits:javascript' | '2digits:jsdoc' | '2digits:next/setup' | '2digits:next/rules' | '2digits:node' | '2digits:prettier' | '2digits:react/setup' | '2digits:react/rules' | '2digits:regexp' | '2digits:sonar' | '2digits:storybook/setup' | '2digits:storybook/rules' | '2digits:storybook/disables' | '2digits:storybook/config' | '2digits:tailwind' | '2digits:tanstack' | '2digits:turbo' | '2digits:typescript/setup' | '2digits:typescript/rules' | '2digits:typescript/disables/dts' | '2digits:typescript/disables/test' | '2digits:typescript/disables/cjs' | '2digits:unicorn'
10142
10185
 
10143
10186
  type Rules = RuleOptions;
10144
10187
  interface TypedFlatConfigItem extends Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins' | 'languageOptions'> {
@@ -10154,6 +10197,14 @@ interface TypedFlatConfigItem extends Omit<Linter.Config<Linter.RulesRecord & Ru
10154
10197
  interface OptionsOverrides {
10155
10198
  overrides?: TypedFlatConfigItem['rules'];
10156
10199
  }
10200
+ interface OptionsWithDrizzle extends OptionsOverrides {
10201
+ /**
10202
+ * Object names which refer to a Drizzle instance.
10203
+ *
10204
+ * @default ```['drizzle', 'db']```
10205
+ */
10206
+ drizzleObjectName?: string | string[];
10207
+ }
10157
10208
  interface OptionsTypeScriptWithTypes extends OptionsOverrides {
10158
10209
  /**
10159
10210
  * Root directory of the project.
@@ -10195,6 +10246,8 @@ declare function antfu(): TypedFlatConfigItem[];
10195
10246
 
10196
10247
  declare function comments(): TypedFlatConfigItem[];
10197
10248
 
10249
+ declare function drizzle(options?: OptionsWithDrizzle): Promise<TypedFlatConfigItem[]>;
10250
+
10198
10251
  declare function graphql(options?: OptionsWithFiles): Promise<TypedFlatConfigItem[]>;
10199
10252
 
10200
10253
  declare function ignores(options?: OptionsWithIgnores): Promise<TypedFlatConfigItem[]>;
@@ -10241,7 +10294,8 @@ interface ESLint2DigitsOptions {
10241
10294
  tailwind?: SharedOptions<OptionsOverrides> | boolean;
10242
10295
  storybook?: SharedOptions<OptionsWithStorybook> | boolean;
10243
10296
  tanstack?: SharedOptions<OptionsOverrides> | boolean;
10297
+ drizzle?: SharedOptions<OptionsWithDrizzle> | boolean;
10244
10298
  }
10245
10299
  declare function twoDigits(options?: ESLint2DigitsOptions, ...userConfig: TypedFlatConfigItem[]): Promise<TypedFlatConfigItem[]>;
10246
10300
 
10247
- export { type ConfigNames, type OptionsOverrides, type OptionsTypeScriptWithTypes, type OptionsWithFiles, type OptionsWithIgnores, type OptionsWithReact, type OptionsWithStorybook, type Rules, type TypedFlatConfigItem, antfu, comments, twoDigits as default, graphql, ignores, javascript, jsdoc, next, node, prettier, react, regexp, sonar, storybook, tailwind, tanstack, turbo, twoDigits, typescript, unicorn };
10301
+ export { type ConfigNames, type OptionsOverrides, type OptionsTypeScriptWithTypes, type OptionsWithDrizzle, type OptionsWithFiles, type OptionsWithIgnores, type OptionsWithReact, type OptionsWithStorybook, type Rules, type TypedFlatConfigItem, antfu, comments, twoDigits as default, drizzle, graphql, ignores, javascript, jsdoc, next, node, prettier, react, regexp, sonar, storybook, tailwind, tanstack, turbo, twoDigits, typescript, unicorn };
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.3.18/packages/eslint/src/rules/type-param-names.ts
13
+ * @see https://github.com/2digits-agency/configs/blob/@2digits/eslint-plugin@2.3.19/packages/eslint/src/rules/type-param-names.ts
14
14
  */
15
15
  '@2digits/type-param-names'?: Linter.RuleEntry<[]>
16
16
  /**
@@ -271,6 +271,16 @@ interface RuleOptions {
271
271
  * @see https://eslint.org/docs/latest/rules/dot-notation
272
272
  */
273
273
  'dot-notation'?: Linter.RuleEntry<DotNotation>
274
+ /**
275
+ * Enforce that `delete` method is used with `where` to avoid deleting all the rows in a table.
276
+ * @see https://github.com/drizzle-team/eslint-plugin-drizzle
277
+ */
278
+ 'drizzle/enforce-delete-with-where'?: Linter.RuleEntry<DrizzleEnforceDeleteWithWhere>
279
+ /**
280
+ * Enforce that `update` method is used with `where` to avoid deleting all the rows in a table.
281
+ * @see https://github.com/drizzle-team/eslint-plugin-drizzle
282
+ */
283
+ 'drizzle/enforce-update-with-where'?: Linter.RuleEntry<DrizzleEnforceUpdateWithWhere>
274
284
  /**
275
285
  * Require or disallow newline at the end of files
276
286
  * @see https://eslint.org/docs/latest/rules/eol-last
@@ -2469,8 +2479,8 @@ Backward pagination arguments
2469
2479
  */
2470
2480
  'react-compiler/react-compiler'?: Linter.RuleEntry<ReactCompilerReactCompiler>
2471
2481
  /**
2472
- * disallow passing 'children' to void DOM elements
2473
- * @see https://eslint-react.xyz/docs/rules/dom-no-children-in-void-dom-elements
2482
+ * disallow void elements (AKA self-closing elements) from having children
2483
+ * @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
2474
2484
  */
2475
2485
  'react-dom/no-children-in-void-dom-elements'?: Linter.RuleEntry<[]>
2476
2486
  /**
@@ -2528,6 +2538,11 @@ Backward pagination arguments
2528
2538
  * @see https://eslint-react.xyz/docs/rules/dom-no-unsafe-target-blank
2529
2539
  */
2530
2540
  'react-dom/no-unsafe-target-blank'?: Linter.RuleEntry<[]>
2541
+ /**
2542
+ * disallow void elements (AKA self-closing elements) from having children
2543
+ * @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
2544
+ */
2545
+ 'react-dom/no-void-elements-with-children'?: Linter.RuleEntry<[]>
2531
2546
  /**
2532
2547
  * disallow using shorthand boolean attributes
2533
2548
  * @see https://eslint-react.xyz/docs/rules/avoid-shorthand-boolean
@@ -2545,12 +2560,12 @@ Backward pagination arguments
2545
2560
  'react-extra/ensure-forward-ref-using-ref'?: Linter.RuleEntry<[]>
2546
2561
  /**
2547
2562
  * disallow duplicate props
2548
- * @see https://eslint-react.xyz/docs/rules/jsx-no-duplicate-props
2563
+ * @see https://eslint-react.xyz/docs/rules/no-duplicate-jsx-props
2549
2564
  */
2550
2565
  'react-extra/jsx-no-duplicate-props'?: Linter.RuleEntry<[]>
2551
2566
  /**
2552
- * a helper rule to mark variables as used
2553
- * @see https://eslint-react.xyz/docs/rules/jsx-uses-vars
2567
+ * helpes `eslint/no-unused-vars` to correctly mark JSX variables as used.
2568
+ * @see https://eslint-react.xyz/docs/rules/use-jsx-vars
2554
2569
  */
2555
2570
  'react-extra/jsx-uses-vars'?: Linter.RuleEntry<[]>
2556
2571
  /**
@@ -2653,6 +2668,11 @@ Backward pagination arguments
2653
2668
  * @see https://eslint-react.xyz/docs/rules/no-direct-mutation-state
2654
2669
  */
2655
2670
  'react-extra/no-direct-mutation-state'?: Linter.RuleEntry<[]>
2671
+ /**
2672
+ * disallow duplicate props
2673
+ * @see https://eslint-react.xyz/docs/rules/no-duplicate-jsx-props
2674
+ */
2675
+ 'react-extra/no-duplicate-jsx-props'?: Linter.RuleEntry<[]>
2656
2676
  /**
2657
2677
  * disallow duplicate keys when rendering list
2658
2678
  * @see https://eslint-react.xyz/docs/rules/no-duplicate-key
@@ -2784,10 +2804,20 @@ Backward pagination arguments
2784
2804
  */
2785
2805
  'react-extra/prefer-shorthand-fragment'?: Linter.RuleEntry<[]>
2786
2806
  /**
2787
- * enforce custom hooks to use at least one other hook inside
2788
- * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-redundant-custom-hook
2807
+ * helpes `eslint/no-unused-vars` to correctly mark JSX variables as used.
2808
+ * @see https://eslint-react.xyz/docs/rules/use-jsx-vars
2809
+ */
2810
+ 'react-extra/use-jsx-vars'?: Linter.RuleEntry<[]>
2811
+ /**
2812
+ * enforce custom Hooks to use at least one other hook inside
2813
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-useless-custom-hooks
2789
2814
  */
2790
2815
  'react-hooks-extra/ensure-custom-hooks-using-other-hooks'?: Linter.RuleEntry<[]>
2816
+ /**
2817
+ * disallow unnecessary usage of 'useCallback'
2818
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-callback
2819
+ */
2820
+ 'react-hooks-extra/ensure-use-callback-has-non-empty-deps'?: Linter.RuleEntry<[]>
2791
2821
  /**
2792
2822
  * disallow unnecessary usage of 'useMemo'
2793
2823
  * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-memo
@@ -2804,8 +2834,8 @@ Backward pagination arguments
2804
2834
  */
2805
2835
  'react-hooks-extra/no-direct-set-state-in-use-layout-effect'?: Linter.RuleEntry<[]>
2806
2836
  /**
2807
- * enforce custom hooks to use at least one other hook inside
2808
- * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-redundant-custom-hook
2837
+ * enforce custom Hooks to use at least one other hook inside
2838
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-useless-custom-hooks
2809
2839
  */
2810
2840
  'react-hooks-extra/no-redundant-custom-hook'?: Linter.RuleEntry<[]>
2811
2841
  /**
@@ -2818,6 +2848,11 @@ Backward pagination arguments
2818
2848
  * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-memo
2819
2849
  */
2820
2850
  'react-hooks-extra/no-unnecessary-use-memo'?: Linter.RuleEntry<[]>
2851
+ /**
2852
+ * enforce custom Hooks to use at least one other hook inside
2853
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-useless-custom-hooks
2854
+ */
2855
+ 'react-hooks-extra/no-useless-custom-hooks'?: Linter.RuleEntry<[]>
2821
2856
  /**
2822
2857
  * disallow function calls in 'useState' that aren't wrapped in an initializer function
2823
2858
  * @see https://eslint-react.xyz/docs/rules/hooks-extra-prefer-use-state-lazy-initialization
@@ -2854,22 +2889,22 @@ Backward pagination arguments
2854
2889
  */
2855
2890
  'react-naming-convention/use-state'?: Linter.RuleEntry<[]>
2856
2891
  /**
2857
- * enforce that every 'addEventListener' in a component or custom hook has a corresponding 'removeEventListener'.
2892
+ * enforce that every 'addEventListener' in a component or custom Hook has a corresponding 'removeEventListener'.
2858
2893
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
2859
2894
  */
2860
2895
  'react-web-api/no-leaked-event-listener'?: Linter.RuleEntry<[]>
2861
2896
  /**
2862
- * enforce that every 'setInterval' in a component or custom hook has a corresponding 'clearInterval'.
2897
+ * enforce that every 'setInterval' in a component or custom Hook has a corresponding 'clearInterval'.
2863
2898
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
2864
2899
  */
2865
2900
  'react-web-api/no-leaked-interval'?: Linter.RuleEntry<[]>
2866
2901
  /**
2867
- * enforce cleanup of 'ResizeObserver' instances in components and custom hooks.
2902
+ * enforce cleanup of 'ResizeObserver' instances in components and custom Hooks.
2868
2903
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-resize-observer
2869
2904
  */
2870
2905
  'react-web-api/no-leaked-resize-observer'?: Linter.RuleEntry<[]>
2871
2906
  /**
2872
- * enforce that every 'setTimeout' in a component or custom hook has a corresponding 'clearTimeout'.
2907
+ * enforce that every 'setTimeout' in a component or custom Hook has a corresponding 'clearTimeout'.
2873
2908
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
2874
2909
  */
2875
2910
  'react-web-api/no-leaked-timeout'?: Linter.RuleEntry<[]>
@@ -5801,6 +5836,14 @@ type DotNotation = []|[{
5801
5836
  allowKeywords?: boolean
5802
5837
  allowPattern?: string
5803
5838
  }]
5839
+ // ----- drizzle/enforce-delete-with-where -----
5840
+ type DrizzleEnforceDeleteWithWhere = []|[{
5841
+ drizzleObjectName?: (string | unknown[])
5842
+ }]
5843
+ // ----- drizzle/enforce-update-with-where -----
5844
+ type DrizzleEnforceUpdateWithWhere = []|[{
5845
+ drizzleObjectName?: (string | unknown[])
5846
+ }]
5804
5847
  // ----- eol-last -----
5805
5848
  type EolLast = []|[("always" | "never" | "unix" | "windows")]
5806
5849
  // ----- eqeqeq -----
@@ -8833,7 +8876,7 @@ type TsConsistentTypeAssertions = []|[({
8833
8876
  assertionStyle: "never"
8834
8877
  } | {
8835
8878
 
8836
- assertionStyle: ("as" | "angle-bracket")
8879
+ assertionStyle?: ("as" | "angle-bracket")
8837
8880
 
8838
8881
  objectLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never")
8839
8882
  })]
@@ -10138,7 +10181,7 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
10138
10181
  onlyEquality?: boolean
10139
10182
  }]
10140
10183
  // Names of all the configs
10141
- type ConfigNames = '2digits:antfu' | '2digits:comments' | '2digits:graphql' | '2digits:ignores' | '2digits:gitignore' | '2digits:javascript' | '2digits:jsdoc' | '2digits:next/setup' | '2digits:next/rules' | '2digits:node' | '2digits:prettier' | '2digits:react/setup' | '2digits:react/rules' | '2digits:regexp' | '2digits:sonar' | '2digits:storybook/setup' | '2digits:storybook/rules' | '2digits:storybook/disables' | '2digits:storybook/config' | '2digits:tailwind' | '2digits:tanstack' | '2digits:turbo' | '2digits:typescript/setup' | '2digits:typescript/rules' | '2digits:typescript/disables/dts' | '2digits:typescript/disables/test' | '2digits:typescript/disables/cjs' | '2digits:unicorn'
10184
+ type ConfigNames = '2digits:antfu' | '2digits:comments' | '2digits:drizzle' | '2digits:graphql' | '2digits:ignores' | '2digits:gitignore' | '2digits:javascript' | '2digits:jsdoc' | '2digits:next/setup' | '2digits:next/rules' | '2digits:node' | '2digits:prettier' | '2digits:react/setup' | '2digits:react/rules' | '2digits:regexp' | '2digits:sonar' | '2digits:storybook/setup' | '2digits:storybook/rules' | '2digits:storybook/disables' | '2digits:storybook/config' | '2digits:tailwind' | '2digits:tanstack' | '2digits:turbo' | '2digits:typescript/setup' | '2digits:typescript/rules' | '2digits:typescript/disables/dts' | '2digits:typescript/disables/test' | '2digits:typescript/disables/cjs' | '2digits:unicorn'
10142
10185
 
10143
10186
  type Rules = RuleOptions;
10144
10187
  interface TypedFlatConfigItem extends Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins' | 'languageOptions'> {
@@ -10154,6 +10197,14 @@ interface TypedFlatConfigItem extends Omit<Linter.Config<Linter.RulesRecord & Ru
10154
10197
  interface OptionsOverrides {
10155
10198
  overrides?: TypedFlatConfigItem['rules'];
10156
10199
  }
10200
+ interface OptionsWithDrizzle extends OptionsOverrides {
10201
+ /**
10202
+ * Object names which refer to a Drizzle instance.
10203
+ *
10204
+ * @default ```['drizzle', 'db']```
10205
+ */
10206
+ drizzleObjectName?: string | string[];
10207
+ }
10157
10208
  interface OptionsTypeScriptWithTypes extends OptionsOverrides {
10158
10209
  /**
10159
10210
  * Root directory of the project.
@@ -10195,6 +10246,8 @@ declare function antfu(): TypedFlatConfigItem[];
10195
10246
 
10196
10247
  declare function comments(): TypedFlatConfigItem[];
10197
10248
 
10249
+ declare function drizzle(options?: OptionsWithDrizzle): Promise<TypedFlatConfigItem[]>;
10250
+
10198
10251
  declare function graphql(options?: OptionsWithFiles): Promise<TypedFlatConfigItem[]>;
10199
10252
 
10200
10253
  declare function ignores(options?: OptionsWithIgnores): Promise<TypedFlatConfigItem[]>;
@@ -10241,7 +10294,8 @@ interface ESLint2DigitsOptions {
10241
10294
  tailwind?: SharedOptions<OptionsOverrides> | boolean;
10242
10295
  storybook?: SharedOptions<OptionsWithStorybook> | boolean;
10243
10296
  tanstack?: SharedOptions<OptionsOverrides> | boolean;
10297
+ drizzle?: SharedOptions<OptionsWithDrizzle> | boolean;
10244
10298
  }
10245
10299
  declare function twoDigits(options?: ESLint2DigitsOptions, ...userConfig: TypedFlatConfigItem[]): Promise<TypedFlatConfigItem[]>;
10246
10300
 
10247
- export { type ConfigNames, type OptionsOverrides, type OptionsTypeScriptWithTypes, type OptionsWithFiles, type OptionsWithIgnores, type OptionsWithReact, type OptionsWithStorybook, type Rules, type TypedFlatConfigItem, antfu, comments, twoDigits as default, graphql, ignores, javascript, jsdoc, next, node, prettier, react, regexp, sonar, storybook, tailwind, tanstack, turbo, twoDigits, typescript, unicorn };
10301
+ export { type ConfigNames, type OptionsOverrides, type OptionsTypeScriptWithTypes, type OptionsWithDrizzle, type OptionsWithFiles, type OptionsWithIgnores, type OptionsWithReact, type OptionsWithStorybook, type Rules, type TypedFlatConfigItem, antfu, comments, twoDigits as default, drizzle, graphql, ignores, javascript, jsdoc, next, node, prettier, react, regexp, sonar, storybook, tailwind, tanstack, turbo, twoDigits, typescript, unicorn };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import $ from'eslint-plugin-antfu';import K from'@eslint-community/eslint-plugin-eslint-comments';import Q from'@eslint-community/eslint-plugin-eslint-comments/configs';import {renamePluginsInRules,composer,renamePluginsInConfigs,FlatConfigComposer}from'eslint-flat-config-utils';import {loadConfig}from'graphql-config';import oe from'@eslint/js';import x from'globals';import {fixupPluginRules}from'@eslint/compat';import k from'eslint-plugin-unicorn';import W from'eslint-plugin-n';import T from'eslint-plugin-sonarjs';import E from'eslint-plugin-regexp';import {findUp}from'find-up';import {isPackageExists}from'local-pkg';function w(){return [{name:"2digits:antfu",plugins:{antfu:$},rules:{"antfu/if-newline":"error","antfu/top-level-function":"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-community/eslint-comments":"comments",storybook:"storybook",turbo:"turbo",jsdoc:"jsdoc",unicorn:"unicorn",tailwindcss:"tailwindcss","@tanstack/query":"tanstack","@2digits":"@2digits","@graphql-eslint":"gql",sonarjs:"sonar"};var Y=renamePluginsInRules(Q.recommended.rules,p);function v(){return [{name:"2digits:comments",plugins:{comments:K},rules:{...Y,"comments/no-unused-disable":"error","comments/disable-enable-pair":["error",{allowWholeFile:!0}]}}]}async function o(e){let t=await e;return t.default||t}async function C(e={}){let{overrides:t={},files:r=["**/*.graphql","**/*.gql"]}=e,[i,a]=await Promise.all([o(import('@graphql-eslint/eslint-plugin')),loadConfig({throwOnEmpty:!1,throwOnMissing:!1}).then(m=>m?.getDefault().schema)]),l=i.configs["flat/operations-recommended"].rules,c={};if(a)c=l;else for(let m of Object.keys(l)){let y=m.replace("@graphql-eslint/","");y in i.rules&&(i.rules[y].meta.docs?.requiresSchema||i.rules[y].meta.docs?.requiresSiblings)||(c[m]=l[m]);}let d=renamePluginsInRules(c,p);return [{name:"2digits:graphql",plugins:{gql:i},languageOptions:{parser:i.parser},files:r,rules:{...d,"gql/naming-convention":["error",{allowLeadingUnderscore:!0}],...t}}]}var S="**/*.?([cm])[jt]s?(x)",h="**/*.?([cm])ts",O="**/*.?([cm])tsx",j="**/*.stories.tsx",F=["**/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 I(e={}){let{gitIgnore:t,ignores:r=[]}=e;return composer({ignores:[F,r].flat(),name:"2digits:ignores"},o(import('eslint-config-flat-gitignore')).then(i=>i({strict:!1,...t,name:"2digits:gitignore"})))}function P(e={}){let{overrides:t={}}=e;return [{name:"2digits:javascript",languageOptions:{ecmaVersion:2022,globals:{...x.browser,...x.es2021,...x.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{reportUnusedDisableDirectives:!0},rules:{...oe.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 _(){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 q(e={}){let{files:t=[h,O],overrides:r={},parserOptions:i}=e,[a,l]=await Promise.all([o(import('@next/eslint-plugin-next')),o(import('@typescript-eslint/parser'))]),c=renamePluginsInRules({...a.configs.recommended.rules,...a.configs["core-web-vitals"].rules},p);return [{name:"2digits:next/setup",plugins:{next:fixupPluginRules(a)}},{name:"2digits:next/rules",files:t,languageOptions:{parser:l,parserOptions:{ecmaFeatures:{jsx:!0},projectService:!0,...i},sourceType:"module"},rules:{...c,"next/no-html-link-for-pages":"off",...r}}]}function R(){return [{name:"2digits:node",settings:{node:{version:">= 20.0.0"}},plugins:{node:W},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 D(){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=[h,O],overrides:r={},parserOptions:i,tsconfigRootDir:a,reactCompiler:l=!0}=e,[c,d,m,y,V]=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')),l?o(import('eslint-plugin-react-compiler')):void 0]),b=c.configs.all.plugins,H=renamePluginsInRules({...m.configs.recommended.rules,...m.configs["jsx-runtime"].rules,...d.configs.recommended.rules,...c.configs["recommended-type-checked"].rules},p);return [{name:"2digits:react/setup",plugins:{react:m,"react-dom":b["@eslint-react/dom"],"react-web-api":b["@eslint-react/web-api"],"react-extra":b["@eslint-react"],"react-hooks":fixupPluginRules(d),"react-hooks-extra":b["@eslint-react/hooks-extra"],"react-naming-convention":b["@eslint-react/naming-convention"],...l?{"react-compiler":V}:{}},settings:{react:{version:"detect"}}},{name:"2digits:react/rules",files:t,languageOptions:{parser:y,parserOptions:{ecmaFeatures:{jsx:!0},tsconfigRootDir:a,projectService:!0,...i},sourceType:"module"},rules:{...H,...l?{"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-extra/prefer-read-only-props":"off","react/jsx-curly-newline":"off","react/jsx-newline":["error",{prevent:!1}],"react/prop-types":"off",...r}}]}function G(){return [{name:"2digits:regexp",plugins:{regexp:E},rules:{...E.configs["flat/recommended"].rules}}]}var pe=renamePluginsInRules(T.configs.recommended.rules,p);function N(){return [{name:"2digits:sonar",plugins:{sonar:T},rules:{...pe,"sonar/no-redundant-jump":"off"}}]}async function U(e={}){let{files:t=[j],overrides:r={},parserOptions:i,storybookDirectory:a=".storybook"}=e,[l,c]=await Promise.all([o(import('eslint-plugin-storybook')),o(import('@typescript-eslint/parser'))]),d={parser:c,parserOptions:{ecmaFeatures:{jsx:!0},projectService:!0,...i},sourceType:"module"};return [{name:"2digits:storybook/setup",plugins:{storybook:fixupPluginRules(l)}},{name:"2digits:storybook/rules",files:t,languageOptions:d,rules:{"storybook/await-interactions":"error","storybook/context-in-play-function":"error","storybook/csf-component":"error","storybook/default-exports":"error","storybook/hierarchy-separator":"error","storybook/meta-inline-properties":"error","storybook/no-redundant-story-name":"error","storybook/no-stories-of":"error","storybook/no-title-property-in-meta":"error","storybook/no-uninstalled-addons":"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","sonar/no-duplicate-string":"off"}},{name:"2digits:storybook/config",files:[`${a}/main.@(js|cjs|mjs|ts)`],languageOptions:d,rules:{"storybook/no-uninstalled-addons":"error"}}]}async function B(e={}){let{overrides:t={}}=e,[r,{tailwindFunctions:i},a]=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:i,config:a}},rules:{...r.configs.recommended.rules,...t}}]}async function A(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 M(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 X(e={}){let{overrides:t={},parserOptions:r={}}=e,[{plugin:i,configs:a,parser:l},c]=await Promise.all([o(import('typescript-eslint')),o(import('@2digits/eslint-plugin'))]),d=renamePluginsInConfigs(a.strictTypeChecked,p),m=Object.fromEntries(d.flatMap(({rules:y})=>Object.entries(y??{})));return [{name:"2digits:typescript/setup",plugins:{ts:i,"@2digits":c},languageOptions:{parser:l,parserOptions:{tsconfigRootDir:process.cwd(),projectService:!0,warnOnUnsupportedTypeScriptVersion:!1,...r},sourceType:"module"}},{name:"2digits:typescript/rules",files:[S],rules:{...m,"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",...c.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 z(){return [{name:"2digits:unicorn",plugins:{unicorn:k},rules:{...k.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 g(e,t){return typeof e=="boolean"?e:e?.enable??t??!1}function f(e){if(typeof e=="boolean"||e===void 0)return {};let{enable:t,...r}=e;return r}function fe(e={},...t){let r=new FlatConfigComposer(I(e.ignores),P(e.js),R(),v(),_(),z(),N(),G(),w());g(e.turbo,isPackageExists("turbo"))&&(r=r.append(M(f(e.turbo))));let{overrides:i,...a}=f(e.ts);return g(e.ts,isPackageExists("typescript"))&&(r=r.append(X(f(e.ts)))),g(e.react,isPackageExists("react"))&&(r=r.append(L({...f(e.react),...a}))),g(e.next,isPackageExists("next"))&&(r=r.append(q({...f(e.next),...a}))),g(e.storybook,isPackageExists("storybook"))&&(r=r.append(U({...f(e.storybook),...a}))),g(e.tailwind,isPackageExists("tailwindcss"))&&(r=r.append(B(f(e.tailwind)))),g(e.tanstack,isPackageExists("react-query")||isPackageExists("@tanstack/react-query")||isPackageExists("@tanstack/react-query-devtools"))&&(r=r.append(A(f(e.tanstack)))),g(e.graphql,isPackageExists("graphql"))&&(r=r.append(C(f(e.graphql)))),r=r.append(...t),isPackageExists("prettier")&&(r=r.append(D())),r.renamePlugins(p).toConfigs()}export{w as antfu,v as comments,fe as default,C as graphql,I as ignores,P as javascript,_ as jsdoc,q as next,R as node,D as prettier,L as react,G as regexp,N as sonar,U as storybook,B as tailwind,A as tanstack,M as turbo,fe as twoDigits,X as typescript,z as unicorn};//# sourceMappingURL=index.js.map
1
+ import K from'eslint-plugin-antfu';import Q from'@eslint-community/eslint-plugin-eslint-comments';import J from'@eslint-community/eslint-plugin-eslint-comments/configs';import {renamePluginsInRules,composer,renamePluginsInConfigs,FlatConfigComposer}from'eslint-flat-config-utils';import {fixupPluginRules}from'@eslint/compat';import {loadConfig}from'graphql-config';import ne from'@eslint/js';import x from'globals';import T from'eslint-plugin-unicorn';import W from'eslint-plugin-n';import k from'eslint-plugin-sonarjs';import E from'eslint-plugin-regexp';import {findUp}from'find-up';import {isPackageExists}from'local-pkg';function w(){return [{name:"2digits:antfu",plugins:{antfu:K},rules:{"antfu/if-newline":"error","antfu/top-level-function":"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-community/eslint-comments":"comments",storybook:"storybook",turbo:"turbo",jsdoc:"jsdoc",unicorn:"unicorn",tailwindcss:"tailwindcss","@tanstack/query":"tanstack","@2digits":"@2digits","@graphql-eslint":"gql",sonarjs:"sonar",drizzle:"drizzle"};var Z=renamePluginsInRules(J.recommended.rules,p);function v(){return [{name:"2digits:comments",plugins:{comments:Q},rules:{...Z,"comments/no-unused-disable":"error","comments/disable-enable-pair":["error",{allowWholeFile:!0}]}}]}async function o(e){let t=await e;return t.default||t}async function C(e={}){let{overrides:t={},drizzleObjectName:r=["drizzle","db"]}=e,i=await o(import('eslint-plugin-drizzle'));return [{name:"2digits:drizzle",plugins:{drizzle:fixupPluginRules(i)},rules:{"drizzle/enforce-update-with-where":["error",{drizzleObjectName:r}],"drizzle/enforce-delete-with-where":["error",{drizzleObjectName:r}],...t}}]}async function S(e={}){let{overrides:t={},files:r=["**/*.graphql","**/*.gql"]}=e,[i,a]=await Promise.all([o(import('@graphql-eslint/eslint-plugin')),loadConfig({throwOnEmpty:!1,throwOnMissing:!1}).then(u=>u?.getDefault().schema)]),l=i.configs["flat/operations-recommended"].rules,c={};if(a)c=l;else for(let u of Object.keys(l)){let y=u.replace("@graphql-eslint/","");y in i.rules&&(i.rules[y].meta.docs?.requiresSchema||i.rules[y].meta.docs?.requiresSiblings)||(c[u]=l[u]);}let f=renamePluginsInRules(c,p);return [{name:"2digits:graphql",plugins:{gql:i},languageOptions:{parser:i.parser},files:r,rules:{...f,"gql/naming-convention":["error",{allowLeadingUnderscore:!0}],...t}}]}var j="**/*.?([cm])[jt]s?(x)",h="**/*.?([cm])ts",O="**/*.?([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(i=>i({strict:!1,...t,name:"2digits:gitignore"})))}function z(e={}){let{overrides:t={}}=e;return [{name:"2digits:javascript",languageOptions:{ecmaVersion:2022,globals:{...x.browser,...x.es2021,...x.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{reportUnusedDisableDirectives:!0},rules:{...ne.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 _(){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 q(e={}){let{files:t=[h,O],overrides:r={},parserOptions:i}=e,[a,l]=await Promise.all([o(import('@next/eslint-plugin-next')),o(import('@typescript-eslint/parser'))]),c=renamePluginsInRules({...a.configs.recommended.rules,...a.configs["core-web-vitals"].rules},p);return [{name:"2digits:next/setup",plugins:{next:fixupPluginRules(a)}},{name:"2digits:next/rules",files:t,languageOptions:{parser:l,parserOptions:{ecmaFeatures:{jsx:!0},projectService:!0,...i},sourceType:"module"},rules:{...c,"next/no-html-link-for-pages":"off",...r}}]}function D(){return [{name:"2digits:node",settings:{node:{version:">= 22.0.0"}},plugins:{node:W},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=[h,O],overrides:r={},parserOptions:i,tsconfigRootDir:a,reactCompiler:l=!0}=e,[c,f,u,y,H]=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')),l?o(import('eslint-plugin-react-compiler')):void 0]),b=c.configs.all.plugins,$=renamePluginsInRules({...u.configs.recommended.rules,...u.configs["jsx-runtime"].rules,...f.configs.recommended.rules,...c.configs["recommended-type-checked"].rules},p);return [{name:"2digits:react/setup",plugins:{react:u,"react-dom":b["@eslint-react/dom"],"react-web-api":b["@eslint-react/web-api"],"react-extra":b["@eslint-react"],"react-hooks":fixupPluginRules(f),"react-hooks-extra":b["@eslint-react/hooks-extra"],"react-naming-convention":b["@eslint-react/naming-convention"],...l?{"react-compiler":H}:{}},settings:{react:{version:"detect"}}},{name:"2digits:react/rules",files:t,languageOptions:{parser:y,parserOptions:{ecmaFeatures:{jsx:!0},tsconfigRootDir:a,projectService:!0,...i},sourceType:"module"},rules:{...$,...l?{"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-extra/prefer-read-only-props":"off","react/jsx-curly-newline":"off","react/jsx-newline":["error",{prevent:!1}],"react/prop-types":"off",...r}}]}function N(){return [{name:"2digits:regexp",plugins:{regexp:E},rules:{...E.configs["flat/recommended"].rules}}]}var ce=renamePluginsInRules(k.configs.recommended.rules,p);function G(){return [{name:"2digits:sonar",plugins:{sonar:k},rules:{...ce,"sonar/no-redundant-jump":"off"}}]}async function U(e={}){let{files:t=[F],overrides:r={},parserOptions:i,storybookDirectory:a=".storybook"}=e,[l,c]=await Promise.all([o(import('eslint-plugin-storybook')),o(import('@typescript-eslint/parser'))]),f={parser:c,parserOptions:{ecmaFeatures:{jsx:!0},projectService:!0,...i},sourceType:"module"};return [{name:"2digits:storybook/setup",plugins:{storybook:fixupPluginRules(l)}},{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/meta-inline-properties":"error","storybook/no-redundant-story-name":"error","storybook/no-stories-of":"error","storybook/no-title-property-in-meta":"error","storybook/no-uninstalled-addons":"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","sonar/no-duplicate-string":"off"}},{name:"2digits:storybook/config",files:[`${a}/main.@(js|cjs|mjs|ts)`],languageOptions:f,rules:{"storybook/no-uninstalled-addons":"error"}}]}async function B(e={}){let{overrides:t={}}=e,[r,{tailwindFunctions:i},a]=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:i,config:a}},rules:{...r.configs.recommended.rules,...t}}]}async function M(e={}){let{overrides:t={}}=e,r=await o(import('@tanstack/eslint-plugin-query')),i=renamePluginsInRules(r.configs["flat/recommended"].at(0)?.rules??{},p);return [{name:"2digits:tanstack",plugins:{tanstack:r},rules:{...i,...t}}]}async function A(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 X(e={}){let{overrides:t={},parserOptions:r={}}=e,[{plugin:i,configs:a,parser:l},c]=await Promise.all([o(import('typescript-eslint')),o(import('@2digits/eslint-plugin'))]),f=renamePluginsInConfigs(a.strictTypeChecked,p),u=Object.fromEntries(f.flatMap(({rules:y})=>Object.entries(y??{})));return [{name:"2digits:typescript/setup",plugins:{ts:i,"@2digits":c},languageOptions:{parser:l,parserOptions:{tsconfigRootDir:process.cwd(),projectService:!0,warnOnUnsupportedTypeScriptVersion:!1,...r},sourceType:"module"}},{name:"2digits:typescript/rules",files:[j],rules:{...u,"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",...c.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 V(){return [{name:"2digits:unicorn",plugins:{unicorn:T},rules:{...T.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 g(e,t){return typeof e=="boolean"?e:e?.enable??t??!1}function d(e){if(typeof e=="boolean"||e===void 0)return {};let{enable:t,...r}=e;return r}function ye(e={},...t){let r=new FlatConfigComposer(P(e.ignores),z(e.js),D(),v(),_(),V(),G(),N(),w());g(e.turbo,isPackageExists("turbo"))&&(r=r.append(A(d(e.turbo))));let{overrides:i,...a}=d(e.ts);return g(e.ts,isPackageExists("typescript"))&&(r=r.append(X(d(e.ts)))),g(e.react,isPackageExists("react"))&&(r=r.append(L({...d(e.react),...a}))),g(e.next,isPackageExists("next"))&&(r=r.append(q({...d(e.next),...a}))),g(e.storybook,isPackageExists("storybook"))&&(r=r.append(U({...d(e.storybook),...a}))),g(e.tailwind,isPackageExists("tailwindcss"))&&(r=r.append(B(d(e.tailwind)))),g(e.tanstack,isPackageExists("react-query")||isPackageExists("@tanstack/react-query")||isPackageExists("@tanstack/react-query-devtools"))&&(r=r.append(M(d(e.tanstack)))),g(e.drizzle,isPackageExists("drizzle-kit")||isPackageExists("drizzle-orm"))&&(r=r.append(C(d(e.drizzle)))),g(e.graphql,isPackageExists("graphql"))&&(r=r.append(S(d(e.graphql)))),r=r.append(...t),isPackageExists("prettier")&&(r=r.append(R())),r.renamePlugins(p).toConfigs()}export{w as antfu,v as comments,ye as default,C as drizzle,S as graphql,P as ignores,z as javascript,_ as jsdoc,q as next,D as node,R as prettier,L as react,N as regexp,G as sonar,U as storybook,B as tailwind,M as tanstack,A as turbo,ye as twoDigits,X as typescript,V as unicorn};//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map