@eslint-react/shared 1.23.3-next.8 → 1.24.0-beta.1

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
@@ -7,7 +7,7 @@ declare const NPM_SCOPE = "@eslint-react";
7
7
  /**
8
8
  * The GitHub repository for this project.
9
9
  */
10
- declare const GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
10
+ declare const GITHUB_URL = "https://github.com/Rel1cx/eslint-react";
11
11
  /**
12
12
  * The URL to the project's website.
13
13
  */
@@ -1491,7 +1491,7 @@ declare const CustomComponentSchema: ObjectSchema<{
1491
1491
  }, undefined>;
1492
1492
  declare const CustomComponentNormalizedSchema: ObjectSchema<{
1493
1493
  readonly name: StringSchema<undefined>;
1494
- readonly as: OptionalSchema<StringSchema<undefined>, undefined>;
1494
+ readonly as: StringSchema<undefined>;
1495
1495
  readonly attributes: OptionalSchema<ArraySchema<ObjectSchema<{
1496
1496
  /**
1497
1497
  * The name of the attribute in the user-defined component.
@@ -1917,7 +1917,6 @@ type ESLintSettings = InferOutput<typeof ESLintSettingsSchema>;
1917
1917
  */
1918
1918
  interface ESLintReactSettingsNormalized extends ESLintReactSettings {
1919
1919
  additionalComponents: CustomComponentNormalized[];
1920
- components: Map<string, string>;
1921
1920
  version: string;
1922
1921
  }
1923
1922
 
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ declare const NPM_SCOPE = "@eslint-react";
7
7
  /**
8
8
  * The GitHub repository for this project.
9
9
  */
10
- declare const GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
10
+ declare const GITHUB_URL = "https://github.com/Rel1cx/eslint-react";
11
11
  /**
12
12
  * The URL to the project's website.
13
13
  */
@@ -1491,7 +1491,7 @@ declare const CustomComponentSchema: ObjectSchema<{
1491
1491
  }, undefined>;
1492
1492
  declare const CustomComponentNormalizedSchema: ObjectSchema<{
1493
1493
  readonly name: StringSchema<undefined>;
1494
- readonly as: OptionalSchema<StringSchema<undefined>, undefined>;
1494
+ readonly as: StringSchema<undefined>;
1495
1495
  readonly attributes: OptionalSchema<ArraySchema<ObjectSchema<{
1496
1496
  /**
1497
1497
  * The name of the attribute in the user-defined component.
@@ -1917,7 +1917,6 @@ type ESLintSettings = InferOutput<typeof ESLintSettingsSchema>;
1917
1917
  */
1918
1918
  interface ESLintReactSettingsNormalized extends ESLintReactSettings {
1919
1919
  additionalComponents: CustomComponentNormalized[];
1920
- components: Map<string, string>;
1921
1920
  version: string;
1922
1921
  }
1923
1922
 
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var pm__default = /*#__PURE__*/_interopDefault(pm);
14
14
 
15
15
  // src/constants.ts
16
16
  var NPM_SCOPE = "@eslint-react";
17
- var GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
17
+ var GITHUB_URL = "https://github.com/Rel1cx/eslint-react";
18
18
  var WEBSITE_URL = "https://eslint-react.xyz";
19
19
  var RE_PASCAL_CASE = /^[A-Z][\dA-Za-z]*$/u;
20
20
  var RE_CAMEL_CASE = /^[a-z][\dA-Za-z]*$/u;
@@ -224,7 +224,7 @@ var createRuleForPlugin = (pluginName) => utils.ESLintUtils.RuleCreator(getDocsU
224
224
  var _require = module__default.default.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
225
225
  function getReactVersion(fallback = "19.0.0") {
226
226
  try {
227
- return tsPattern.match(_require("react")).with({ version: tsPattern.P.select(tsPattern.P.string) }, eff.F.identity).otherwise(eff.F.constant(fallback));
227
+ return tsPattern.match(_require("react")).with({ version: tsPattern.P.select(tsPattern.P.string) }, eff.identity).otherwise(() => fallback);
228
228
  } catch {
229
229
  return fallback;
230
230
  }
@@ -614,7 +614,7 @@ var CustomComponentSchema = object({
614
614
  });
615
615
  var CustomComponentNormalizedSchema = object({
616
616
  name: string(),
617
- as: optional(string()),
617
+ as: string(),
618
618
  attributes: optional(array(CustomAttributeSchema), []),
619
619
  re: instance(RegExp),
620
620
  selector: optional(string())
@@ -1419,29 +1419,20 @@ var normalizeSettings = createMemoizedFunction((settings) => {
1419
1419
  ...settings,
1420
1420
  additionalComponents: additionalComponents.map((component) => ({
1421
1421
  ...component,
1422
+ as: component.as ?? component.name,
1422
1423
  attributes: component.attributes?.map((attr) => ({
1423
1424
  ...attr,
1424
1425
  as: attr.as ?? attr.name
1425
1426
  })) ?? [],
1426
1427
  re: pm__default.default.makeRe(component.name, { fastpaths: true })
1427
1428
  })),
1428
- components: additionalComponents.reduce((acc, component) => {
1429
- const { name, as, attributes = [], selector } = component;
1430
- if (!name || !as || selector || attributes.length > 0) {
1431
- return acc;
1432
- }
1433
- if (!/^[\w-]+$/u.test(name)) {
1434
- return acc;
1435
- }
1436
- return acc.set(name, as);
1437
- }, /* @__PURE__ */ new Map()),
1438
- version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(eff.F.identity)
1429
+ version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(eff.identity)
1439
1430
  };
1440
1431
  }, { isEqual: shallowEqual });
1441
1432
  function getSettingsFromContext(context) {
1442
1433
  return normalizeSettings(decodeSettings(context.settings));
1443
1434
  }
1444
- var defineSettings = eff.F.identity;
1435
+ var defineSettings = eff.identity;
1445
1436
 
1446
1437
  exports.CustomAttributeSchema = CustomAttributeSchema;
1447
1438
  exports.CustomComponentNormalizedSchema = CustomComponentNormalizedSchema;
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import { ESLintUtils } from '@typescript-eslint/utils';
2
2
  import module from 'node:module';
3
- import { F } from '@eslint-react/eff';
3
+ import { identity } from '@eslint-react/eff';
4
4
  import { match, P } from 'ts-pattern';
5
5
  import pm from 'picomatch';
6
6
 
7
7
  // src/constants.ts
8
8
  var NPM_SCOPE = "@eslint-react";
9
- var GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
9
+ var GITHUB_URL = "https://github.com/Rel1cx/eslint-react";
10
10
  var WEBSITE_URL = "https://eslint-react.xyz";
11
11
  var RE_PASCAL_CASE = /^[A-Z][\dA-Za-z]*$/u;
12
12
  var RE_CAMEL_CASE = /^[a-z][\dA-Za-z]*$/u;
@@ -216,7 +216,7 @@ var createRuleForPlugin = (pluginName) => ESLintUtils.RuleCreator(getDocsUrl(plu
216
216
  var _require = module.createRequire(import.meta.url);
217
217
  function getReactVersion(fallback = "19.0.0") {
218
218
  try {
219
- return match(_require("react")).with({ version: P.select(P.string) }, F.identity).otherwise(F.constant(fallback));
219
+ return match(_require("react")).with({ version: P.select(P.string) }, identity).otherwise(() => fallback);
220
220
  } catch {
221
221
  return fallback;
222
222
  }
@@ -606,7 +606,7 @@ var CustomComponentSchema = object({
606
606
  });
607
607
  var CustomComponentNormalizedSchema = object({
608
608
  name: string(),
609
- as: optional(string()),
609
+ as: string(),
610
610
  attributes: optional(array(CustomAttributeSchema), []),
611
611
  re: instance(RegExp),
612
612
  selector: optional(string())
@@ -1411,28 +1411,19 @@ var normalizeSettings = createMemoizedFunction((settings) => {
1411
1411
  ...settings,
1412
1412
  additionalComponents: additionalComponents.map((component) => ({
1413
1413
  ...component,
1414
+ as: component.as ?? component.name,
1414
1415
  attributes: component.attributes?.map((attr) => ({
1415
1416
  ...attr,
1416
1417
  as: attr.as ?? attr.name
1417
1418
  })) ?? [],
1418
1419
  re: pm.makeRe(component.name, { fastpaths: true })
1419
1420
  })),
1420
- components: additionalComponents.reduce((acc, component) => {
1421
- const { name, as, attributes = [], selector } = component;
1422
- if (!name || !as || selector || attributes.length > 0) {
1423
- return acc;
1424
- }
1425
- if (!/^[\w-]+$/u.test(name)) {
1426
- return acc;
1427
- }
1428
- return acc.set(name, as);
1429
- }, /* @__PURE__ */ new Map()),
1430
- version: match(settings.version).with(P.union(P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(F.identity)
1421
+ version: match(settings.version).with(P.union(P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(identity)
1431
1422
  };
1432
1423
  }, { isEqual: shallowEqual });
1433
1424
  function getSettingsFromContext(context) {
1434
1425
  return normalizeSettings(decodeSettings(context.settings));
1435
1426
  }
1436
- var defineSettings = F.identity;
1427
+ var defineSettings = identity;
1437
1428
 
1438
1429
  export { CustomAttributeSchema, CustomComponentNormalizedSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, DOM_HTML_COMPONENT_TYPES, DOM_SVG_COMPONENT_TYPES, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, getSettingsFromContext, normalizeSettings, unsafeDecodeSettings };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@eslint-react/shared",
3
- "version": "1.23.3-next.8",
3
+ "version": "1.24.0-beta.1",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
- "homepage": "https://github.com/rEl1cx/eslint-react",
5
+ "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
7
- "url": "https://github.com/rEl1cx/eslint-react/issues"
7
+ "url": "https://github.com/Rel1cx/eslint-react/issues"
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://github.com/rEl1cx/eslint-react.git",
11
+ "url": "git+https://github.com/Rel1cx/eslint-react.git",
12
12
  "directory": "packages/shared"
13
13
  },
14
14
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "@typescript-eslint/utils": "^8.19.1",
37
37
  "picomatch": "^4.0.2",
38
38
  "ts-pattern": "^5.6.0",
39
- "@eslint-react/eff": "1.23.3-next.8"
39
+ "@eslint-react/eff": "1.24.0-beta.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/picomatch": "^3.0.1",