@eslint-react/shared 1.23.2 → 1.23.3-next.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.js CHANGED
@@ -218,7 +218,9 @@ var REACT_BUILD_IN_HOOKS = [
218
218
  "useTransition"
219
219
  ];
220
220
  var getDocsUrl = (pluginName) => (ruleName) => {
221
- if (pluginName === "x") return `${WEBSITE_URL}/docs/rules/${ruleName}`;
221
+ if (pluginName === "x") {
222
+ return `${WEBSITE_URL}/docs/rules/${ruleName}`;
223
+ }
222
224
  return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
223
225
  };
224
226
  var createRuleForPlugin = (pluginName) => utils.ESLintUtils.RuleCreator(getDocsUrl(pluginName));
@@ -240,7 +242,7 @@ function getReactVersion(at = (typeof document === 'undefined' ? require('u' + '
240
242
  );
241
243
  }
242
244
 
243
- // ../../node_modules/.pnpm/valibot@1.0.0-beta.10_typescript@5.7.2/node_modules/valibot/dist/index.js
245
+ // ../../node_modules/.pnpm/valibot@1.0.0-beta.11_typescript@5.7.2/node_modules/valibot/dist/index.js
244
246
  var store;
245
247
  // @__NO_SIDE_EFFECTS__
246
248
  function getGlobalConfig(config2) {
@@ -251,6 +253,70 @@ function getGlobalConfig(config2) {
251
253
  abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
252
254
  };
253
255
  }
256
+ var store2;
257
+ // @__NO_SIDE_EFFECTS__
258
+ function getGlobalMessage(lang) {
259
+ return store2?.get(lang);
260
+ }
261
+ var store3;
262
+ // @__NO_SIDE_EFFECTS__
263
+ function getSchemaMessage(lang) {
264
+ return store3?.get(lang);
265
+ }
266
+ var store4;
267
+ // @__NO_SIDE_EFFECTS__
268
+ function getSpecificMessage(reference, lang) {
269
+ return store4?.get(reference)?.get(lang);
270
+ }
271
+ // @__NO_SIDE_EFFECTS__
272
+ function _stringify(input) {
273
+ const type = typeof input;
274
+ if (type === "string") {
275
+ return `"${input}"`;
276
+ }
277
+ if (type === "number" || type === "bigint" || type === "boolean") {
278
+ return `${input}`;
279
+ }
280
+ if (type === "object" || type === "function") {
281
+ return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
282
+ }
283
+ return type;
284
+ }
285
+ function _addIssue(context, label, dataset, config2, other) {
286
+ const input = dataset.value;
287
+ const expected = context.expects ?? null;
288
+ const received = /* @__PURE__ */ _stringify(input);
289
+ const issue = {
290
+ kind: context.kind,
291
+ type: context.type,
292
+ input,
293
+ expected,
294
+ received,
295
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
296
+ requirement: context.requirement,
297
+ path: other?.path,
298
+ issues: other?.issues,
299
+ lang: config2.lang,
300
+ abortEarly: config2.abortEarly,
301
+ abortPipeEarly: config2.abortPipeEarly
302
+ };
303
+ const isSchema = context.kind === "schema";
304
+ const message = context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
305
+ if (message) {
306
+ issue.message = typeof message === "function" ? (
307
+ // @ts-expect-error
308
+ message(issue)
309
+ ) : message;
310
+ }
311
+ if (isSchema) {
312
+ dataset.typed = false;
313
+ }
314
+ if (dataset.issues) {
315
+ dataset.issues.push(issue);
316
+ } else {
317
+ dataset.issues = [issue];
318
+ }
319
+ }
254
320
  // @__NO_SIDE_EFFECTS__
255
321
  function _getStandardProps(context) {
256
322
  return {
@@ -333,6 +399,8 @@ function array(item, message) {
333
399
  }
334
400
  dataset.value.push(itemDataset.value);
335
401
  }
402
+ } else {
403
+ _addIssue(this, "type", dataset, config2);
336
404
  }
337
405
  return dataset;
338
406
  }
@@ -353,6 +421,8 @@ function boolean(message) {
353
421
  "~run"(dataset, config2) {
354
422
  if (typeof dataset.value === "boolean") {
355
423
  dataset.typed = true;
424
+ } else {
425
+ _addIssue(this, "type", dataset, config2);
356
426
  }
357
427
  return dataset;
358
428
  }
@@ -374,6 +444,8 @@ function instance(class_, message) {
374
444
  "~run"(dataset, config2) {
375
445
  if (dataset.value instanceof this.class) {
376
446
  dataset.typed = true;
447
+ } else {
448
+ _addIssue(this, "type", dataset, config2);
377
449
  }
378
450
  return dataset;
379
451
  }
@@ -431,6 +503,8 @@ function object(entries, message) {
431
503
  dataset.value[key] = valueDataset.value;
432
504
  }
433
505
  }
506
+ } else {
507
+ _addIssue(this, "type", dataset, config2);
434
508
  }
435
509
  return dataset;
436
510
  }
@@ -478,6 +552,8 @@ function string(message) {
478
552
  "~run"(dataset, config2) {
479
553
  if (typeof dataset.value === "string") {
480
554
  dataset.typed = true;
555
+ } else {
556
+ _addIssue(this, "type", dataset, config2);
481
557
  }
482
558
  return dataset;
483
559
  }
@@ -639,7 +715,7 @@ var ESLintSettingsSchema = optional(
639
715
  {}
640
716
  );
641
717
 
642
- // ../../node_modules/.pnpm/fast-equals@5.2.0/node_modules/fast-equals/dist/esm/index.mjs
718
+ // ../../node_modules/.pnpm/fast-equals@5.2.1/node_modules/fast-equals/dist/esm/index.mjs
643
719
  var getOwnPropertyNames = Object.getOwnPropertyNames;
644
720
  var getOwnPropertySymbols = Object.getOwnPropertySymbols;
645
721
  var hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -1363,8 +1439,12 @@ var normalizeSettings = createMemoizedFunction((settings) => {
1363
1439
  })),
1364
1440
  components: additionalComponents.reduce((acc, component) => {
1365
1441
  const { name, as, attributes = [], selector } = component;
1366
- if (!name || !as || selector || attributes.length > 0) return acc;
1367
- if (!/^[\w-]+$/u.test(name)) return acc;
1442
+ if (!name || !as || selector || attributes.length > 0) {
1443
+ return acc;
1444
+ }
1445
+ if (!/^[\w-]+$/u.test(name)) {
1446
+ return acc;
1447
+ }
1368
1448
  return acc.set(name, as);
1369
1449
  }, /* @__PURE__ */ new Map()),
1370
1450
  version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => eff.E.getOrElse(getReactVersion(), eff.F.constant("19.0.0"))).otherwise(eff.F.identity)
package/dist/index.mjs CHANGED
@@ -210,7 +210,9 @@ var REACT_BUILD_IN_HOOKS = [
210
210
  "useTransition"
211
211
  ];
212
212
  var getDocsUrl = (pluginName) => (ruleName) => {
213
- if (pluginName === "x") return `${WEBSITE_URL}/docs/rules/${ruleName}`;
213
+ if (pluginName === "x") {
214
+ return `${WEBSITE_URL}/docs/rules/${ruleName}`;
215
+ }
214
216
  return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
215
217
  };
216
218
  var createRuleForPlugin = (pluginName) => ESLintUtils.RuleCreator(getDocsUrl(pluginName));
@@ -232,7 +234,7 @@ function getReactVersion(at = import.meta.url) {
232
234
  );
233
235
  }
234
236
 
235
- // ../../node_modules/.pnpm/valibot@1.0.0-beta.10_typescript@5.7.2/node_modules/valibot/dist/index.js
237
+ // ../../node_modules/.pnpm/valibot@1.0.0-beta.11_typescript@5.7.2/node_modules/valibot/dist/index.js
236
238
  var store;
237
239
  // @__NO_SIDE_EFFECTS__
238
240
  function getGlobalConfig(config2) {
@@ -243,6 +245,70 @@ function getGlobalConfig(config2) {
243
245
  abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
244
246
  };
245
247
  }
248
+ var store2;
249
+ // @__NO_SIDE_EFFECTS__
250
+ function getGlobalMessage(lang) {
251
+ return store2?.get(lang);
252
+ }
253
+ var store3;
254
+ // @__NO_SIDE_EFFECTS__
255
+ function getSchemaMessage(lang) {
256
+ return store3?.get(lang);
257
+ }
258
+ var store4;
259
+ // @__NO_SIDE_EFFECTS__
260
+ function getSpecificMessage(reference, lang) {
261
+ return store4?.get(reference)?.get(lang);
262
+ }
263
+ // @__NO_SIDE_EFFECTS__
264
+ function _stringify(input) {
265
+ const type = typeof input;
266
+ if (type === "string") {
267
+ return `"${input}"`;
268
+ }
269
+ if (type === "number" || type === "bigint" || type === "boolean") {
270
+ return `${input}`;
271
+ }
272
+ if (type === "object" || type === "function") {
273
+ return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
274
+ }
275
+ return type;
276
+ }
277
+ function _addIssue(context, label, dataset, config2, other) {
278
+ const input = dataset.value;
279
+ const expected = context.expects ?? null;
280
+ const received = /* @__PURE__ */ _stringify(input);
281
+ const issue = {
282
+ kind: context.kind,
283
+ type: context.type,
284
+ input,
285
+ expected,
286
+ received,
287
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
288
+ requirement: context.requirement,
289
+ path: other?.path,
290
+ issues: other?.issues,
291
+ lang: config2.lang,
292
+ abortEarly: config2.abortEarly,
293
+ abortPipeEarly: config2.abortPipeEarly
294
+ };
295
+ const isSchema = context.kind === "schema";
296
+ const message = context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
297
+ if (message) {
298
+ issue.message = typeof message === "function" ? (
299
+ // @ts-expect-error
300
+ message(issue)
301
+ ) : message;
302
+ }
303
+ if (isSchema) {
304
+ dataset.typed = false;
305
+ }
306
+ if (dataset.issues) {
307
+ dataset.issues.push(issue);
308
+ } else {
309
+ dataset.issues = [issue];
310
+ }
311
+ }
246
312
  // @__NO_SIDE_EFFECTS__
247
313
  function _getStandardProps(context) {
248
314
  return {
@@ -325,6 +391,8 @@ function array(item, message) {
325
391
  }
326
392
  dataset.value.push(itemDataset.value);
327
393
  }
394
+ } else {
395
+ _addIssue(this, "type", dataset, config2);
328
396
  }
329
397
  return dataset;
330
398
  }
@@ -345,6 +413,8 @@ function boolean(message) {
345
413
  "~run"(dataset, config2) {
346
414
  if (typeof dataset.value === "boolean") {
347
415
  dataset.typed = true;
416
+ } else {
417
+ _addIssue(this, "type", dataset, config2);
348
418
  }
349
419
  return dataset;
350
420
  }
@@ -366,6 +436,8 @@ function instance(class_, message) {
366
436
  "~run"(dataset, config2) {
367
437
  if (dataset.value instanceof this.class) {
368
438
  dataset.typed = true;
439
+ } else {
440
+ _addIssue(this, "type", dataset, config2);
369
441
  }
370
442
  return dataset;
371
443
  }
@@ -423,6 +495,8 @@ function object(entries, message) {
423
495
  dataset.value[key] = valueDataset.value;
424
496
  }
425
497
  }
498
+ } else {
499
+ _addIssue(this, "type", dataset, config2);
426
500
  }
427
501
  return dataset;
428
502
  }
@@ -470,6 +544,8 @@ function string(message) {
470
544
  "~run"(dataset, config2) {
471
545
  if (typeof dataset.value === "string") {
472
546
  dataset.typed = true;
547
+ } else {
548
+ _addIssue(this, "type", dataset, config2);
473
549
  }
474
550
  return dataset;
475
551
  }
@@ -631,7 +707,7 @@ var ESLintSettingsSchema = optional(
631
707
  {}
632
708
  );
633
709
 
634
- // ../../node_modules/.pnpm/fast-equals@5.2.0/node_modules/fast-equals/dist/esm/index.mjs
710
+ // ../../node_modules/.pnpm/fast-equals@5.2.1/node_modules/fast-equals/dist/esm/index.mjs
635
711
  var getOwnPropertyNames = Object.getOwnPropertyNames;
636
712
  var getOwnPropertySymbols = Object.getOwnPropertySymbols;
637
713
  var hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -1355,8 +1431,12 @@ var normalizeSettings = createMemoizedFunction((settings) => {
1355
1431
  })),
1356
1432
  components: additionalComponents.reduce((acc, component) => {
1357
1433
  const { name, as, attributes = [], selector } = component;
1358
- if (!name || !as || selector || attributes.length > 0) return acc;
1359
- if (!/^[\w-]+$/u.test(name)) return acc;
1434
+ if (!name || !as || selector || attributes.length > 0) {
1435
+ return acc;
1436
+ }
1437
+ if (!/^[\w-]+$/u.test(name)) {
1438
+ return acc;
1439
+ }
1360
1440
  return acc.set(name, as);
1361
1441
  }, /* @__PURE__ */ new Map()),
1362
1442
  version: match(settings.version).with(P.union(P.nullish, "", "detect"), () => E.getOrElse(getReactVersion(), F.constant("19.0.0"))).otherwise(F.identity)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/shared",
3
- "version": "1.23.2",
3
+ "version": "1.23.3-next.0",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
5
  "homepage": "https://github.com/rEl1cx/eslint-react",
6
6
  "bugs": {
@@ -13,6 +13,7 @@
13
13
  },
14
14
  "license": "MIT",
15
15
  "author": "Eva1ent<rel1cx@proton.me>",
16
+ "sideEffects": false,
16
17
  "exports": {
17
18
  ".": {
18
19
  "import": {
@@ -27,6 +28,7 @@
27
28
  "./package.json": "./package.json"
28
29
  },
29
30
  "main": "dist/index.js",
31
+ "module": "dist/index.mjs",
30
32
  "types": "dist/index.d.ts",
31
33
  "files": [
32
34
  "dist",
@@ -36,23 +38,21 @@
36
38
  "@typescript-eslint/utils": "^8.19.1",
37
39
  "picomatch": "^4.0.2",
38
40
  "ts-pattern": "^5.6.0",
39
- "@eslint-react/eff": "1.23.2"
41
+ "@eslint-react/eff": "1.23.3-next.0"
40
42
  },
41
43
  "devDependencies": {
42
44
  "@types/picomatch": "^3.0.1",
43
- "fast-equals": "^5.2.0",
45
+ "fast-equals": "^5.2.1",
44
46
  "micro-memoize": "^4.1.3",
45
47
  "tsup": "^8.3.5",
46
48
  "type-fest": "^4.31.0",
47
- "valibot": "^1.0.0-beta.10",
49
+ "valibot": "^1.0.0-beta.11",
48
50
  "@workspace/configs": "0.0.0"
49
51
  },
50
52
  "engines": {
51
53
  "bun": ">=1.0.15",
52
54
  "node": ">=18.18.0"
53
55
  },
54
- "sideEffects": false,
55
- "module": "dist/index.mjs",
56
56
  "scripts": {
57
57
  "build": "tsup --dts-resolve",
58
58
  "build:docs": "typedoc",