@eslint-react/shared 1.17.0 → 1.17.1-beta.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.mts CHANGED
@@ -1786,6 +1786,7 @@ type ESLintSettings = InferOutput<typeof ESLintSettingsSchema>;
1786
1786
  interface ESLintReactSettingsNormalized extends ESLintReactSettings {
1787
1787
  additionalComponents: CustomComponentNormalized[];
1788
1788
  components: Map<string, string>;
1789
+ version: string;
1789
1790
  }
1790
1791
 
1791
1792
  interface Dictionary<Type> {
@@ -2092,13 +2093,13 @@ declare const decodeSettings: Memoized<(data: unknown) => {
2092
2093
  declare const normalizeSettings: Memoized<(settings: ESLintReactSettings) => {
2093
2094
  readonly additionalComponents: CustomComponentNormalized[];
2094
2095
  readonly components: Map<string, string>;
2096
+ readonly version: string;
2095
2097
  readonly importSource?: string;
2096
2098
  readonly jsxPragma?: string;
2097
2099
  readonly jsxPragmaFrag?: string;
2098
2100
  readonly polymorphicPropName?: string;
2099
2101
  readonly strict?: boolean;
2100
2102
  readonly strictImportCheck?: boolean;
2101
- readonly version?: string;
2102
2103
  readonly additionalHooks?: {
2103
2104
  use?: string[];
2104
2105
  useActionState?: string[];
package/dist/index.d.ts CHANGED
@@ -1786,6 +1786,7 @@ type ESLintSettings = InferOutput<typeof ESLintSettingsSchema>;
1786
1786
  interface ESLintReactSettingsNormalized extends ESLintReactSettings {
1787
1787
  additionalComponents: CustomComponentNormalized[];
1788
1788
  components: Map<string, string>;
1789
+ version: string;
1789
1790
  }
1790
1791
 
1791
1792
  interface Dictionary<Type> {
@@ -2092,13 +2093,13 @@ declare const decodeSettings: Memoized<(data: unknown) => {
2092
2093
  declare const normalizeSettings: Memoized<(settings: ESLintReactSettings) => {
2093
2094
  readonly additionalComponents: CustomComponentNormalized[];
2094
2095
  readonly components: Map<string, string>;
2096
+ readonly version: string;
2095
2097
  readonly importSource?: string;
2096
2098
  readonly jsxPragma?: string;
2097
2099
  readonly jsxPragmaFrag?: string;
2098
2100
  readonly polymorphicPropName?: string;
2099
2101
  readonly strict?: boolean;
2100
2102
  readonly strictImportCheck?: boolean;
2101
- readonly version?: string;
2102
2103
  readonly additionalHooks?: {
2103
2104
  use?: string[];
2104
2105
  useActionState?: string[];
package/dist/index.js CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  var utils = require('@typescript-eslint/utils');
4
4
  var tools = require('@eslint-react/tools');
5
+ var localPkg = require('local-pkg');
5
6
  var pm = require('picomatch');
7
+ var tsPattern = require('ts-pattern');
6
8
 
7
9
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
10
 
@@ -1332,7 +1334,8 @@ var normalizeSettings = createMemoizedFunction((settings) => {
1332
1334
  if (!name || !as || selector || attributes.length > 0) return acc;
1333
1335
  if (!/^[\w-]+$/u.test(name)) return acc;
1334
1336
  return acc.set(name, as);
1335
- }, /* @__PURE__ */ new Map())
1337
+ }, /* @__PURE__ */ new Map()),
1338
+ version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => localPkg.getPackageInfoSync("react")?.version).otherwise(tools.F.identity) ?? "18.3.1"
1336
1339
  });
1337
1340
  }, { isEqual: shallowEqual });
1338
1341
  var defineSettings = tools.F.identity;
package/dist/index.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  import { ESLintUtils } from '@typescript-eslint/utils';
2
2
  import { F, Data } from '@eslint-react/tools';
3
+ import { getPackageInfoSync } from 'local-pkg';
3
4
  import pm from 'picomatch';
5
+ import { match, P } from 'ts-pattern';
4
6
 
5
7
  // src/constants.ts
6
8
  var NPM_SCOPE = "@eslint-react";
@@ -1326,7 +1328,8 @@ var normalizeSettings = createMemoizedFunction((settings) => {
1326
1328
  if (!name || !as || selector || attributes.length > 0) return acc;
1327
1329
  if (!/^[\w-]+$/u.test(name)) return acc;
1328
1330
  return acc.set(name, as);
1329
- }, /* @__PURE__ */ new Map())
1331
+ }, /* @__PURE__ */ new Map()),
1332
+ version: match(settings.version).with(P.union(P.nullish, "", "detect"), () => getPackageInfoSync("react")?.version).otherwise(F.identity) ?? "18.3.1"
1330
1333
  });
1331
1334
  }, { isEqual: shallowEqual });
1332
1335
  var defineSettings = F.identity;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/shared",
3
- "version": "1.17.0",
3
+ "version": "1.17.1-beta.0",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
5
  "homepage": "https://github.com/rel1cx/eslint-react",
6
6
  "bugs": {
@@ -36,8 +36,10 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@typescript-eslint/utils": "^8.15.0",
39
+ "local-pkg": "^0.5.1",
39
40
  "picomatch": "^4.0.2",
40
- "@eslint-react/tools": "1.17.0"
41
+ "ts-pattern": "^5.5.0",
42
+ "@eslint-react/tools": "1.17.1-beta.0"
41
43
  },
42
44
  "devDependencies": {
43
45
  "@types/picomatch": "^3.0.1",