@eslint-react/shared 2.0.0-next.1 → 2.0.0-next.10

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
@@ -2,6 +2,16 @@ import { _ } from '@eslint-react/eff';
2
2
  import { RuleContext } from '@eslint-react/kit';
3
3
  import * as z from '@zod/mini';
4
4
 
5
+ /**
6
+ * @internal
7
+ */
8
+ declare const getId: () => string;
9
+
10
+ /**
11
+ * @internal
12
+ */
13
+ declare const _require: NodeJS.Require;
14
+
5
15
  /**
6
16
  * The NPM scope for this project.
7
17
  */
@@ -23,8 +33,6 @@ declare const WEBSITE_URL = "https://eslint-react.xyz";
23
33
  */
24
34
  declare const getDocsUrl: (pluginName: string) => (ruleName: string) => string;
25
35
 
26
- declare const getId: () => string;
27
-
28
36
  declare function getReactVersion(fallback: string): string;
29
37
 
30
38
  /**
@@ -661,27 +669,29 @@ const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true}> = {
661
669
  type PartialDeep<T, Options extends PartialDeepOptions = {}> =
662
670
  _PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
663
671
 
664
- type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | (((...arguments_: any[]) => unknown)) | (new (...arguments_: any[]) => unknown)
672
+ type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown))
665
673
  ? T
666
- : T extends Map<infer KeyType, infer ValueType>
667
- ? PartialMapDeep<KeyType, ValueType, Options>
668
- : T extends Set<infer ItemType>
669
- ? PartialSetDeep<ItemType, Options>
670
- : T extends ReadonlyMap<infer KeyType, infer ValueType>
671
- ? PartialReadonlyMapDeep<KeyType, ValueType, Options>
672
- : T extends ReadonlySet<infer ItemType>
673
- ? PartialReadonlySetDeep<ItemType, Options>
674
- : T extends object
675
- ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
676
- ? Options['recurseIntoArrays'] extends true
677
- ? ItemType[] extends T // Test for arrays (non-tuples) specifically
678
- ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
679
- ? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>>
680
- : Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>>
681
- : PartialObjectDeep<T, Options> // Tuples behave properly
682
- : T // If they don't opt into array testing, just use the original type
683
- : PartialObjectDeep<T, Options>
684
- : unknown;
674
+ : IsNever<keyof T> extends true // For functions with no properties
675
+ ? T
676
+ : T extends Map<infer KeyType, infer ValueType>
677
+ ? PartialMapDeep<KeyType, ValueType, Options>
678
+ : T extends Set<infer ItemType>
679
+ ? PartialSetDeep<ItemType, Options>
680
+ : T extends ReadonlyMap<infer KeyType, infer ValueType>
681
+ ? PartialReadonlyMapDeep<KeyType, ValueType, Options>
682
+ : T extends ReadonlySet<infer ItemType>
683
+ ? PartialReadonlySetDeep<ItemType, Options>
684
+ : T extends object
685
+ ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
686
+ ? Options['recurseIntoArrays'] extends true
687
+ ? ItemType[] extends T // Test for arrays (non-tuples) specifically
688
+ ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
689
+ ? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>>
690
+ : Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>>
691
+ : PartialObjectDeep<T, Options> // Tuples behave properly
692
+ : T // If they don't opt into array testing, just use the original type
693
+ : PartialObjectDeep<T, Options>
694
+ : unknown;
685
695
 
686
696
  /**
687
697
  Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
@@ -706,9 +716,12 @@ type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {
706
716
  /**
707
717
  Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
708
718
  */
709
- type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = {
710
- [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>
711
- };
719
+ type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> =
720
+ (ObjectType extends (...arguments_: any) => unknown
721
+ ? (...arguments_: Parameters<ObjectType>) => ReturnType<ObjectType>
722
+ : {}) & ({
723
+ [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>
724
+ });
712
725
 
713
726
  declare const CustomComponentPropSchema: z.ZodMiniObject<{
714
727
  /**
@@ -1075,4 +1088,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
1075
1088
  }
1076
1089
  }
1077
1090
 
1078
- export { type CustomComponent, type CustomComponentNormalized, type CustomComponentProp, type CustomComponentPropNormalized, CustomComponentPropSchema, CustomComponentSchema, type CustomHooks, CustomHooksSchema, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsNormalized, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, WEBSITE_URL, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getDocsUrl, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, normalizeSettings };
1091
+ export { type CustomComponent, type CustomComponentNormalized, type CustomComponentProp, type CustomComponentPropNormalized, CustomComponentPropSchema, CustomComponentSchema, type CustomHooks, CustomHooksSchema, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsNormalized, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, WEBSITE_URL, _require, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getDocsUrl, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, normalizeSettings };
package/dist/index.js CHANGED
@@ -1,9 +1,15 @@
1
1
  import module from 'node:module';
2
+ import path from 'node:path';
2
3
  import { identity, getOrElseUpdate } from '@eslint-react/eff';
3
4
  import { match, P } from 'ts-pattern';
4
5
  import { RegExp } from '@eslint-react/kit';
5
6
  import * as z from '@zod/mini';
6
7
 
8
+ // src/_id.ts
9
+ var id = 0n;
10
+ var getId = () => (id++).toString();
11
+ var _require = module.createRequire(process.cwd() + path.sep);
12
+
7
13
  // src/constants.ts
8
14
  var NPM_SCOPE = "@eslint-react";
9
15
  var GITHUB_URL = "https://github.com/Rel1cx/eslint-react";
@@ -16,11 +22,6 @@ var getDocsUrl = (pluginName) => (ruleName) => {
16
22
  }
17
23
  return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
18
24
  };
19
-
20
- // src/get-id.ts
21
- var id = 0n;
22
- var getId = () => (id++).toString();
23
- var _require = module.createRequire(import.meta.url);
24
25
  function getReactVersion(fallback) {
25
26
  try {
26
27
  return match(_require("react")).with({ version: P.select(P.string) }, identity).otherwise(() => fallback);
@@ -216,7 +217,6 @@ var normalizeSettings = ({
216
217
  version,
217
218
  ...rest
218
219
  }) => {
219
- const fallbackVersion = DEFAULT_ESLINT_REACT_SETTINGS.version;
220
220
  return {
221
221
  ...rest,
222
222
  components: additionalComponents.map((component) => {
@@ -239,7 +239,7 @@ var normalizeSettings = ({
239
239
  polymorphicPropName,
240
240
  skipImportCheck,
241
241
  strict,
242
- version: match(version).with(P.union(P.nullish, "", "detect"), () => getReactVersion(fallbackVersion)).otherwise(identity)
242
+ version: match(version).with(P.union(P.nullish, "", "detect"), () => getReactVersion("19.1.0")).otherwise(identity)
243
243
  };
244
244
  };
245
245
  var cache = /* @__PURE__ */ new Map();
@@ -253,4 +253,4 @@ function getSettingsFromContext(context) {
253
253
  }
254
254
  var defineSettings = identity;
255
255
 
256
- export { CustomComponentPropSchema, CustomComponentSchema, CustomHooksSchema, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, WEBSITE_URL, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getDocsUrl, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, normalizeSettings };
256
+ export { CustomComponentPropSchema, CustomComponentSchema, CustomHooksSchema, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, WEBSITE_URL, _require, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getDocsUrl, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, normalizeSettings };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/shared",
3
- "version": "2.0.0-next.1",
3
+ "version": "2.0.0-next.10",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -27,17 +27,17 @@
27
27
  "./package.json"
28
28
  ],
29
29
  "dependencies": {
30
- "@typescript-eslint/utils": "^8.30.1",
31
- "@zod/mini": "^4.0.0-beta.20250418T073619",
30
+ "@typescript-eslint/utils": "^8.31.1",
31
+ "@zod/mini": "^4.0.0-beta.20250424T163858",
32
32
  "ts-pattern": "^5.7.0",
33
- "@eslint-react/eff": "2.0.0-next.1",
34
- "@eslint-react/kit": "2.0.0-next.1"
33
+ "@eslint-react/kit": "2.0.0-next.10",
34
+ "@eslint-react/eff": "2.0.0-next.10"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@tsconfig/node22": "^22.0.1",
38
38
  "@types/picomatch": "^4.0.0",
39
39
  "tsup": "^8.4.0",
40
- "type-fest": "^4.40.0",
40
+ "type-fest": "^4.40.1",
41
41
  "@local/configs": "0.0.0"
42
42
  },
43
43
  "engines": {