@phsd/lint 0.0.0 → 0.1.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.ts → index.d.mts} +2079 -827
- package/dist/{index.js → index.mjs} +116 -183
- package/package.json +47 -47
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -110,8 +110,7 @@ const parserPlain = {
|
|
|
110
110
|
* Combine array and non-array configs into a single array.
|
|
111
111
|
*/
|
|
112
112
|
async function combine(...configs$1) {
|
|
113
|
-
|
|
114
|
-
return resolved.flat();
|
|
113
|
+
return (await Promise.all(configs$1)).flat();
|
|
115
114
|
}
|
|
116
115
|
async function interopDefault(m) {
|
|
117
116
|
const resolved = await m;
|
|
@@ -300,10 +299,9 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
300
299
|
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
301
300
|
useTabs: indent === "tab"
|
|
302
301
|
}, options.dprintOptions || {});
|
|
303
|
-
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
304
302
|
const configs$1 = [{
|
|
305
303
|
name: "phs/formatter/setup",
|
|
306
|
-
plugins: { format:
|
|
304
|
+
plugins: { format: await interopDefault(import("eslint-plugin-format")) }
|
|
307
305
|
}];
|
|
308
306
|
if (options.css) configs$1.push({
|
|
309
307
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
@@ -859,118 +857,67 @@ async function node() {
|
|
|
859
857
|
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
860
858
|
*/
|
|
861
859
|
async function perfectionist(options = {}) {
|
|
862
|
-
const { arrayIncludes = true, classes = false, decorators = true, enums = true, heritageClauses = true, interfaces = true, intersectionTypes = true, jsxProps = true, maps = false, modules =
|
|
860
|
+
const { arrayIncludes = true, classes = false, decorators = true, enums = true, heritageClauses = true, interfaces = true, intersectionTypes = true, jsxProps = true, maps = false, modules = true, objects = true, objectTypes = true, overrides = {}, sets = true, switchCase = true, unionTypes = true, variableDeclarations = true } = options;
|
|
861
|
+
const commonOrderRule = {
|
|
862
|
+
order: "asc",
|
|
863
|
+
type: "natural"
|
|
864
|
+
};
|
|
865
|
+
const commonRule = {
|
|
866
|
+
...commonOrderRule,
|
|
867
|
+
partitionByComment: {
|
|
868
|
+
block: false,
|
|
869
|
+
line: "^group:"
|
|
870
|
+
}
|
|
871
|
+
};
|
|
863
872
|
return [{
|
|
864
873
|
name: "phs/sort/setup",
|
|
865
874
|
plugins: { sort: pluginPerfectionist }
|
|
866
875
|
}, {
|
|
867
876
|
name: "phs/sort/rules",
|
|
868
877
|
rules: {
|
|
869
|
-
"sort/sort-exports": ["error",
|
|
870
|
-
order: "asc",
|
|
871
|
-
type: "natural"
|
|
872
|
-
}],
|
|
878
|
+
"sort/sort-exports": ["error", commonRule],
|
|
873
879
|
"sort/sort-imports": ["error", {
|
|
874
880
|
groups: [
|
|
875
|
-
"type",
|
|
881
|
+
"type-import",
|
|
882
|
+
["value-builtin", "value-external"],
|
|
883
|
+
"type-internal",
|
|
884
|
+
"value-internal",
|
|
876
885
|
[
|
|
877
|
-
"parent
|
|
878
|
-
"sibling
|
|
879
|
-
"index
|
|
880
|
-
"internal-type"
|
|
886
|
+
"type-parent",
|
|
887
|
+
"type-sibling",
|
|
888
|
+
"type-index"
|
|
881
889
|
],
|
|
882
|
-
"builtin",
|
|
883
|
-
"external",
|
|
884
|
-
"internal",
|
|
885
890
|
[
|
|
886
|
-
"parent",
|
|
887
|
-
"sibling",
|
|
888
|
-
"index"
|
|
891
|
+
"value-parent",
|
|
892
|
+
"value-sibling",
|
|
893
|
+
"value-index"
|
|
889
894
|
],
|
|
890
895
|
"side-effect",
|
|
891
|
-
"
|
|
896
|
+
"side-effect-style",
|
|
897
|
+
"ts-equals-import",
|
|
892
898
|
"unknown"
|
|
893
899
|
],
|
|
894
900
|
newlinesBetween: "ignore",
|
|
895
|
-
|
|
896
|
-
type: "natural"
|
|
897
|
-
}],
|
|
898
|
-
"sort/sort-named-exports": ["error", {
|
|
899
|
-
order: "asc",
|
|
900
|
-
type: "natural"
|
|
901
|
-
}],
|
|
902
|
-
"sort/sort-named-imports": ["error", {
|
|
903
|
-
order: "asc",
|
|
904
|
-
type: "natural"
|
|
901
|
+
...commonRule
|
|
905
902
|
}],
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
...
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
...
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
...
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
...
|
|
923
|
-
|
|
924
|
-
type: "natural"
|
|
925
|
-
}] } : {},
|
|
926
|
-
...unionTypes ? { "sort/sort-union-types": ["error", {
|
|
927
|
-
order: "asc",
|
|
928
|
-
type: "natural"
|
|
929
|
-
}] } : {},
|
|
930
|
-
...switchCase ? { "sort/sort-switch-case": ["error", {
|
|
931
|
-
order: "asc",
|
|
932
|
-
type: "natural"
|
|
933
|
-
}] } : {},
|
|
934
|
-
...decorators ? { "sort/sort-decorators": ["error", {
|
|
935
|
-
order: "asc",
|
|
936
|
-
type: "natural"
|
|
937
|
-
}] } : {},
|
|
938
|
-
...interfaces ? { "sort/sort-interfaces": ["error", {
|
|
939
|
-
order: "asc",
|
|
940
|
-
type: "natural"
|
|
941
|
-
}] } : {},
|
|
942
|
-
...jsxProps ? { "sort/sort-jsx-props": ["error", {
|
|
943
|
-
order: "asc",
|
|
944
|
-
type: "natural"
|
|
945
|
-
}] } : {},
|
|
946
|
-
...modules ? { "sort/sort-modules": ["error", {
|
|
947
|
-
order: "asc",
|
|
948
|
-
partitionByComment: {
|
|
949
|
-
block: false,
|
|
950
|
-
line: true
|
|
951
|
-
},
|
|
952
|
-
type: "natural"
|
|
953
|
-
}] } : {},
|
|
954
|
-
...classes ? { "sort/sort-classes": ["error", {
|
|
955
|
-
order: "asc",
|
|
956
|
-
type: "natural"
|
|
957
|
-
}] } : {},
|
|
958
|
-
...objects ? { "sort/sort-objects": ["error", {
|
|
959
|
-
order: "asc",
|
|
960
|
-
type: "natural"
|
|
961
|
-
}] } : {},
|
|
962
|
-
...enums ? { "sort/sort-enums": ["error", {
|
|
963
|
-
order: "asc",
|
|
964
|
-
type: "natural"
|
|
965
|
-
}] } : {},
|
|
966
|
-
...sets ? { "sort/sort-sets": ["error", {
|
|
967
|
-
order: "asc",
|
|
968
|
-
type: "natural"
|
|
969
|
-
}] } : {},
|
|
970
|
-
...maps ? { "sort/sort-maps": ["error", {
|
|
971
|
-
order: "asc",
|
|
972
|
-
type: "natural"
|
|
973
|
-
}] } : {},
|
|
903
|
+
"sort/sort-named-exports": ["error", commonRule],
|
|
904
|
+
"sort/sort-named-imports": ["error", commonRule],
|
|
905
|
+
...variableDeclarations ? { "sort/sort-variable-declarations": ["error", commonRule] } : {},
|
|
906
|
+
...intersectionTypes ? { "sort/sort-intersection-types": ["error", commonRule] } : {},
|
|
907
|
+
...heritageClauses ? { "sort/sort-heritage-clauses": ["error", commonRule] } : {},
|
|
908
|
+
...arrayIncludes ? { "sort/sort-array-includes": ["error", commonRule] } : {},
|
|
909
|
+
...objectTypes ? { "sort/sort-object-types": ["error", commonRule] } : {},
|
|
910
|
+
...unionTypes ? { "sort/sort-union-types": ["error", commonRule] } : {},
|
|
911
|
+
...switchCase ? { "sort/sort-switch-case": ["error", commonOrderRule] } : {},
|
|
912
|
+
...decorators ? { "sort/sort-decorators": ["error", commonRule] } : {},
|
|
913
|
+
...interfaces ? { "sort/sort-interfaces": ["error", commonRule] } : {},
|
|
914
|
+
...jsxProps ? { "sort/sort-jsx-props": ["error", commonOrderRule] } : {},
|
|
915
|
+
...modules ? { "sort/sort-modules": ["error", commonRule] } : {},
|
|
916
|
+
...classes ? { "sort/sort-classes": ["error", commonRule] } : {},
|
|
917
|
+
...objects ? { "sort/sort-objects": ["error", commonRule] } : {},
|
|
918
|
+
...enums ? { "sort/sort-enums": ["error", commonRule] } : {},
|
|
919
|
+
...sets ? { "sort/sort-sets": ["error", commonRule] } : {},
|
|
920
|
+
...maps ? { "sort/sort-maps": ["error", commonRule] } : {},
|
|
974
921
|
...overrides
|
|
975
922
|
}
|
|
976
923
|
}];
|
|
@@ -2323,17 +2270,14 @@ prototypeAccessors.inAsync.get = function() {
|
|
|
2323
2270
|
};
|
|
2324
2271
|
prototypeAccessors.canAwait.get = function() {
|
|
2325
2272
|
for (var i$1 = this.scopeStack.length - 1; i$1 >= 0; i$1--) {
|
|
2326
|
-
var
|
|
2327
|
-
var flags = ref$1.flags;
|
|
2273
|
+
var flags = this.scopeStack[i$1].flags;
|
|
2328
2274
|
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) return false;
|
|
2329
2275
|
if (flags & SCOPE_FUNCTION) return (flags & SCOPE_ASYNC) > 0;
|
|
2330
2276
|
}
|
|
2331
2277
|
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
|
|
2332
2278
|
};
|
|
2333
2279
|
prototypeAccessors.allowSuper.get = function() {
|
|
2334
|
-
|
|
2335
|
-
var flags = ref$1.flags;
|
|
2336
|
-
return (flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod;
|
|
2280
|
+
return (this.currentThisScope().flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod;
|
|
2337
2281
|
};
|
|
2338
2282
|
prototypeAccessors.allowDirectSuper.get = function() {
|
|
2339
2283
|
return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0;
|
|
@@ -2343,8 +2287,7 @@ prototypeAccessors.treatFunctionsAsVar.get = function() {
|
|
|
2343
2287
|
};
|
|
2344
2288
|
prototypeAccessors.allowNewDotTarget.get = function() {
|
|
2345
2289
|
for (var i$1 = this.scopeStack.length - 1; i$1 >= 0; i$1--) {
|
|
2346
|
-
var
|
|
2347
|
-
var flags = ref$1.flags;
|
|
2290
|
+
var flags = this.scopeStack[i$1].flags;
|
|
2348
2291
|
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) || flags & SCOPE_FUNCTION && !(flags & SCOPE_ARROW)) return true;
|
|
2349
2292
|
}
|
|
2350
2293
|
return false;
|
|
@@ -2806,10 +2749,7 @@ pp$8.parseEmptyStatement = function(node$1) {
|
|
|
2806
2749
|
return this.finishNode(node$1, "EmptyStatement");
|
|
2807
2750
|
};
|
|
2808
2751
|
pp$8.parseLabeledStatement = function(node$1, maybeName, expr, context) {
|
|
2809
|
-
for (var i$1 = 0, list$1 = this.labels; i$1 < list$1.length; i$1 += 1)
|
|
2810
|
-
var label = list$1[i$1];
|
|
2811
|
-
if (label.name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
2812
|
-
}
|
|
2752
|
+
for (var i$1 = 0, list$1 = this.labels; i$1 < list$1.length; i$1 += 1) if (list$1[i$1].name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
2813
2753
|
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
|
|
2814
2754
|
for (var i$2 = this.labels.length - 1; i$2 >= 0; i$2--) {
|
|
2815
2755
|
var label$1 = this.labels[i$2];
|
|
@@ -4263,10 +4203,7 @@ pp$5.parseFunctionBody = function(node$1, isArrowFunction, isMethod, forInit) {
|
|
|
4263
4203
|
this.exitScope();
|
|
4264
4204
|
};
|
|
4265
4205
|
pp$5.isSimpleParamList = function(params) {
|
|
4266
|
-
for (var i$1 = 0, list$1 = params; i$1 < list$1.length; i$1 += 1)
|
|
4267
|
-
var param = list$1[i$1];
|
|
4268
|
-
if (param.type !== "Identifier") return false;
|
|
4269
|
-
}
|
|
4206
|
+
for (var i$1 = 0, list$1 = params; i$1 < list$1.length; i$1 += 1) if (list$1[i$1].type !== "Identifier") return false;
|
|
4270
4207
|
return true;
|
|
4271
4208
|
};
|
|
4272
4209
|
pp$5.checkParams = function(node$1, allowDuplicates) {
|
|
@@ -4303,8 +4240,7 @@ pp$5.checkUnreserved = function(ref$1) {
|
|
|
4303
4240
|
if (this.inClassStaticBlock && (name === "arguments" || name === "await")) this.raise(start, "Cannot use " + name + " in class static initialization block");
|
|
4304
4241
|
if (this.keywords.test(name)) this.raise(start, "Unexpected keyword '" + name + "'");
|
|
4305
4242
|
if (this.options.ecmaVersion < 6 && this.input.slice(start, end).indexOf("\\") !== -1) return;
|
|
4306
|
-
|
|
4307
|
-
if (re.test(name)) {
|
|
4243
|
+
if ((this.strict ? this.reservedWordsStrict : this.reservedWords).test(name)) {
|
|
4308
4244
|
if (!this.inAsync && name === "await") this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function");
|
|
4309
4245
|
this.raiseRecoverable(start, "The keyword '" + name + "' is reserved");
|
|
4310
4246
|
}
|
|
@@ -4397,10 +4333,8 @@ pp$3.declareName = function(name, bindingType, pos) {
|
|
|
4397
4333
|
redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
|
|
4398
4334
|
scope.lexical.push(name);
|
|
4399
4335
|
if (this.inModule && scope.flags & SCOPE_TOP) delete this.undefinedExports[name];
|
|
4400
|
-
} else if (bindingType === BIND_SIMPLE_CATCH)
|
|
4401
|
-
|
|
4402
|
-
scope$1.lexical.push(name);
|
|
4403
|
-
} else if (bindingType === BIND_FUNCTION) {
|
|
4336
|
+
} else if (bindingType === BIND_SIMPLE_CATCH) this.currentScope().lexical.push(name);
|
|
4337
|
+
else if (bindingType === BIND_FUNCTION) {
|
|
4404
4338
|
var scope$2 = this.currentScope();
|
|
4405
4339
|
if (this.treatFunctionsAsVar) redeclared = scope$2.lexical.indexOf(name) > -1;
|
|
4406
4340
|
else redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1;
|
|
@@ -4876,11 +4810,9 @@ pp$1.regexp_groupSpecifier = function(state) {
|
|
|
4876
4810
|
if (!this.regexp_eatGroupName(state)) state.raise("Invalid group");
|
|
4877
4811
|
var trackDisjunction = this.options.ecmaVersion >= 16;
|
|
4878
4812
|
var known = state.groupNames[state.lastStringValue];
|
|
4879
|
-
if (known) if (trackDisjunction)
|
|
4880
|
-
var
|
|
4881
|
-
|
|
4882
|
-
}
|
|
4883
|
-
else state.raise("Duplicate capture group name");
|
|
4813
|
+
if (known) if (trackDisjunction) {
|
|
4814
|
+
for (var i$1 = 0, list$1 = known; i$1 < list$1.length; i$1 += 1) if (!list$1[i$1].separatedFrom(state.branchID)) state.raise("Duplicate capture group name");
|
|
4815
|
+
} else state.raise("Duplicate capture group name");
|
|
4884
4816
|
if (trackDisjunction) (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);
|
|
4885
4817
|
else state.groupNames[state.lastStringValue] = true;
|
|
4886
4818
|
}
|
|
@@ -5579,8 +5511,7 @@ pp.readToken_pipe_amp = function(code) {
|
|
|
5579
5511
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
5580
5512
|
if (next === code) {
|
|
5581
5513
|
if (this.options.ecmaVersion >= 12) {
|
|
5582
|
-
|
|
5583
|
-
if (next2 === 61) return this.finishOp(types$1.assign, 3);
|
|
5514
|
+
if (this.input.charCodeAt(this.pos + 2) === 61) return this.finishOp(types$1.assign, 3);
|
|
5584
5515
|
}
|
|
5585
5516
|
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2);
|
|
5586
5517
|
}
|
|
@@ -5588,8 +5519,7 @@ pp.readToken_pipe_amp = function(code) {
|
|
|
5588
5519
|
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1);
|
|
5589
5520
|
};
|
|
5590
5521
|
pp.readToken_caret = function() {
|
|
5591
|
-
|
|
5592
|
-
if (next === 61) return this.finishOp(types$1.assign, 2);
|
|
5522
|
+
if (this.input.charCodeAt(this.pos + 1) === 61) return this.finishOp(types$1.assign, 2);
|
|
5593
5523
|
return this.finishOp(types$1.bitwiseXOR, 1);
|
|
5594
5524
|
};
|
|
5595
5525
|
pp.readToken_plus_min = function(code) {
|
|
@@ -5640,8 +5570,7 @@ pp.readToken_question = function() {
|
|
|
5640
5570
|
}
|
|
5641
5571
|
if (next === 63) {
|
|
5642
5572
|
if (ecmaVersion$1 >= 12) {
|
|
5643
|
-
|
|
5644
|
-
if (next2$1 === 61) return this.finishOp(types$1.assign, 3);
|
|
5573
|
+
if (this.input.charCodeAt(this.pos + 2) === 61) return this.finishOp(types$1.assign, 3);
|
|
5645
5574
|
}
|
|
5646
5575
|
return this.finishOp(types$1.coalesce, 2);
|
|
5647
5576
|
}
|
|
@@ -6303,8 +6232,7 @@ codes.ERR_INVALID_ARG_VALUE = createError(
|
|
|
6303
6232
|
(name, value, reason = "is invalid") => {
|
|
6304
6233
|
let inspected = inspect(value);
|
|
6305
6234
|
if (inspected.length > 128) inspected = `${inspected.slice(0, 128)}...`;
|
|
6306
|
-
|
|
6307
|
-
return `The ${type} '${name}' ${reason}. Received ${inspected}`;
|
|
6235
|
+
return `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
|
|
6308
6236
|
},
|
|
6309
6237
|
TypeError
|
|
6310
6238
|
);
|
|
@@ -6490,17 +6418,15 @@ function read(jsonPath, { base, specifier }) {
|
|
|
6490
6418
|
function getPackageScopeConfig(resolved) {
|
|
6491
6419
|
let packageJSONUrl = new URL("package.json", resolved);
|
|
6492
6420
|
while (true) {
|
|
6493
|
-
|
|
6494
|
-
if (packageJSONPath$1.endsWith("node_modules/package.json")) break;
|
|
6421
|
+
if (packageJSONUrl.pathname.endsWith("node_modules/package.json")) break;
|
|
6495
6422
|
const packageConfig = read(fileURLToPath(packageJSONUrl), { specifier: resolved });
|
|
6496
6423
|
if (packageConfig.exists) return packageConfig;
|
|
6497
6424
|
const lastPackageJSONUrl = packageJSONUrl;
|
|
6498
6425
|
packageJSONUrl = new URL("../package.json", packageJSONUrl);
|
|
6499
6426
|
if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) break;
|
|
6500
6427
|
}
|
|
6501
|
-
const packageJSONPath = fileURLToPath(packageJSONUrl);
|
|
6502
6428
|
return {
|
|
6503
|
-
pjsonPath:
|
|
6429
|
+
pjsonPath: fileURLToPath(packageJSONUrl),
|
|
6504
6430
|
exists: false,
|
|
6505
6431
|
type: "none"
|
|
6506
6432
|
};
|
|
@@ -6573,7 +6499,7 @@ function getDataProtocolModuleFormat(parsed) {
|
|
|
6573
6499
|
* @param {URL} url
|
|
6574
6500
|
* @returns {string}
|
|
6575
6501
|
*/
|
|
6576
|
-
function extname
|
|
6502
|
+
function extname(url) {
|
|
6577
6503
|
const pathname = url.pathname;
|
|
6578
6504
|
let index = pathname.length;
|
|
6579
6505
|
while (index--) {
|
|
@@ -6587,7 +6513,7 @@ function extname$1(url) {
|
|
|
6587
6513
|
* @type {ProtocolHandler}
|
|
6588
6514
|
*/
|
|
6589
6515
|
function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
|
|
6590
|
-
const value = extname
|
|
6516
|
+
const value = extname(url);
|
|
6591
6517
|
if (value === ".js") {
|
|
6592
6518
|
const packageType = getPackageType(url);
|
|
6593
6519
|
if (packageType !== "none") return packageType;
|
|
@@ -6600,9 +6526,8 @@ function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
|
|
|
6600
6526
|
}
|
|
6601
6527
|
const format$1 = extensionFormatMap[value];
|
|
6602
6528
|
if (format$1) return format$1;
|
|
6603
|
-
if (ignoreErrors) return
|
|
6604
|
-
|
|
6605
|
-
throw new ERR_UNKNOWN_FILE_EXTENSION(value, filepath);
|
|
6529
|
+
if (ignoreErrors) return;
|
|
6530
|
+
throw new ERR_UNKNOWN_FILE_EXTENSION(value, fileURLToPath(url));
|
|
6606
6531
|
}
|
|
6607
6532
|
function getHttpProtocolModuleFormat() {}
|
|
6608
6533
|
/**
|
|
@@ -6651,8 +6576,7 @@ function emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, i
|
|
|
6651
6576
|
*/
|
|
6652
6577
|
function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
|
|
6653
6578
|
if (process$1.noDeprecation) return;
|
|
6654
|
-
|
|
6655
|
-
if (format$1 !== "module") return;
|
|
6579
|
+
if (defaultGetFormatWithoutErrors(url, { parentURL: base.href }) !== "module") return;
|
|
6656
6580
|
const urlPath = fileURLToPath(url.href);
|
|
6657
6581
|
const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
|
|
6658
6582
|
const basePath = fileURLToPath(base);
|
|
@@ -6797,8 +6721,7 @@ function exportsNotFound(subpath, packageJsonUrl, base) {
|
|
|
6797
6721
|
* @returns {never}
|
|
6798
6722
|
*/
|
|
6799
6723
|
function throwInvalidSubpath(request, match, packageJsonUrl, internal, base) {
|
|
6800
|
-
|
|
6801
|
-
throw new ERR_INVALID_MODULE_SPECIFIER(request, reason, base && fileURLToPath(base));
|
|
6724
|
+
throw new ERR_INVALID_MODULE_SPECIFIER(request, `request is not a valid match in pattern "${match}" for the "${internal ? "imports" : "exports"}" resolution of ${fileURLToPath(packageJsonUrl)}`, base && fileURLToPath(base));
|
|
6802
6725
|
}
|
|
6803
6726
|
/**
|
|
6804
6727
|
* @param {string} subpath
|
|
@@ -6833,18 +6756,14 @@ function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base
|
|
|
6833
6756
|
new URL$1(target);
|
|
6834
6757
|
isURL = true;
|
|
6835
6758
|
} catch {}
|
|
6836
|
-
if (!isURL)
|
|
6837
|
-
const exportTarget = pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target + subpath;
|
|
6838
|
-
return packageResolve(exportTarget, packageJsonUrl, conditions);
|
|
6839
|
-
}
|
|
6759
|
+
if (!isURL) return packageResolve(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target + subpath, packageJsonUrl, conditions);
|
|
6840
6760
|
}
|
|
6841
6761
|
throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
6842
6762
|
}
|
|
6843
6763
|
if (invalidSegmentRegEx.exec(target.slice(2)) !== null) if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) {
|
|
6844
6764
|
if (!isPathMap) {
|
|
6845
6765
|
const request = pattern ? match.replace("*", () => subpath) : match + subpath;
|
|
6846
|
-
|
|
6847
|
-
emitInvalidSegmentDeprecation(resolvedTarget, request, match, packageJsonUrl, internal, base, true);
|
|
6766
|
+
emitInvalidSegmentDeprecation(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target, request, match, packageJsonUrl, internal, base, true);
|
|
6848
6767
|
}
|
|
6849
6768
|
} else throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
6850
6769
|
const resolved = new URL$1(target, packageJsonUrl);
|
|
@@ -6855,10 +6774,7 @@ function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base
|
|
|
6855
6774
|
if (invalidSegmentRegEx.exec(subpath) !== null) {
|
|
6856
6775
|
const request = pattern ? match.replace("*", () => subpath) : match + subpath;
|
|
6857
6776
|
if (deprecatedInvalidSegmentRegEx.exec(subpath) === null) {
|
|
6858
|
-
if (!isPathMap)
|
|
6859
|
-
const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target;
|
|
6860
|
-
emitInvalidSegmentDeprecation(resolvedTarget, request, match, packageJsonUrl, internal, base, false);
|
|
6861
|
-
}
|
|
6777
|
+
if (!isPathMap) emitInvalidSegmentDeprecation(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target, request, match, packageJsonUrl, internal, base, false);
|
|
6862
6778
|
} else throwInvalidSubpath(request, match, packageJsonUrl, internal, base);
|
|
6863
6779
|
}
|
|
6864
6780
|
if (pattern) return new URL$1(RegExpPrototypeSymbolReplace.call(patternRegEx, resolved.href, () => subpath));
|
|
@@ -7036,10 +6952,7 @@ function patternKeyCompare(a, b) {
|
|
|
7036
6952
|
* @returns {URL}
|
|
7037
6953
|
*/
|
|
7038
6954
|
function packageImportsResolve(name, base, conditions) {
|
|
7039
|
-
if (name === "#" || name.startsWith("#/") || name.endsWith("/"))
|
|
7040
|
-
const reason = "is not a valid internal imports specifier name";
|
|
7041
|
-
throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath(base));
|
|
7042
|
-
}
|
|
6955
|
+
if (name === "#" || name.startsWith("#/") || name.endsWith("/")) throw new ERR_INVALID_MODULE_SPECIFIER(name, "is not a valid internal imports specifier name", fileURLToPath(base));
|
|
7043
6956
|
/** @type {URL | undefined} */
|
|
7044
6957
|
let packageJsonUrl;
|
|
7045
6958
|
const packageConfig = getPackageScopeConfig(base);
|
|
@@ -7090,10 +7003,9 @@ function parsePackageName(specifier, base) {
|
|
|
7090
7003
|
const packageName = separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);
|
|
7091
7004
|
if (invalidPackageNameRegEx.exec(packageName) !== null) validPackageName = false;
|
|
7092
7005
|
if (!validPackageName) throw new ERR_INVALID_MODULE_SPECIFIER(specifier, "is not a valid package name", fileURLToPath(base));
|
|
7093
|
-
const packageSubpath = "." + (separatorIndex === -1 ? "" : specifier.slice(separatorIndex));
|
|
7094
7006
|
return {
|
|
7095
7007
|
packageName,
|
|
7096
|
-
packageSubpath,
|
|
7008
|
+
packageSubpath: "." + (separatorIndex === -1 ? "" : specifier.slice(separatorIndex)),
|
|
7097
7009
|
isScoped
|
|
7098
7010
|
};
|
|
7099
7011
|
}
|
|
@@ -7171,8 +7083,7 @@ function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {
|
|
|
7171
7083
|
*/
|
|
7172
7084
|
function moduleResolve(specifier, base, conditions, preserveSymlinks) {
|
|
7173
7085
|
const protocol = base.protocol;
|
|
7174
|
-
const
|
|
7175
|
-
const isRemote = isData || protocol === "http:" || protocol === "https:";
|
|
7086
|
+
const isRemote = protocol === "data:" || protocol === "http:" || protocol === "https:";
|
|
7176
7087
|
/** @type {URL | undefined} */
|
|
7177
7088
|
let resolved;
|
|
7178
7089
|
if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) try {
|
|
@@ -7237,8 +7148,7 @@ function _resolve$1(id, options = {}) {
|
|
|
7237
7148
|
if (BUILTIN_MODULES.has(id)) return "node:" + id;
|
|
7238
7149
|
if (id.startsWith("file://")) id = fileURLToPath$1(id);
|
|
7239
7150
|
if (isAbsolute(id)) try {
|
|
7240
|
-
|
|
7241
|
-
if (stat.isFile()) return pathToFileURL$1(id);
|
|
7151
|
+
if (statSync(id).isFile()) return pathToFileURL$1(id);
|
|
7242
7152
|
} catch (error) {
|
|
7243
7153
|
if (error?.code !== "ENOENT") throw error;
|
|
7244
7154
|
}
|
|
@@ -7291,8 +7201,7 @@ function isQuansyncGenerator(value) {
|
|
|
7291
7201
|
}
|
|
7292
7202
|
function fromObject(options) {
|
|
7293
7203
|
const generator = function* (...args) {
|
|
7294
|
-
|
|
7295
|
-
if (isAsync) return yield options.async.apply(this, args);
|
|
7204
|
+
if (yield GET_IS_ASYNC) return yield options.async.apply(this, args);
|
|
7296
7205
|
return options.sync.apply(this, args);
|
|
7297
7206
|
};
|
|
7298
7207
|
function fn(...args) {
|
|
@@ -7478,10 +7387,14 @@ const isPackageListedSync = isPackageListed.sync;
|
|
|
7478
7387
|
//#endregion
|
|
7479
7388
|
//#region src/configs/react.ts
|
|
7480
7389
|
const ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
7390
|
+
const ReactCompilerPackages = ["babel-plugin-react-compiler"];
|
|
7481
7391
|
async function react(options = {}) {
|
|
7482
|
-
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, tsconfigPath } = options;
|
|
7392
|
+
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, reactCompiler = ReactCompilerPackages.some((i$1) => isPackageExists(i$1)), tsconfigPath } = options;
|
|
7483
7393
|
const isTypeAware = !!tsconfigPath;
|
|
7484
|
-
const typeAwareRules = {
|
|
7394
|
+
const typeAwareRules = {
|
|
7395
|
+
"react/no-leaked-conditional-rendering": "warn",
|
|
7396
|
+
"react/no-unused-props": "warn"
|
|
7397
|
+
};
|
|
7485
7398
|
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
|
|
7486
7399
|
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
7487
7400
|
interopDefault(import("eslint-plugin-react-hooks")),
|
|
@@ -7496,7 +7409,6 @@ async function react(options = {}) {
|
|
|
7496
7409
|
react: plugins["@eslint-react"],
|
|
7497
7410
|
"react-dom": plugins["@eslint-react/dom"],
|
|
7498
7411
|
"react-hooks": pluginReactHooks,
|
|
7499
|
-
"react-hooks-extra": plugins["@eslint-react/hooks-extra"],
|
|
7500
7412
|
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
7501
7413
|
"react-refresh": pluginReactRefresh,
|
|
7502
7414
|
"react-web-api": plugins["@eslint-react/web-api"]
|
|
@@ -7510,6 +7422,25 @@ async function react(options = {}) {
|
|
|
7510
7422
|
},
|
|
7511
7423
|
name: "phs/react/rules",
|
|
7512
7424
|
rules: {
|
|
7425
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
7426
|
+
"react-hooks/rules-of-hooks": "error",
|
|
7427
|
+
...reactCompiler ? {
|
|
7428
|
+
"react-hooks/component-hook-factories": "error",
|
|
7429
|
+
"react-hooks/config": "error",
|
|
7430
|
+
"react-hooks/error-boundaries": "error",
|
|
7431
|
+
"react-hooks/gating": "error",
|
|
7432
|
+
"react-hooks/globals": "error",
|
|
7433
|
+
"react-hooks/immutability": "error",
|
|
7434
|
+
"react-hooks/incompatible-library": "warn",
|
|
7435
|
+
"react-hooks/preserve-manual-memoization": "error",
|
|
7436
|
+
"react-hooks/purity": "error",
|
|
7437
|
+
"react-hooks/refs": "error",
|
|
7438
|
+
"react-hooks/set-state-in-effect": "error",
|
|
7439
|
+
"react-hooks/set-state-in-render": "error",
|
|
7440
|
+
"react-hooks/static-components": "error",
|
|
7441
|
+
"react-hooks/unsupported-syntax": "warn",
|
|
7442
|
+
"react-hooks/use-memo": "error"
|
|
7443
|
+
} : {},
|
|
7513
7444
|
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
7514
7445
|
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
7515
7446
|
"react-dom/no-find-dom-node": "error",
|
|
@@ -7525,17 +7456,15 @@ async function react(options = {}) {
|
|
|
7525
7456
|
"react-dom/no-unsafe-target-blank": "warn",
|
|
7526
7457
|
"react-dom/no-use-form-state": "error",
|
|
7527
7458
|
"react-dom/no-void-elements-with-children": "error",
|
|
7528
|
-
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
7529
|
-
"react-hooks-extra/no-unnecessary-use-prefix": "warn",
|
|
7530
|
-
"react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
|
|
7531
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
7532
|
-
"react-hooks/rules-of-hooks": "error",
|
|
7533
7459
|
"react-refresh/only-export-components": ["warn", { allowConstantExport: isAllowConstantExport }],
|
|
7534
7460
|
"react-web-api/no-leaked-event-listener": "warn",
|
|
7535
7461
|
"react-web-api/no-leaked-interval": "warn",
|
|
7536
7462
|
"react-web-api/no-leaked-resize-observer": "warn",
|
|
7537
7463
|
"react-web-api/no-leaked-timeout": "warn",
|
|
7464
|
+
"react/jsx-key-before-spread": "warn",
|
|
7465
|
+
"react/jsx-no-comment-textnodes": "warn",
|
|
7538
7466
|
"react/jsx-no-duplicate-props": "warn",
|
|
7467
|
+
"react/jsx-uses-react": "warn",
|
|
7539
7468
|
"react/jsx-uses-vars": "warn",
|
|
7540
7469
|
"react/no-access-state-in-setstate": "error",
|
|
7541
7470
|
"react/no-array-index-key": "warn",
|
|
@@ -7545,7 +7474,6 @@ async function react(options = {}) {
|
|
|
7545
7474
|
"react/no-children-only": "warn",
|
|
7546
7475
|
"react/no-children-to-array": "warn",
|
|
7547
7476
|
"react/no-clone-element": "warn",
|
|
7548
|
-
"react/no-comment-textnodes": "warn",
|
|
7549
7477
|
"react/no-component-will-mount": "error",
|
|
7550
7478
|
"react/no-component-will-receive-props": "error",
|
|
7551
7479
|
"react/no-component-will-update": "error",
|
|
@@ -7553,26 +7481,31 @@ async function react(options = {}) {
|
|
|
7553
7481
|
"react/no-create-ref": "error",
|
|
7554
7482
|
"react/no-default-props": "error",
|
|
7555
7483
|
"react/no-direct-mutation-state": "error",
|
|
7556
|
-
"react/no-duplicate-key": "
|
|
7484
|
+
"react/no-duplicate-key": "error",
|
|
7557
7485
|
"react/no-forward-ref": "warn",
|
|
7558
7486
|
"react/no-implicit-key": "warn",
|
|
7559
7487
|
"react/no-missing-key": "error",
|
|
7560
7488
|
"react/no-nested-component-definitions": "error",
|
|
7489
|
+
"react/no-nested-lazy-component-declarations": "error",
|
|
7561
7490
|
"react/no-prop-types": "error",
|
|
7562
7491
|
"react/no-redundant-should-component-update": "error",
|
|
7563
7492
|
"react/no-set-state-in-component-did-mount": "warn",
|
|
7564
7493
|
"react/no-set-state-in-component-did-update": "warn",
|
|
7565
7494
|
"react/no-set-state-in-component-will-update": "warn",
|
|
7566
7495
|
"react/no-string-refs": "error",
|
|
7496
|
+
"react/no-unnecessary-use-prefix": "warn",
|
|
7567
7497
|
"react/no-unsafe-component-will-mount": "warn",
|
|
7568
7498
|
"react/no-unsafe-component-will-receive-props": "warn",
|
|
7569
7499
|
"react/no-unsafe-component-will-update": "warn",
|
|
7570
|
-
"react/no-unstable-context-value": "warn",
|
|
7571
|
-
"react/no-unstable-default-props": "warn",
|
|
7572
7500
|
"react/no-unused-class-component-members": "warn",
|
|
7573
|
-
"react/no-unused-state": "warn",
|
|
7574
7501
|
"react/no-use-context": "warn",
|
|
7575
7502
|
"react/no-useless-forward-ref": "warn",
|
|
7503
|
+
"react/prefer-namespace-import": "error",
|
|
7504
|
+
"react/prefer-use-state-lazy-initialization": "warn",
|
|
7505
|
+
"react-naming-convention/component-name": ["error", { rule: "PascalCase" }],
|
|
7506
|
+
"react-naming-convention/context-name": "warn",
|
|
7507
|
+
"react-naming-convention/ref-name": "warn",
|
|
7508
|
+
"react-naming-convention/use-state": "warn",
|
|
7576
7509
|
...overrides
|
|
7577
7510
|
}
|
|
7578
7511
|
},
|
|
@@ -8397,6 +8330,7 @@ function phs(options = {}, ...userConfigs) {
|
|
|
8397
8330
|
if (enableTest) configs$1.push(test({ overrides: getOverrides(options, "test") }));
|
|
8398
8331
|
if (enableReact) configs$1.push(react({
|
|
8399
8332
|
...typescriptOptions,
|
|
8333
|
+
...resolveSubOptions(options, "react"),
|
|
8400
8334
|
overrides: getOverrides(options, "react"),
|
|
8401
8335
|
tsconfigPath
|
|
8402
8336
|
}));
|
|
@@ -8444,5 +8378,4 @@ function resolveSubOptions(options, key) {
|
|
|
8444
8378
|
}
|
|
8445
8379
|
|
|
8446
8380
|
//#endregion
|
|
8447
|
-
export { StylisticConfigDefaults, astro, combine, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, phs, pnpm, react, regexp, renamePluginInConfigs, renameRules, sortPackageJson, sortTsconfig, sortTurboConfig, stylistic, svelte, tailwind, test, toArray, toml, typescript, unicorn, yaml };
|
|
8448
|
-
//# sourceMappingURL=index.js.map
|
|
8381
|
+
export { StylisticConfigDefaults, astro, combine, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, phs, pnpm, react, regexp, renamePluginInConfigs, renameRules, sortPackageJson, sortTsconfig, sortTurboConfig, stylistic, svelte, tailwind, test, toArray, toml, typescript, unicorn, yaml };
|