@eslint-react/shared 1.16.2-beta.1 → 1.16.2-beta.3

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.js CHANGED
@@ -213,8 +213,6 @@ var getDocsUrl = (pluginName) => (ruleName) => {
213
213
  return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
214
214
  };
215
215
  var createRuleForPlugin = (pluginName) => utils.ESLintUtils.RuleCreator(getDocsUrl(pluginName));
216
-
217
- // ../../node_modules/.pnpm/valibot@1.0.0-beta.3_typescript@5.6.3/node_modules/valibot/dist/index.js
218
216
  var store;
219
217
  function getGlobalConfig(config2) {
220
218
  return {
@@ -318,16 +316,14 @@ function array(item, message) {
318
316
  async: false,
319
317
  item,
320
318
  message,
321
- "~standard": 1,
322
- "~vendor": "valibot",
323
- "~validate"(dataset, config2 = getGlobalConfig()) {
319
+ _run(dataset, config2) {
324
320
  const input = dataset.value;
325
321
  if (Array.isArray(input)) {
326
322
  dataset.typed = true;
327
323
  dataset.value = [];
328
324
  for (let key = 0; key < input.length; key++) {
329
325
  const value2 = input[key];
330
- const itemDataset = this.item["~validate"]({ value: value2 }, config2);
326
+ const itemDataset = this.item._run({ typed: false, value: value2 }, config2);
331
327
  if (itemDataset.issues) {
332
328
  const pathItem = {
333
329
  type: "array",
@@ -372,9 +368,7 @@ function boolean(message) {
372
368
  expects: "boolean",
373
369
  async: false,
374
370
  message,
375
- "~standard": 1,
376
- "~vendor": "valibot",
377
- "~validate"(dataset, config2 = getGlobalConfig()) {
371
+ _run(dataset, config2) {
378
372
  if (typeof dataset.value === "boolean") {
379
373
  dataset.typed = true;
380
374
  } else {
@@ -393,9 +387,7 @@ function instance(class_, message) {
393
387
  async: false,
394
388
  class: class_,
395
389
  message,
396
- "~standard": 1,
397
- "~vendor": "valibot",
398
- "~validate"(dataset, config2 = getGlobalConfig()) {
390
+ _run(dataset, config2) {
399
391
  if (dataset.value instanceof this.class) {
400
392
  dataset.typed = true;
401
393
  } else {
@@ -414,17 +406,15 @@ function object(entries, message) {
414
406
  async: false,
415
407
  entries,
416
408
  message,
417
- "~standard": 1,
418
- "~vendor": "valibot",
419
- "~validate"(dataset, config2 = getGlobalConfig()) {
409
+ _run(dataset, config2) {
420
410
  const input = dataset.value;
421
411
  if (input && typeof input === "object") {
422
412
  dataset.typed = true;
423
413
  dataset.value = {};
424
414
  for (const key in this.entries) {
425
415
  const value2 = input[key];
426
- const valueDataset = this.entries[key]["~validate"](
427
- { value: value2 },
416
+ const valueDataset = this.entries[key]._run(
417
+ { typed: false, value: value2 },
428
418
  config2
429
419
  );
430
420
  if (valueDataset.issues) {
@@ -465,30 +455,35 @@ function object(entries, message) {
465
455
  }
466
456
  };
467
457
  }
468
- function optional(wrapped, default_) {
469
- return {
458
+ function optional(wrapped, ...args) {
459
+ const schema = {
470
460
  kind: "schema",
471
461
  type: "optional",
472
462
  reference: optional,
473
463
  expects: `(${wrapped.expects} | undefined)`,
474
464
  async: false,
475
465
  wrapped,
476
- default: default_,
477
- "~standard": 1,
478
- "~vendor": "valibot",
479
- "~validate"(dataset, config2 = getGlobalConfig()) {
466
+ _run(dataset, config2) {
480
467
  if (dataset.value === void 0) {
481
- if (this.default !== void 0) {
482
- dataset.value = getDefault(this, dataset, config2);
468
+ if ("default" in this) {
469
+ dataset.value = getDefault(
470
+ this,
471
+ dataset,
472
+ config2
473
+ );
483
474
  }
484
475
  if (dataset.value === void 0) {
485
476
  dataset.typed = true;
486
477
  return dataset;
487
478
  }
488
479
  }
489
- return this.wrapped["~validate"](dataset, config2);
480
+ return this.wrapped._run(dataset, config2);
490
481
  }
491
482
  };
483
+ if (0 in args) {
484
+ schema.default = args[0];
485
+ }
486
+ return schema;
492
487
  }
493
488
  function string(message) {
494
489
  return {
@@ -498,9 +493,7 @@ function string(message) {
498
493
  expects: "string",
499
494
  async: false,
500
495
  message,
501
- "~standard": 1,
502
- "~vendor": "valibot",
503
- "~validate"(dataset, config2 = getGlobalConfig()) {
496
+ _run(dataset, config2) {
504
497
  if (typeof dataset.value === "string") {
505
498
  dataset.typed = true;
506
499
  } else {
@@ -511,8 +504,8 @@ function string(message) {
511
504
  };
512
505
  }
513
506
  function parse(schema, input, config2) {
514
- const dataset = schema["~validate"](
515
- { value: input },
507
+ const dataset = schema._run(
508
+ { typed: false, value: input },
516
509
  getGlobalConfig(config2)
517
510
  );
518
511
  if (dataset.issues) {
@@ -1344,13 +1337,6 @@ var normalizeSettings = createMemoizedFunction((settings) => {
1344
1337
  }, /* @__PURE__ */ new Map())
1345
1338
  });
1346
1339
  }, { isEqual: shallowEqual });
1347
- function findAttrInCustomAttributes(name, attributes) {
1348
- return tools.F.pipe(
1349
- tools.O.fromNullable(attributes.findLast((a) => a.as === name)),
1350
- tools.O.map((a) => [a.name, a.defaultValue]),
1351
- tools.O.getOrElse(() => [name])
1352
- );
1353
- }
1354
1340
  var defineSettings = tools.F.identity;
1355
1341
 
1356
1342
  exports.CustomAttributeSchema = CustomAttributeSchema;
@@ -1375,6 +1361,5 @@ exports.WEBSITE_URL = WEBSITE_URL;
1375
1361
  exports.createRuleForPlugin = createRuleForPlugin;
1376
1362
  exports.decodeSettings = decodeSettings;
1377
1363
  exports.defineSettings = defineSettings;
1378
- exports.findAttrInCustomAttributes = findAttrInCustomAttributes;
1379
1364
  exports.normalizeSettings = normalizeSettings;
1380
1365
  exports.unsafeReadSettings = unsafeReadSettings;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ESLintUtils } from '@typescript-eslint/utils';
2
- import { F, Data, O } from '@eslint-react/tools';
2
+ import { F, Data } from '@eslint-react/tools';
3
3
  import pm from 'picomatch';
4
4
 
5
5
  // src/constants.ts
@@ -207,8 +207,6 @@ var getDocsUrl = (pluginName) => (ruleName) => {
207
207
  return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
208
208
  };
209
209
  var createRuleForPlugin = (pluginName) => ESLintUtils.RuleCreator(getDocsUrl(pluginName));
210
-
211
- // ../../node_modules/.pnpm/valibot@1.0.0-beta.3_typescript@5.6.3/node_modules/valibot/dist/index.js
212
210
  var store;
213
211
  function getGlobalConfig(config2) {
214
212
  return {
@@ -312,16 +310,14 @@ function array(item, message) {
312
310
  async: false,
313
311
  item,
314
312
  message,
315
- "~standard": 1,
316
- "~vendor": "valibot",
317
- "~validate"(dataset, config2 = getGlobalConfig()) {
313
+ _run(dataset, config2) {
318
314
  const input = dataset.value;
319
315
  if (Array.isArray(input)) {
320
316
  dataset.typed = true;
321
317
  dataset.value = [];
322
318
  for (let key = 0; key < input.length; key++) {
323
319
  const value2 = input[key];
324
- const itemDataset = this.item["~validate"]({ value: value2 }, config2);
320
+ const itemDataset = this.item._run({ typed: false, value: value2 }, config2);
325
321
  if (itemDataset.issues) {
326
322
  const pathItem = {
327
323
  type: "array",
@@ -366,9 +362,7 @@ function boolean(message) {
366
362
  expects: "boolean",
367
363
  async: false,
368
364
  message,
369
- "~standard": 1,
370
- "~vendor": "valibot",
371
- "~validate"(dataset, config2 = getGlobalConfig()) {
365
+ _run(dataset, config2) {
372
366
  if (typeof dataset.value === "boolean") {
373
367
  dataset.typed = true;
374
368
  } else {
@@ -387,9 +381,7 @@ function instance(class_, message) {
387
381
  async: false,
388
382
  class: class_,
389
383
  message,
390
- "~standard": 1,
391
- "~vendor": "valibot",
392
- "~validate"(dataset, config2 = getGlobalConfig()) {
384
+ _run(dataset, config2) {
393
385
  if (dataset.value instanceof this.class) {
394
386
  dataset.typed = true;
395
387
  } else {
@@ -408,17 +400,15 @@ function object(entries, message) {
408
400
  async: false,
409
401
  entries,
410
402
  message,
411
- "~standard": 1,
412
- "~vendor": "valibot",
413
- "~validate"(dataset, config2 = getGlobalConfig()) {
403
+ _run(dataset, config2) {
414
404
  const input = dataset.value;
415
405
  if (input && typeof input === "object") {
416
406
  dataset.typed = true;
417
407
  dataset.value = {};
418
408
  for (const key in this.entries) {
419
409
  const value2 = input[key];
420
- const valueDataset = this.entries[key]["~validate"](
421
- { value: value2 },
410
+ const valueDataset = this.entries[key]._run(
411
+ { typed: false, value: value2 },
422
412
  config2
423
413
  );
424
414
  if (valueDataset.issues) {
@@ -459,30 +449,35 @@ function object(entries, message) {
459
449
  }
460
450
  };
461
451
  }
462
- function optional(wrapped, default_) {
463
- return {
452
+ function optional(wrapped, ...args) {
453
+ const schema = {
464
454
  kind: "schema",
465
455
  type: "optional",
466
456
  reference: optional,
467
457
  expects: `(${wrapped.expects} | undefined)`,
468
458
  async: false,
469
459
  wrapped,
470
- default: default_,
471
- "~standard": 1,
472
- "~vendor": "valibot",
473
- "~validate"(dataset, config2 = getGlobalConfig()) {
460
+ _run(dataset, config2) {
474
461
  if (dataset.value === void 0) {
475
- if (this.default !== void 0) {
476
- dataset.value = getDefault(this, dataset, config2);
462
+ if ("default" in this) {
463
+ dataset.value = getDefault(
464
+ this,
465
+ dataset,
466
+ config2
467
+ );
477
468
  }
478
469
  if (dataset.value === void 0) {
479
470
  dataset.typed = true;
480
471
  return dataset;
481
472
  }
482
473
  }
483
- return this.wrapped["~validate"](dataset, config2);
474
+ return this.wrapped._run(dataset, config2);
484
475
  }
485
476
  };
477
+ if (0 in args) {
478
+ schema.default = args[0];
479
+ }
480
+ return schema;
486
481
  }
487
482
  function string(message) {
488
483
  return {
@@ -492,9 +487,7 @@ function string(message) {
492
487
  expects: "string",
493
488
  async: false,
494
489
  message,
495
- "~standard": 1,
496
- "~vendor": "valibot",
497
- "~validate"(dataset, config2 = getGlobalConfig()) {
490
+ _run(dataset, config2) {
498
491
  if (typeof dataset.value === "string") {
499
492
  dataset.typed = true;
500
493
  } else {
@@ -505,8 +498,8 @@ function string(message) {
505
498
  };
506
499
  }
507
500
  function parse(schema, input, config2) {
508
- const dataset = schema["~validate"](
509
- { value: input },
501
+ const dataset = schema._run(
502
+ { typed: false, value: input },
510
503
  getGlobalConfig(config2)
511
504
  );
512
505
  if (dataset.issues) {
@@ -1338,13 +1331,6 @@ var normalizeSettings = createMemoizedFunction((settings) => {
1338
1331
  }, /* @__PURE__ */ new Map())
1339
1332
  });
1340
1333
  }, { isEqual: shallowEqual });
1341
- function findAttrInCustomAttributes(name, attributes) {
1342
- return F.pipe(
1343
- O.fromNullable(attributes.findLast((a) => a.as === name)),
1344
- O.map((a) => [a.name, a.defaultValue]),
1345
- O.getOrElse(() => [name])
1346
- );
1347
- }
1348
1334
  var defineSettings = F.identity;
1349
1335
 
1350
- export { CustomAttributeSchema, CustomComponentNormalizedSchema, CustomComponentSchema, CustomHookSchema, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, INITIAL_ESLINT_REACT_SETTINGS, 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, findAttrInCustomAttributes, normalizeSettings, unsafeReadSettings };
1336
+ export { CustomAttributeSchema, CustomComponentNormalizedSchema, CustomComponentSchema, CustomHookSchema, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, INITIAL_ESLINT_REACT_SETTINGS, 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, normalizeSettings, unsafeReadSettings };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/shared",
3
- "version": "1.16.2-beta.1",
3
+ "version": "1.16.2-beta.3",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
5
  "homepage": "https://github.com/rel1cx/eslint-react",
6
6
  "bugs": {
@@ -37,15 +37,15 @@
37
37
  "dependencies": {
38
38
  "@typescript-eslint/utils": "^8.14.0",
39
39
  "picomatch": "^4.0.2",
40
- "@eslint-react/tools": "1.16.2-beta.1"
40
+ "@eslint-react/tools": "1.16.2-beta.3"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/picomatch": "^3.0.1",
44
44
  "fast-equals": "^5.0.1",
45
45
  "micro-memoize": "^4.1.2",
46
46
  "tsup": "^8.3.5",
47
- "type-fest": "^4.26.1",
48
- "valibot": "^1.0.0-beta.3"
47
+ "type-fest": "^4.27.0",
48
+ "valibot": "^0.42.1"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsup --dts-resolve",