@eslint-react/shared 1.5.14 → 1.5.15-beta.2
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 +23 -24
- package/dist/index.mjs +23 -24
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -184,13 +184,12 @@ var HOST_SVG_COMPONENT_TYPES = [
|
|
|
184
184
|
"view"
|
|
185
185
|
];
|
|
186
186
|
var getDocsUrl = (pluginName) => (ruleName) => {
|
|
187
|
-
if (pluginName === "core")
|
|
188
|
-
return `${WEBSITE_URL}/rules/${ruleName}`;
|
|
187
|
+
if (pluginName === "core") return `${WEBSITE_URL}/rules/${ruleName}`;
|
|
189
188
|
return `${WEBSITE_URL}/rules/${pluginName}-${ruleName}`;
|
|
190
189
|
};
|
|
191
190
|
var createRuleForPlugin = (pluginName) => utils.ESLintUtils.RuleCreator(getDocsUrl(pluginName));
|
|
192
191
|
|
|
193
|
-
// ../../node_modules/.pnpm/valibot@0.31.0-rc.
|
|
192
|
+
// ../../node_modules/.pnpm/valibot@0.31.0-rc.11/node_modules/valibot/dist/index.js
|
|
194
193
|
var store2;
|
|
195
194
|
function getGlobalMessage(lang) {
|
|
196
195
|
return store2?.get(lang);
|
|
@@ -210,7 +209,7 @@ function _stringify(input) {
|
|
|
210
209
|
}
|
|
211
210
|
return type === "string" ? `"${input}"` : type === "number" || type === "bigint" || type === "boolean" ? `${input}` : type;
|
|
212
211
|
}
|
|
213
|
-
function _addIssue(context, label, dataset,
|
|
212
|
+
function _addIssue(context, label, dataset, config2, other) {
|
|
214
213
|
const input = dataset.value;
|
|
215
214
|
const expected = context.expects;
|
|
216
215
|
const received = _stringify(input);
|
|
@@ -225,15 +224,15 @@ function _addIssue(context, label, dataset, config, other) {
|
|
|
225
224
|
requirement: context.requirement,
|
|
226
225
|
path: other?.path,
|
|
227
226
|
issues: other?.issues,
|
|
228
|
-
lang:
|
|
229
|
-
abortEarly:
|
|
230
|
-
abortPipeEarly:
|
|
231
|
-
skipPipe:
|
|
227
|
+
lang: config2.lang,
|
|
228
|
+
abortEarly: config2.abortEarly,
|
|
229
|
+
abortPipeEarly: config2.abortPipeEarly,
|
|
230
|
+
skipPipe: config2.skipPipe
|
|
232
231
|
};
|
|
233
232
|
const isSchema = context.kind === "schema";
|
|
234
233
|
const message = (
|
|
235
234
|
// @ts-expect-error
|
|
236
|
-
context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ??
|
|
235
|
+
context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ?? config2.message ?? getGlobalMessage(issue.lang)
|
|
237
236
|
);
|
|
238
237
|
if (message) {
|
|
239
238
|
issue.message = typeof message === "function" ? message(issue) : message;
|
|
@@ -247,10 +246,10 @@ function _addIssue(context, label, dataset, config, other) {
|
|
|
247
246
|
dataset.issues = [issue];
|
|
248
247
|
}
|
|
249
248
|
}
|
|
250
|
-
function getDefault(schema, dataset,
|
|
249
|
+
function getDefault(schema, dataset, config2) {
|
|
251
250
|
return typeof schema.default === "function" ? (
|
|
252
251
|
// @ts-expect-error
|
|
253
|
-
schema.default(dataset,
|
|
252
|
+
schema.default(dataset, config2)
|
|
254
253
|
) : (
|
|
255
254
|
// @ts-expect-error
|
|
256
255
|
schema.default
|
|
@@ -265,14 +264,14 @@ function array(item, message) {
|
|
|
265
264
|
async: false,
|
|
266
265
|
item,
|
|
267
266
|
message,
|
|
268
|
-
_run(dataset,
|
|
267
|
+
_run(dataset, config2) {
|
|
269
268
|
const input = dataset.value;
|
|
270
269
|
if (Array.isArray(input)) {
|
|
271
270
|
dataset.typed = true;
|
|
272
271
|
dataset.value = [];
|
|
273
272
|
for (let key = 0; key < input.length; key++) {
|
|
274
273
|
const value2 = input[key];
|
|
275
|
-
const itemDataset = this.item._run({ typed: false, value: value2 },
|
|
274
|
+
const itemDataset = this.item._run({ typed: false, value: value2 }, config2);
|
|
276
275
|
if (itemDataset.issues) {
|
|
277
276
|
const pathItem = {
|
|
278
277
|
type: "array",
|
|
@@ -292,7 +291,7 @@ function array(item, message) {
|
|
|
292
291
|
if (!dataset.issues) {
|
|
293
292
|
dataset.issues = itemDataset.issues;
|
|
294
293
|
}
|
|
295
|
-
if (
|
|
294
|
+
if (config2.abortEarly) {
|
|
296
295
|
dataset.typed = false;
|
|
297
296
|
break;
|
|
298
297
|
}
|
|
@@ -303,7 +302,7 @@ function array(item, message) {
|
|
|
303
302
|
dataset.value.push(itemDataset.value);
|
|
304
303
|
}
|
|
305
304
|
} else {
|
|
306
|
-
_addIssue(this, "type", dataset,
|
|
305
|
+
_addIssue(this, "type", dataset, config2);
|
|
307
306
|
}
|
|
308
307
|
return dataset;
|
|
309
308
|
}
|
|
@@ -318,7 +317,7 @@ function object(entries, message) {
|
|
|
318
317
|
async: false,
|
|
319
318
|
entries,
|
|
320
319
|
message,
|
|
321
|
-
_run(dataset,
|
|
320
|
+
_run(dataset, config2) {
|
|
322
321
|
const input = dataset.value;
|
|
323
322
|
if (input && typeof input === "object") {
|
|
324
323
|
dataset.typed = true;
|
|
@@ -327,7 +326,7 @@ function object(entries, message) {
|
|
|
327
326
|
const value2 = input[key];
|
|
328
327
|
const valueDataset = this.entries[key]._run(
|
|
329
328
|
{ typed: false, value: value2 },
|
|
330
|
-
|
|
329
|
+
config2
|
|
331
330
|
);
|
|
332
331
|
if (valueDataset.issues) {
|
|
333
332
|
const pathItem = {
|
|
@@ -348,7 +347,7 @@ function object(entries, message) {
|
|
|
348
347
|
if (!dataset.issues) {
|
|
349
348
|
dataset.issues = valueDataset.issues;
|
|
350
349
|
}
|
|
351
|
-
if (
|
|
350
|
+
if (config2.abortEarly) {
|
|
352
351
|
dataset.typed = false;
|
|
353
352
|
break;
|
|
354
353
|
}
|
|
@@ -361,7 +360,7 @@ function object(entries, message) {
|
|
|
361
360
|
}
|
|
362
361
|
}
|
|
363
362
|
} else {
|
|
364
|
-
_addIssue(this, "type", dataset,
|
|
363
|
+
_addIssue(this, "type", dataset, config2);
|
|
365
364
|
}
|
|
366
365
|
return dataset;
|
|
367
366
|
}
|
|
@@ -375,13 +374,13 @@ function optional(wrapped, ...args) {
|
|
|
375
374
|
expects: `${wrapped.expects} | undefined`,
|
|
376
375
|
async: false,
|
|
377
376
|
wrapped,
|
|
378
|
-
_run(dataset,
|
|
377
|
+
_run(dataset, config2) {
|
|
379
378
|
if (dataset.value === void 0) {
|
|
380
379
|
if ("default" in this) {
|
|
381
380
|
dataset.value = getDefault(
|
|
382
381
|
this,
|
|
383
382
|
dataset,
|
|
384
|
-
|
|
383
|
+
config2
|
|
385
384
|
);
|
|
386
385
|
}
|
|
387
386
|
if (dataset.value === void 0) {
|
|
@@ -389,7 +388,7 @@ function optional(wrapped, ...args) {
|
|
|
389
388
|
return dataset;
|
|
390
389
|
}
|
|
391
390
|
}
|
|
392
|
-
return this.wrapped._run(dataset,
|
|
391
|
+
return this.wrapped._run(dataset, config2);
|
|
393
392
|
}
|
|
394
393
|
};
|
|
395
394
|
if (0 in args) {
|
|
@@ -405,11 +404,11 @@ function string(message) {
|
|
|
405
404
|
expects: "string",
|
|
406
405
|
async: false,
|
|
407
406
|
message,
|
|
408
|
-
_run(dataset,
|
|
407
|
+
_run(dataset, config2) {
|
|
409
408
|
if (typeof dataset.value === "string") {
|
|
410
409
|
dataset.typed = true;
|
|
411
410
|
} else {
|
|
412
|
-
_addIssue(this, "type", dataset,
|
|
411
|
+
_addIssue(this, "type", dataset, config2);
|
|
413
412
|
}
|
|
414
413
|
return dataset;
|
|
415
414
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -182,13 +182,12 @@ var HOST_SVG_COMPONENT_TYPES = [
|
|
|
182
182
|
"view"
|
|
183
183
|
];
|
|
184
184
|
var getDocsUrl = (pluginName) => (ruleName) => {
|
|
185
|
-
if (pluginName === "core")
|
|
186
|
-
return `${WEBSITE_URL}/rules/${ruleName}`;
|
|
185
|
+
if (pluginName === "core") return `${WEBSITE_URL}/rules/${ruleName}`;
|
|
187
186
|
return `${WEBSITE_URL}/rules/${pluginName}-${ruleName}`;
|
|
188
187
|
};
|
|
189
188
|
var createRuleForPlugin = (pluginName) => ESLintUtils.RuleCreator(getDocsUrl(pluginName));
|
|
190
189
|
|
|
191
|
-
// ../../node_modules/.pnpm/valibot@0.31.0-rc.
|
|
190
|
+
// ../../node_modules/.pnpm/valibot@0.31.0-rc.11/node_modules/valibot/dist/index.js
|
|
192
191
|
var store2;
|
|
193
192
|
function getGlobalMessage(lang) {
|
|
194
193
|
return store2?.get(lang);
|
|
@@ -208,7 +207,7 @@ function _stringify(input) {
|
|
|
208
207
|
}
|
|
209
208
|
return type === "string" ? `"${input}"` : type === "number" || type === "bigint" || type === "boolean" ? `${input}` : type;
|
|
210
209
|
}
|
|
211
|
-
function _addIssue(context, label, dataset,
|
|
210
|
+
function _addIssue(context, label, dataset, config2, other) {
|
|
212
211
|
const input = dataset.value;
|
|
213
212
|
const expected = context.expects;
|
|
214
213
|
const received = _stringify(input);
|
|
@@ -223,15 +222,15 @@ function _addIssue(context, label, dataset, config, other) {
|
|
|
223
222
|
requirement: context.requirement,
|
|
224
223
|
path: other?.path,
|
|
225
224
|
issues: other?.issues,
|
|
226
|
-
lang:
|
|
227
|
-
abortEarly:
|
|
228
|
-
abortPipeEarly:
|
|
229
|
-
skipPipe:
|
|
225
|
+
lang: config2.lang,
|
|
226
|
+
abortEarly: config2.abortEarly,
|
|
227
|
+
abortPipeEarly: config2.abortPipeEarly,
|
|
228
|
+
skipPipe: config2.skipPipe
|
|
230
229
|
};
|
|
231
230
|
const isSchema = context.kind === "schema";
|
|
232
231
|
const message = (
|
|
233
232
|
// @ts-expect-error
|
|
234
|
-
context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ??
|
|
233
|
+
context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ?? config2.message ?? getGlobalMessage(issue.lang)
|
|
235
234
|
);
|
|
236
235
|
if (message) {
|
|
237
236
|
issue.message = typeof message === "function" ? message(issue) : message;
|
|
@@ -245,10 +244,10 @@ function _addIssue(context, label, dataset, config, other) {
|
|
|
245
244
|
dataset.issues = [issue];
|
|
246
245
|
}
|
|
247
246
|
}
|
|
248
|
-
function getDefault(schema, dataset,
|
|
247
|
+
function getDefault(schema, dataset, config2) {
|
|
249
248
|
return typeof schema.default === "function" ? (
|
|
250
249
|
// @ts-expect-error
|
|
251
|
-
schema.default(dataset,
|
|
250
|
+
schema.default(dataset, config2)
|
|
252
251
|
) : (
|
|
253
252
|
// @ts-expect-error
|
|
254
253
|
schema.default
|
|
@@ -263,14 +262,14 @@ function array(item, message) {
|
|
|
263
262
|
async: false,
|
|
264
263
|
item,
|
|
265
264
|
message,
|
|
266
|
-
_run(dataset,
|
|
265
|
+
_run(dataset, config2) {
|
|
267
266
|
const input = dataset.value;
|
|
268
267
|
if (Array.isArray(input)) {
|
|
269
268
|
dataset.typed = true;
|
|
270
269
|
dataset.value = [];
|
|
271
270
|
for (let key = 0; key < input.length; key++) {
|
|
272
271
|
const value2 = input[key];
|
|
273
|
-
const itemDataset = this.item._run({ typed: false, value: value2 },
|
|
272
|
+
const itemDataset = this.item._run({ typed: false, value: value2 }, config2);
|
|
274
273
|
if (itemDataset.issues) {
|
|
275
274
|
const pathItem = {
|
|
276
275
|
type: "array",
|
|
@@ -290,7 +289,7 @@ function array(item, message) {
|
|
|
290
289
|
if (!dataset.issues) {
|
|
291
290
|
dataset.issues = itemDataset.issues;
|
|
292
291
|
}
|
|
293
|
-
if (
|
|
292
|
+
if (config2.abortEarly) {
|
|
294
293
|
dataset.typed = false;
|
|
295
294
|
break;
|
|
296
295
|
}
|
|
@@ -301,7 +300,7 @@ function array(item, message) {
|
|
|
301
300
|
dataset.value.push(itemDataset.value);
|
|
302
301
|
}
|
|
303
302
|
} else {
|
|
304
|
-
_addIssue(this, "type", dataset,
|
|
303
|
+
_addIssue(this, "type", dataset, config2);
|
|
305
304
|
}
|
|
306
305
|
return dataset;
|
|
307
306
|
}
|
|
@@ -316,7 +315,7 @@ function object(entries, message) {
|
|
|
316
315
|
async: false,
|
|
317
316
|
entries,
|
|
318
317
|
message,
|
|
319
|
-
_run(dataset,
|
|
318
|
+
_run(dataset, config2) {
|
|
320
319
|
const input = dataset.value;
|
|
321
320
|
if (input && typeof input === "object") {
|
|
322
321
|
dataset.typed = true;
|
|
@@ -325,7 +324,7 @@ function object(entries, message) {
|
|
|
325
324
|
const value2 = input[key];
|
|
326
325
|
const valueDataset = this.entries[key]._run(
|
|
327
326
|
{ typed: false, value: value2 },
|
|
328
|
-
|
|
327
|
+
config2
|
|
329
328
|
);
|
|
330
329
|
if (valueDataset.issues) {
|
|
331
330
|
const pathItem = {
|
|
@@ -346,7 +345,7 @@ function object(entries, message) {
|
|
|
346
345
|
if (!dataset.issues) {
|
|
347
346
|
dataset.issues = valueDataset.issues;
|
|
348
347
|
}
|
|
349
|
-
if (
|
|
348
|
+
if (config2.abortEarly) {
|
|
350
349
|
dataset.typed = false;
|
|
351
350
|
break;
|
|
352
351
|
}
|
|
@@ -359,7 +358,7 @@ function object(entries, message) {
|
|
|
359
358
|
}
|
|
360
359
|
}
|
|
361
360
|
} else {
|
|
362
|
-
_addIssue(this, "type", dataset,
|
|
361
|
+
_addIssue(this, "type", dataset, config2);
|
|
363
362
|
}
|
|
364
363
|
return dataset;
|
|
365
364
|
}
|
|
@@ -373,13 +372,13 @@ function optional(wrapped, ...args) {
|
|
|
373
372
|
expects: `${wrapped.expects} | undefined`,
|
|
374
373
|
async: false,
|
|
375
374
|
wrapped,
|
|
376
|
-
_run(dataset,
|
|
375
|
+
_run(dataset, config2) {
|
|
377
376
|
if (dataset.value === void 0) {
|
|
378
377
|
if ("default" in this) {
|
|
379
378
|
dataset.value = getDefault(
|
|
380
379
|
this,
|
|
381
380
|
dataset,
|
|
382
|
-
|
|
381
|
+
config2
|
|
383
382
|
);
|
|
384
383
|
}
|
|
385
384
|
if (dataset.value === void 0) {
|
|
@@ -387,7 +386,7 @@ function optional(wrapped, ...args) {
|
|
|
387
386
|
return dataset;
|
|
388
387
|
}
|
|
389
388
|
}
|
|
390
|
-
return this.wrapped._run(dataset,
|
|
389
|
+
return this.wrapped._run(dataset, config2);
|
|
391
390
|
}
|
|
392
391
|
};
|
|
393
392
|
if (0 in args) {
|
|
@@ -403,11 +402,11 @@ function string(message) {
|
|
|
403
402
|
expects: "string",
|
|
404
403
|
async: false,
|
|
405
404
|
message,
|
|
406
|
-
_run(dataset,
|
|
405
|
+
_run(dataset, config2) {
|
|
407
406
|
if (typeof dataset.value === "string") {
|
|
408
407
|
dataset.typed = true;
|
|
409
408
|
} else {
|
|
410
|
-
_addIssue(this, "type", dataset,
|
|
409
|
+
_addIssue(this, "type", dataset, config2);
|
|
411
410
|
}
|
|
412
411
|
return dataset;
|
|
413
412
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.15-beta.2",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"./package.json"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@typescript-eslint/utils": "^7.
|
|
39
|
-
"deepmerge-ts": "7.0.
|
|
38
|
+
"@typescript-eslint/utils": "^7.12.0",
|
|
39
|
+
"deepmerge-ts": "7.0.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"tsup": "8.0
|
|
43
|
-
"type-fest": "4.
|
|
44
|
-
"valibot": "0.31.0-rc.
|
|
42
|
+
"tsup": "8.1.0",
|
|
43
|
+
"type-fest": "4.19.0",
|
|
44
|
+
"valibot": "0.31.0-rc.11"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsup",
|