@eslint-react/shared 1.6.1-next.0 → 1.6.1-next.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
@@ -8,18 +8,42 @@ import * as micro_memoize from 'micro-memoize';
8
8
  * Meta
9
9
  * -----------------------------------------------------------------------------
10
10
  */
11
+ /**
12
+ * The NPM scope for this project.
13
+ */
11
14
  declare const NPM_SCOPE = "@eslint-react";
12
- declare const GITHUB_URL = "https://github.com/rel1cx/eslint-react/blob/main";
15
+ /**
16
+ * The GitHub repository for this project.
17
+ */
18
+ declare const GITHUB_URL = "https://github.com/rel1cx/eslint-react";
19
+ /**
20
+ * The URL to the project's website.
21
+ */
13
22
  declare const WEBSITE_URL = "https://eslint-react.xyz";
14
23
  /**
15
24
  * -----------------------------------------------------------------------------
16
25
  * RegExps
17
26
  * -----------------------------------------------------------------------------
18
27
  */
28
+ /**
29
+ * Regular expression for matching a PascalCase string.
30
+ */
19
31
  declare const RE_PASCAL_CASE: RegExp;
32
+ /**
33
+ * Regular expression for matching a camelCase string.
34
+ */
20
35
  declare const RE_CAMEL_CASE: RegExp;
36
+ /**
37
+ * Regular expression for matching a kebab-case string.
38
+ */
21
39
  declare const RE_KEBAB_CASE: RegExp;
40
+ /**
41
+ * Regular expression for matching a snake_case string.
42
+ */
22
43
  declare const RE_SNAKE_CASE: RegExp;
44
+ /**
45
+ * Regular expression for matching a CONSTANT_CASE string.
46
+ */
23
47
  declare const RE_CONSTANT_CASE: RegExp;
24
48
  declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
25
49
  /**
@@ -36,6 +60,11 @@ declare const HOST_HTML_COMPONENT_TYPES: readonly ["aside", "audio", "b", "base"
36
60
  */
37
61
  declare const HOST_SVG_COMPONENT_TYPES: readonly ["a", "animate", "animateMotion", "animateTransform", "circle", "clipPath", "defs", "desc", "discard", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "foreignObject", "g", "hatch", "hatchpath", "image", "line", "linearGradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "script", "set", "stop", "style", "svg", "switch", "symbol", "text", "textPath", "title", "tspan", "use", "view"];
38
62
 
63
+ /**
64
+ * Get the ESLint rule creator for a plugin.
65
+ * @param pluginName The name of the plugin.
66
+ * @returns The ESLint rule creator.
67
+ */
39
68
  declare const createRuleForPlugin: (pluginName: string) => <Options extends readonly unknown[], MessageIds extends string>({ name, meta, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds>>) => ESLintUtils.RuleModule<MessageIds, Options>;
40
69
 
41
70
  /**
@@ -379,12 +408,21 @@ declare const ESLintSettingsSchema: valibot.OptionalSchema<valibot.ObjectSchema<
379
408
  }, undefined>, never>;
380
409
  }, undefined>, {}>;
381
410
  }, undefined>, {}>;
382
- type CustomHook = InferOutput<typeof CustomHookSchema>;
383
- type CustomAttribute = InferOutput<typeof CustomAttributeSchema>;
384
- type CustomComponent = InferOutput<typeof CustomComponentSchema>;
385
- type ESLintReactSettings = InferOutput<typeof ESLintReactSettingsSchema>;
386
- type ESLintSettings = InferOutput<typeof ESLintSettingsSchema>;
411
+ interface CustomHook extends InferOutput<typeof CustomHookSchema> {
412
+ }
413
+ interface CustomAttribute extends InferOutput<typeof CustomAttributeSchema> {
414
+ }
415
+ interface CustomComponent extends InferOutput<typeof CustomComponentSchema> {
416
+ }
417
+ interface ESLintReactSettings extends InferOutput<typeof ESLintReactSettingsSchema> {
418
+ }
419
+ interface ESLintSettings extends InferOutput<typeof ESLintSettingsSchema> {
420
+ }
387
421
 
422
+ /**
423
+ * This is an expanded version of `CustomComponent` with all shorthand properties expanded.
424
+ * @internal
425
+ */
388
426
  interface CustomComponentExpanded extends CustomComponent {
389
427
  attributes: {
390
428
  name: string;
@@ -392,11 +430,30 @@ interface CustomComponentExpanded extends CustomComponent {
392
430
  }[];
393
431
  re: RegExp;
394
432
  }
433
+ /**
434
+ * This is an expanded version of `ESLintReactSettings` with all shorthand properties expanded.
435
+ * @internal
436
+ */
395
437
  interface ESLintReactSettingsExpanded extends ESLintReactSettings {
396
438
  additionalComponents: CustomComponentExpanded[];
397
439
  }
440
+ /**
441
+ * Decodes settings from a data object from `context.settings`.
442
+ * @param data The data object.
443
+ * @returns settings The settings.
444
+ * @internal
445
+ */
398
446
  declare function decodeSettings(data: unknown): ESLintReactSettings;
447
+ /**
448
+ * Expands the settings by converting all shorthand properties to their full form.
449
+ * @param settings The settings.
450
+ * @returns The expanded settings.
451
+ * @internal
452
+ */
399
453
  declare const expandSettings: micro_memoize.Memoized<(settings: ESLintReactSettings) => ESLintReactSettingsExpanded>;
454
+ /**
455
+ * The default ESLint settings for "react-x".
456
+ */
400
457
  declare const DEFAULT_ESLINT_REACT_SETTINGS: ESLintReactSettings;
401
458
 
402
459
  export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentExpanded, CustomComponentSchema, type CustomHook, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsExpanded, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, expandSettings };
package/dist/index.d.ts CHANGED
@@ -8,18 +8,42 @@ import * as micro_memoize from 'micro-memoize';
8
8
  * Meta
9
9
  * -----------------------------------------------------------------------------
10
10
  */
11
+ /**
12
+ * The NPM scope for this project.
13
+ */
11
14
  declare const NPM_SCOPE = "@eslint-react";
12
- declare const GITHUB_URL = "https://github.com/rel1cx/eslint-react/blob/main";
15
+ /**
16
+ * The GitHub repository for this project.
17
+ */
18
+ declare const GITHUB_URL = "https://github.com/rel1cx/eslint-react";
19
+ /**
20
+ * The URL to the project's website.
21
+ */
13
22
  declare const WEBSITE_URL = "https://eslint-react.xyz";
14
23
  /**
15
24
  * -----------------------------------------------------------------------------
16
25
  * RegExps
17
26
  * -----------------------------------------------------------------------------
18
27
  */
28
+ /**
29
+ * Regular expression for matching a PascalCase string.
30
+ */
19
31
  declare const RE_PASCAL_CASE: RegExp;
32
+ /**
33
+ * Regular expression for matching a camelCase string.
34
+ */
20
35
  declare const RE_CAMEL_CASE: RegExp;
36
+ /**
37
+ * Regular expression for matching a kebab-case string.
38
+ */
21
39
  declare const RE_KEBAB_CASE: RegExp;
40
+ /**
41
+ * Regular expression for matching a snake_case string.
42
+ */
22
43
  declare const RE_SNAKE_CASE: RegExp;
44
+ /**
45
+ * Regular expression for matching a CONSTANT_CASE string.
46
+ */
23
47
  declare const RE_CONSTANT_CASE: RegExp;
24
48
  declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
25
49
  /**
@@ -36,6 +60,11 @@ declare const HOST_HTML_COMPONENT_TYPES: readonly ["aside", "audio", "b", "base"
36
60
  */
37
61
  declare const HOST_SVG_COMPONENT_TYPES: readonly ["a", "animate", "animateMotion", "animateTransform", "circle", "clipPath", "defs", "desc", "discard", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "foreignObject", "g", "hatch", "hatchpath", "image", "line", "linearGradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "script", "set", "stop", "style", "svg", "switch", "symbol", "text", "textPath", "title", "tspan", "use", "view"];
38
62
 
63
+ /**
64
+ * Get the ESLint rule creator for a plugin.
65
+ * @param pluginName The name of the plugin.
66
+ * @returns The ESLint rule creator.
67
+ */
39
68
  declare const createRuleForPlugin: (pluginName: string) => <Options extends readonly unknown[], MessageIds extends string>({ name, meta, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds>>) => ESLintUtils.RuleModule<MessageIds, Options>;
40
69
 
41
70
  /**
@@ -379,12 +408,21 @@ declare const ESLintSettingsSchema: valibot.OptionalSchema<valibot.ObjectSchema<
379
408
  }, undefined>, never>;
380
409
  }, undefined>, {}>;
381
410
  }, undefined>, {}>;
382
- type CustomHook = InferOutput<typeof CustomHookSchema>;
383
- type CustomAttribute = InferOutput<typeof CustomAttributeSchema>;
384
- type CustomComponent = InferOutput<typeof CustomComponentSchema>;
385
- type ESLintReactSettings = InferOutput<typeof ESLintReactSettingsSchema>;
386
- type ESLintSettings = InferOutput<typeof ESLintSettingsSchema>;
411
+ interface CustomHook extends InferOutput<typeof CustomHookSchema> {
412
+ }
413
+ interface CustomAttribute extends InferOutput<typeof CustomAttributeSchema> {
414
+ }
415
+ interface CustomComponent extends InferOutput<typeof CustomComponentSchema> {
416
+ }
417
+ interface ESLintReactSettings extends InferOutput<typeof ESLintReactSettingsSchema> {
418
+ }
419
+ interface ESLintSettings extends InferOutput<typeof ESLintSettingsSchema> {
420
+ }
387
421
 
422
+ /**
423
+ * This is an expanded version of `CustomComponent` with all shorthand properties expanded.
424
+ * @internal
425
+ */
388
426
  interface CustomComponentExpanded extends CustomComponent {
389
427
  attributes: {
390
428
  name: string;
@@ -392,11 +430,30 @@ interface CustomComponentExpanded extends CustomComponent {
392
430
  }[];
393
431
  re: RegExp;
394
432
  }
433
+ /**
434
+ * This is an expanded version of `ESLintReactSettings` with all shorthand properties expanded.
435
+ * @internal
436
+ */
395
437
  interface ESLintReactSettingsExpanded extends ESLintReactSettings {
396
438
  additionalComponents: CustomComponentExpanded[];
397
439
  }
440
+ /**
441
+ * Decodes settings from a data object from `context.settings`.
442
+ * @param data The data object.
443
+ * @returns settings The settings.
444
+ * @internal
445
+ */
398
446
  declare function decodeSettings(data: unknown): ESLintReactSettings;
447
+ /**
448
+ * Expands the settings by converting all shorthand properties to their full form.
449
+ * @param settings The settings.
450
+ * @returns The expanded settings.
451
+ * @internal
452
+ */
399
453
  declare const expandSettings: micro_memoize.Memoized<(settings: ESLintReactSettings) => ESLintReactSettingsExpanded>;
454
+ /**
455
+ * The default ESLint settings for "react-x".
456
+ */
400
457
  declare const DEFAULT_ESLINT_REACT_SETTINGS: ESLintReactSettings;
401
458
 
402
459
  export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentExpanded, CustomComponentSchema, type CustomHook, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsExpanded, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, expandSettings };
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var pm__default = /*#__PURE__*/_interopDefault(pm);
9
9
 
10
10
  // src/constants.ts
11
11
  var NPM_SCOPE = "@eslint-react";
12
- var GITHUB_URL = "https://github.com/rel1cx/eslint-react/blob/main";
12
+ var GITHUB_URL = "https://github.com/rel1cx/eslint-react";
13
13
  var WEBSITE_URL = "https://eslint-react.xyz";
14
14
  var RE_PASCAL_CASE = /^[A-Z][\dA-Za-z]*$/u;
15
15
  var RE_CAMEL_CASE = /^[a-z][\dA-Za-z]*$/u;
@@ -867,7 +867,7 @@ var expandSettings = createMemoizedFunction((settings) => {
867
867
  ...attr,
868
868
  as: attr.as ?? attr.name
869
869
  })) ?? [],
870
- re: pm__default.default.toRegex(pm__default.default.parse(component.name).output)
870
+ re: pm__default.default.makeRe(component.name, { fastpaths: true })
871
871
  })) ?? []
872
872
  };
873
873
  }, { isDeepEqual: false });
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import pm from 'picomatch';
3
3
 
4
4
  // src/constants.ts
5
5
  var NPM_SCOPE = "@eslint-react";
6
- var GITHUB_URL = "https://github.com/rel1cx/eslint-react/blob/main";
6
+ var GITHUB_URL = "https://github.com/rel1cx/eslint-react";
7
7
  var WEBSITE_URL = "https://eslint-react.xyz";
8
8
  var RE_PASCAL_CASE = /^[A-Z][\dA-Za-z]*$/u;
9
9
  var RE_CAMEL_CASE = /^[a-z][\dA-Za-z]*$/u;
@@ -861,7 +861,7 @@ var expandSettings = createMemoizedFunction((settings) => {
861
861
  ...attr,
862
862
  as: attr.as ?? attr.name
863
863
  })) ?? [],
864
- re: pm.toRegex(pm.parse(component.name).output)
864
+ re: pm.makeRe(component.name, { fastpaths: true })
865
865
  })) ?? []
866
866
  };
867
867
  }, { isDeepEqual: false });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/shared",
3
- "version": "1.6.1-next.0",
3
+ "version": "1.6.1-next.1",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
5
  "homepage": "https://github.com/rel1cx/eslint-react",
6
6
  "bugs": {