@pobammer-ts/eslint-cease-nonsense-rules 1.11.0 → 1.13.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/README.md +58 -0
- package/dist/build-metadata.json +3 -3
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +629 -274
- package/dist/index.js.map +46 -43
- package/dist/rules/ban-instances.d.ts +6 -7
- package/dist/rules/ban-instances.d.ts.map +1 -1
- package/dist/rules/ban-react-fc.d.ts +4 -7
- package/dist/rules/ban-react-fc.d.ts.map +1 -1
- package/dist/rules/enforce-ianitor-check-type.d.ts +7 -3
- package/dist/rules/enforce-ianitor-check-type.d.ts.map +1 -1
- package/dist/rules/no-async-constructor.d.ts +4 -5
- package/dist/rules/no-async-constructor.d.ts.map +1 -1
- package/dist/rules/no-color3-constructor.d.ts +4 -3
- package/dist/rules/no-color3-constructor.d.ts.map +1 -1
- package/dist/rules/no-god-components.d.ts.map +1 -1
- package/dist/rules/no-identity-map.d.ts +4 -2
- package/dist/rules/no-identity-map.d.ts.map +1 -1
- package/dist/rules/no-instance-methods-without-this.d.ts +4 -9
- package/dist/rules/no-instance-methods-without-this.d.ts.map +1 -1
- package/dist/rules/no-print.d.ts +4 -3
- package/dist/rules/no-print.d.ts.map +1 -1
- package/dist/rules/no-shorthand-names.d.ts.map +1 -1
- package/dist/rules/no-useless-use-spring.d.ts +4 -4
- package/dist/rules/no-useless-use-spring.d.ts.map +1 -1
- package/dist/rules/no-warn.d.ts +4 -3
- package/dist/rules/no-warn.d.ts.map +1 -1
- package/dist/rules/prefer-class-properties.d.ts +4 -3
- package/dist/rules/prefer-class-properties.d.ts.map +1 -1
- package/dist/rules/prefer-early-return.d.ts +4 -4
- package/dist/rules/prefer-early-return.d.ts.map +1 -1
- package/dist/rules/prefer-module-scope-constants.d.ts +4 -2
- package/dist/rules/prefer-module-scope-constants.d.ts.map +1 -1
- package/dist/rules/prefer-pascal-case-enums.d.ts +4 -4
- package/dist/rules/prefer-pascal-case-enums.d.ts.map +1 -1
- package/dist/rules/prefer-pattern-replacements.d.ts +6 -11
- package/dist/rules/prefer-pattern-replacements.d.ts.map +1 -1
- package/dist/rules/prefer-sequence-overloads.d.ts +4 -7
- package/dist/rules/prefer-sequence-overloads.d.ts.map +1 -1
- package/dist/rules/prefer-singular-enums.d.ts +4 -4
- package/dist/rules/prefer-singular-enums.d.ts.map +1 -1
- package/dist/rules/react-hooks-strict-return.d.ts +4 -3
- package/dist/rules/react-hooks-strict-return.d.ts.map +1 -1
- package/dist/rules/require-react-component-keys.d.ts +4 -5
- package/dist/rules/require-react-component-keys.d.ts.map +1 -1
- package/dist/rules/require-react-display-names.d.ts +11 -0
- package/dist/rules/require-react-display-names.d.ts.map +1 -0
- package/dist/rules/strict-component-boundaries.d.ts +4 -8
- package/dist/rules/strict-component-boundaries.d.ts.map +1 -1
- package/dist/utilities/configure-utilities.d.ts +7 -0
- package/dist/utilities/configure-utilities.d.ts.map +1 -1
- package/dist/utilities/create-rule.d.ts +9 -0
- package/dist/utilities/create-rule.d.ts.map +1 -0
- package/package.json +17 -17
package/dist/index.js
CHANGED
|
@@ -7726,7 +7726,7 @@ var require_Referencer = __commonJS((exports) => {
|
|
|
7726
7726
|
this.visitForIn(node);
|
|
7727
7727
|
}
|
|
7728
7728
|
ForStatement(node) {
|
|
7729
|
-
if (node.init
|
|
7729
|
+
if (node.init?.type === types_1.AST_NODE_TYPES.VariableDeclaration && node.init.kind !== "var") {
|
|
7730
7730
|
this.scopeManager.nestForScope(node);
|
|
7731
7731
|
}
|
|
7732
7732
|
this.visitChildren(node);
|
|
@@ -8233,7 +8233,6 @@ function Assign(left, right) {
|
|
|
8233
8233
|
var exports_emit = {};
|
|
8234
8234
|
__export(exports_emit, {
|
|
8235
8235
|
Ternary: () => Ternary,
|
|
8236
|
-
StringGraphemeCount: () => StringGraphemeCount2,
|
|
8237
8236
|
Statements: () => Statements,
|
|
8238
8237
|
Return: () => Return,
|
|
8239
8238
|
ReduceOr: () => ReduceOr,
|
|
@@ -8252,6 +8251,8 @@ __export(exports_emit, {
|
|
|
8252
8251
|
IsObject: () => IsObject2,
|
|
8253
8252
|
IsNumber: () => IsNumber2,
|
|
8254
8253
|
IsNull: () => IsNull2,
|
|
8254
|
+
IsMinLength: () => IsMinLength3,
|
|
8255
|
+
IsMaxLength: () => IsMaxLength3,
|
|
8255
8256
|
IsLessThan: () => IsLessThan2,
|
|
8256
8257
|
IsLessEqualThan: () => IsLessEqualThan2,
|
|
8257
8258
|
IsIterator: () => IsIterator2,
|
|
@@ -8283,7 +8284,6 @@ var exports_guard = {};
|
|
|
8283
8284
|
__export(exports_guard, {
|
|
8284
8285
|
Values: () => Values,
|
|
8285
8286
|
Symbols: () => Symbols,
|
|
8286
|
-
StringGraphemeCount: () => StringGraphemeCount,
|
|
8287
8287
|
Keys: () => Keys,
|
|
8288
8288
|
IsValueLike: () => IsValueLike,
|
|
8289
8289
|
IsUndefined: () => IsUndefined,
|
|
@@ -8294,6 +8294,8 @@ __export(exports_guard, {
|
|
|
8294
8294
|
IsNumber: () => IsNumber,
|
|
8295
8295
|
IsNull: () => IsNull,
|
|
8296
8296
|
IsMultipleOf: () => IsMultipleOf,
|
|
8297
|
+
IsMinLength: () => IsMinLength2,
|
|
8298
|
+
IsMaxLength: () => IsMaxLength2,
|
|
8297
8299
|
IsLessThan: () => IsLessThan,
|
|
8298
8300
|
IsLessEqualThan: () => IsLessEqualThan,
|
|
8299
8301
|
IsIterator: () => IsIterator,
|
|
@@ -8310,11 +8312,114 @@ __export(exports_guard, {
|
|
|
8310
8312
|
IsAsyncIterator: () => IsAsyncIterator,
|
|
8311
8313
|
IsArray: () => IsArray,
|
|
8312
8314
|
HasPropertyKey: () => HasPropertyKey,
|
|
8315
|
+
GraphemeCount: () => GraphemeCount2,
|
|
8313
8316
|
EveryAll: () => EveryAll,
|
|
8314
8317
|
Every: () => Every,
|
|
8315
8318
|
EntriesRegExp: () => EntriesRegExp,
|
|
8316
8319
|
Entries: () => Entries
|
|
8317
8320
|
});
|
|
8321
|
+
|
|
8322
|
+
// node_modules/typebox/build/guard/string.mjs
|
|
8323
|
+
function IsBetween(value, min, max) {
|
|
8324
|
+
return value >= min && value <= max;
|
|
8325
|
+
}
|
|
8326
|
+
function IsRegionalIndicator(value) {
|
|
8327
|
+
return IsBetween(value, 127462, 127487);
|
|
8328
|
+
}
|
|
8329
|
+
function IsVariationSelector(value) {
|
|
8330
|
+
return IsBetween(value, 65024, 65039);
|
|
8331
|
+
}
|
|
8332
|
+
function IsCombiningMark(value) {
|
|
8333
|
+
return IsBetween(value, 768, 879) || IsBetween(value, 6832, 6911) || IsBetween(value, 7616, 7679) || IsBetween(value, 65056, 65071);
|
|
8334
|
+
}
|
|
8335
|
+
function CodePointLength(value) {
|
|
8336
|
+
return value > 65535 ? 2 : 1;
|
|
8337
|
+
}
|
|
8338
|
+
function ConsumeModifiers(value, index) {
|
|
8339
|
+
while (index < value.length) {
|
|
8340
|
+
const point = value.codePointAt(index);
|
|
8341
|
+
if (IsCombiningMark(point) || IsVariationSelector(point)) {
|
|
8342
|
+
index += CodePointLength(point);
|
|
8343
|
+
} else {
|
|
8344
|
+
break;
|
|
8345
|
+
}
|
|
8346
|
+
}
|
|
8347
|
+
return index;
|
|
8348
|
+
}
|
|
8349
|
+
function NextGraphemeClusterIndex(value, clusterStart) {
|
|
8350
|
+
const startCP = value.codePointAt(clusterStart);
|
|
8351
|
+
let clusterEnd = clusterStart + CodePointLength(startCP);
|
|
8352
|
+
clusterEnd = ConsumeModifiers(value, clusterEnd);
|
|
8353
|
+
while (clusterEnd < value.length - 1 && value[clusterEnd] === "") {
|
|
8354
|
+
const nextCP = value.codePointAt(clusterEnd + 1);
|
|
8355
|
+
clusterEnd += 1 + CodePointLength(nextCP);
|
|
8356
|
+
clusterEnd = ConsumeModifiers(value, clusterEnd);
|
|
8357
|
+
}
|
|
8358
|
+
if (IsRegionalIndicator(startCP) && clusterEnd < value.length && IsRegionalIndicator(value.codePointAt(clusterEnd))) {
|
|
8359
|
+
clusterEnd += CodePointLength(value.codePointAt(clusterEnd));
|
|
8360
|
+
}
|
|
8361
|
+
return clusterEnd;
|
|
8362
|
+
}
|
|
8363
|
+
function IsGraphemeCodePoint(value) {
|
|
8364
|
+
return IsBetween(value, 55296, 56319) || IsBetween(value, 768, 879) || value === 8205;
|
|
8365
|
+
}
|
|
8366
|
+
function GraphemeCount(value) {
|
|
8367
|
+
let count = 0;
|
|
8368
|
+
let index = 0;
|
|
8369
|
+
while (index < value.length) {
|
|
8370
|
+
index = NextGraphemeClusterIndex(value, index);
|
|
8371
|
+
count++;
|
|
8372
|
+
}
|
|
8373
|
+
return count;
|
|
8374
|
+
}
|
|
8375
|
+
function IsMinLength(value, minLength) {
|
|
8376
|
+
let count = 0;
|
|
8377
|
+
let index = 0;
|
|
8378
|
+
while (index < value.length) {
|
|
8379
|
+
index = NextGraphemeClusterIndex(value, index);
|
|
8380
|
+
count++;
|
|
8381
|
+
if (count >= minLength)
|
|
8382
|
+
return true;
|
|
8383
|
+
}
|
|
8384
|
+
return false;
|
|
8385
|
+
}
|
|
8386
|
+
function IsMaxLength(value, maxLength) {
|
|
8387
|
+
let count = 0;
|
|
8388
|
+
let index = 0;
|
|
8389
|
+
while (index < value.length) {
|
|
8390
|
+
index = NextGraphemeClusterIndex(value, index);
|
|
8391
|
+
count++;
|
|
8392
|
+
if (count > maxLength)
|
|
8393
|
+
return false;
|
|
8394
|
+
}
|
|
8395
|
+
return true;
|
|
8396
|
+
}
|
|
8397
|
+
function IsMinLengthFast(value, minLength) {
|
|
8398
|
+
let index = 0;
|
|
8399
|
+
while (index < value.length) {
|
|
8400
|
+
if (IsGraphemeCodePoint(value.charCodeAt(index))) {
|
|
8401
|
+
return IsMinLength(value, minLength);
|
|
8402
|
+
}
|
|
8403
|
+
index++;
|
|
8404
|
+
if (index >= minLength)
|
|
8405
|
+
return true;
|
|
8406
|
+
}
|
|
8407
|
+
return false;
|
|
8408
|
+
}
|
|
8409
|
+
function IsMaxLengthFast(value, maxLength) {
|
|
8410
|
+
let index = 0;
|
|
8411
|
+
while (index < value.length) {
|
|
8412
|
+
if (IsGraphemeCodePoint(value.charCodeAt(index))) {
|
|
8413
|
+
return IsMaxLength(value, maxLength);
|
|
8414
|
+
}
|
|
8415
|
+
index++;
|
|
8416
|
+
if (index > maxLength)
|
|
8417
|
+
return false;
|
|
8418
|
+
}
|
|
8419
|
+
return true;
|
|
8420
|
+
}
|
|
8421
|
+
|
|
8422
|
+
// node_modules/typebox/build/guard/guard.mjs
|
|
8318
8423
|
function IsArray(value) {
|
|
8319
8424
|
return Array.isArray(value);
|
|
8320
8425
|
}
|
|
@@ -8405,8 +8510,14 @@ function IsClassInstance(value) {
|
|
|
8405
8510
|
function IsValueLike(value) {
|
|
8406
8511
|
return IsBigInt(value) || IsBoolean(value) || IsNull(value) || IsNumber(value) || IsString(value) || IsUndefined(value);
|
|
8407
8512
|
}
|
|
8408
|
-
function
|
|
8409
|
-
return
|
|
8513
|
+
function GraphemeCount2(value) {
|
|
8514
|
+
return GraphemeCount(value);
|
|
8515
|
+
}
|
|
8516
|
+
function IsMaxLength2(value, length) {
|
|
8517
|
+
return IsMaxLengthFast(value, length);
|
|
8518
|
+
}
|
|
8519
|
+
function IsMinLength2(value, length) {
|
|
8520
|
+
return IsMinLengthFast(value, length);
|
|
8410
8521
|
}
|
|
8411
8522
|
function Every(value, offset, callback) {
|
|
8412
8523
|
for (let index = offset;index < value.length; index++) {
|
|
@@ -8529,8 +8640,11 @@ function IsLessEqualThan2(left, right) {
|
|
|
8529
8640
|
function IsGreaterEqualThan2(left, right) {
|
|
8530
8641
|
return `${left} >= ${right}`;
|
|
8531
8642
|
}
|
|
8532
|
-
function
|
|
8533
|
-
return `Guard.
|
|
8643
|
+
function IsMinLength3(value, length) {
|
|
8644
|
+
return `Guard.IsMinLength(${value}, ${length})`;
|
|
8645
|
+
}
|
|
8646
|
+
function IsMaxLength3(value, length) {
|
|
8647
|
+
return `Guard.IsMaxLength(${value}, ${length})`;
|
|
8534
8648
|
}
|
|
8535
8649
|
function Every2(value, offset, params, expression) {
|
|
8536
8650
|
return IsEqual(offset, "0") ? `${value}.every((${params[0]}, ${params[1]}) => ${expression})` : `((value, callback) => { for(let index = ${offset}; index < value.length; index++) if (!callback(value[index], index)) return false; return true })(${value}, (${params[0]}, ${params[1]}) => ${expression})`;
|
|
@@ -10794,6 +10908,10 @@ function EvaluateUnion(types) {
|
|
|
10794
10908
|
function EvaluateType(type) {
|
|
10795
10909
|
return IsIntersect(type) ? EvaluateIntersect(type.allOf) : IsUnion(type) ? EvaluateUnion(type.anyOf) : type;
|
|
10796
10910
|
}
|
|
10911
|
+
function EvaluateUnionFast(types) {
|
|
10912
|
+
const result = exports_guard.IsEqual(types.length, 1) ? types[0] : exports_guard.IsEqual(types.length, 0) ? Never() : Union(types);
|
|
10913
|
+
return result;
|
|
10914
|
+
}
|
|
10797
10915
|
|
|
10798
10916
|
// node_modules/typebox/build/type/engine/evaluate/broaden.mjs
|
|
10799
10917
|
function BroadFilter(type, types) {
|
|
@@ -11559,10 +11677,10 @@ function IndexElementsWithIndexer(types, indexer) {
|
|
|
11559
11677
|
function FromTupleWithIndexer(types, indexer) {
|
|
11560
11678
|
const formattedArrayIndexer = FormatArrayIndexer(indexer);
|
|
11561
11679
|
const elements = IndexElementsWithIndexer(types, formattedArrayIndexer);
|
|
11562
|
-
return
|
|
11680
|
+
return EvaluateUnionFast(elements);
|
|
11563
11681
|
}
|
|
11564
11682
|
function FromTupleWithoutIndexer(types) {
|
|
11565
|
-
return
|
|
11683
|
+
return EvaluateUnionFast(types);
|
|
11566
11684
|
}
|
|
11567
11685
|
function FromTuple(types, indexer) {
|
|
11568
11686
|
return IsNumber4(indexer) || IsInteger3(indexer) ? FromTupleWithoutIndexer(types) : FromTupleWithIndexer(types, indexer);
|
|
@@ -11731,7 +11849,7 @@ function FromPropertyKeys(keys) {
|
|
|
11731
11849
|
function FromObject5(properties2) {
|
|
11732
11850
|
const propertyKeys = exports_guard.Keys(properties2);
|
|
11733
11851
|
const variants = FromPropertyKeys(propertyKeys);
|
|
11734
|
-
const result =
|
|
11852
|
+
const result = EvaluateUnionFast(variants);
|
|
11735
11853
|
return result;
|
|
11736
11854
|
}
|
|
11737
11855
|
|
|
@@ -11743,7 +11861,7 @@ function FromRecord(type) {
|
|
|
11743
11861
|
// node_modules/typebox/build/type/engine/keyof/from-tuple.mjs
|
|
11744
11862
|
function FromTuple3(types) {
|
|
11745
11863
|
const result = types.map((_, index) => Literal(index));
|
|
11746
|
-
return
|
|
11864
|
+
return EvaluateUnionFast(result);
|
|
11747
11865
|
}
|
|
11748
11866
|
|
|
11749
11867
|
// node_modules/typebox/build/type/engine/keyof/instantiate.mjs
|
|
@@ -12674,7 +12792,7 @@ function IsMaxItems(schema2) {
|
|
|
12674
12792
|
return exports_guard.HasPropertyKey(schema2, "maxItems") && exports_guard.IsNumber(schema2.maxItems);
|
|
12675
12793
|
}
|
|
12676
12794
|
// node_modules/typebox/build/schema/types/maxLength.mjs
|
|
12677
|
-
function
|
|
12795
|
+
function IsMaxLength4(schema2) {
|
|
12678
12796
|
return exports_guard.HasPropertyKey(schema2, "maxLength") && exports_guard.IsNumber(schema2.maxLength);
|
|
12679
12797
|
}
|
|
12680
12798
|
// node_modules/typebox/build/schema/types/maxProperties.mjs
|
|
@@ -12694,7 +12812,7 @@ function IsMinItems(schema2) {
|
|
|
12694
12812
|
return exports_guard.HasPropertyKey(schema2, "minItems") && exports_guard.IsNumber(schema2.minItems);
|
|
12695
12813
|
}
|
|
12696
12814
|
// node_modules/typebox/build/schema/types/minLength.mjs
|
|
12697
|
-
function
|
|
12815
|
+
function IsMinLength4(schema2) {
|
|
12698
12816
|
return exports_guard.HasPropertyKey(schema2, "minLength") && exports_guard.IsNumber(schema2.minLength);
|
|
12699
12817
|
}
|
|
12700
12818
|
// node_modules/typebox/build/schema/types/minProperties.mjs
|
|
@@ -13818,10 +13936,10 @@ function ErrorMaxItems(stack, context, schemaPath, instancePath, schema4, value)
|
|
|
13818
13936
|
|
|
13819
13937
|
// node_modules/typebox/build/schema/engine/maxLength.mjs
|
|
13820
13938
|
function BuildMaxLength(stack, context, schema4, value) {
|
|
13821
|
-
return exports_emit.
|
|
13939
|
+
return exports_emit.IsMaxLength(value, exports_emit.Constant(schema4.maxLength));
|
|
13822
13940
|
}
|
|
13823
13941
|
function CheckMaxLength(stack, context, schema4, value) {
|
|
13824
|
-
return exports_guard.
|
|
13942
|
+
return exports_guard.IsMaxLength(value, schema4.maxLength);
|
|
13825
13943
|
}
|
|
13826
13944
|
function ErrorMaxLength(stack, context, schemaPath, instancePath, schema4, value) {
|
|
13827
13945
|
return CheckMaxLength(stack, context, schema4, value) || context.AddError({
|
|
@@ -13908,10 +14026,10 @@ function ErrorMinItems(stack, context, schemaPath, instancePath, schema4, value)
|
|
|
13908
14026
|
|
|
13909
14027
|
// node_modules/typebox/build/schema/engine/minLength.mjs
|
|
13910
14028
|
function BuildMinLength(stack, context, schema4, value) {
|
|
13911
|
-
return exports_emit.
|
|
14029
|
+
return exports_emit.IsMinLength(value, exports_emit.Constant(schema4.minLength));
|
|
13912
14030
|
}
|
|
13913
14031
|
function CheckMinLength(stack, context, schema4, value) {
|
|
13914
|
-
return exports_guard.
|
|
14032
|
+
return exports_guard.IsMinLength(value, schema4.minLength);
|
|
13915
14033
|
}
|
|
13916
14034
|
function ErrorMinLength(stack, context, schemaPath, instancePath, schema4, value) {
|
|
13917
14035
|
return CheckMinLength(stack, context, schema4, value) || context.AddError({
|
|
@@ -14403,7 +14521,7 @@ function HasStringType(schema4) {
|
|
|
14403
14521
|
return HasTypeName(schema4, "string");
|
|
14404
14522
|
}
|
|
14405
14523
|
function HasStringKeywords(schema4) {
|
|
14406
|
-
return IsSchemaObject(schema4) && (
|
|
14524
|
+
return IsSchemaObject(schema4) && (IsMinLength4(schema4) || IsMaxLength4(schema4) || IsFormat(schema4) || IsPattern(schema4));
|
|
14407
14525
|
}
|
|
14408
14526
|
function HasNumberType(schema4) {
|
|
14409
14527
|
return HasTypeName(schema4, "number") || HasTypeName(schema4, "bigint");
|
|
@@ -14472,9 +14590,9 @@ function BuildSchema(stack, context, schema4, value) {
|
|
|
14472
14590
|
const constraints = [];
|
|
14473
14591
|
if (IsFormat(schema4))
|
|
14474
14592
|
constraints.push(BuildFormat(stack, context, schema4, value));
|
|
14475
|
-
if (
|
|
14593
|
+
if (IsMaxLength4(schema4))
|
|
14476
14594
|
constraints.push(BuildMaxLength(stack, context, schema4, value));
|
|
14477
|
-
if (
|
|
14595
|
+
if (IsMinLength4(schema4))
|
|
14478
14596
|
constraints.push(BuildMinLength(stack, context, schema4, value));
|
|
14479
14597
|
if (IsPattern(schema4))
|
|
14480
14598
|
constraints.push(BuildPattern(stack, context, schema4, value));
|
|
@@ -14530,13 +14648,13 @@ function BuildSchema(stack, context, schema4, value) {
|
|
|
14530
14648
|
}
|
|
14531
14649
|
function CheckSchema(stack, context, schema4, value) {
|
|
14532
14650
|
stack.Push(schema4);
|
|
14533
|
-
const result = IsBooleanSchema(schema4) ? CheckBooleanSchema(stack, context, schema4, value) : (!IsType(schema4) || CheckType(stack, context, schema4, value)) && (!(exports_guard.IsObject(value) && !exports_guard.IsArray(value)) || (!IsRequired(schema4) || CheckRequired(stack, context, schema4, value)) && (!IsAdditionalProperties(schema4) || CheckAdditionalProperties(stack, context, schema4, value)) && (!IsDependencies(schema4) || CheckDependencies(stack, context, schema4, value)) && (!IsDependentRequired(schema4) || CheckDependentRequired(stack, context, schema4, value)) && (!IsDependentSchemas(schema4) || CheckDependentSchemas(stack, context, schema4, value)) && (!IsPatternProperties(schema4) || CheckPatternProperties(stack, context, schema4, value)) && (!IsProperties(schema4) || CheckProperties(stack, context, schema4, value)) && (!IsPropertyNames(schema4) || CheckPropertyNames(stack, context, schema4, value)) && (!IsMinProperties(schema4) || CheckMinProperties(stack, context, schema4, value)) && (!IsMaxProperties(schema4) || CheckMaxProperties(stack, context, schema4, value))) && (!exports_guard.IsArray(value) || (!IsAdditionalItems(schema4) || CheckAdditionalItems(stack, context, schema4, value)) && (!IsContains(schema4) || CheckContains(stack, context, schema4, value)) && (!IsItems(schema4) || CheckItems(stack, context, schema4, value)) && (!IsMaxContains(schema4) || CheckMaxContains(stack, context, schema4, value)) && (!IsMaxItems(schema4) || CheckMaxItems(stack, context, schema4, value)) && (!IsMinContains(schema4) || CheckMinContains(stack, context, schema4, value)) && (!IsMinItems(schema4) || CheckMinItems(stack, context, schema4, value)) && (!IsPrefixItems(schema4) || CheckPrefixItems(stack, context, schema4, value)) && (!IsUniqueItems(schema4) || CheckUniqueItems(stack, context, schema4, value))) && (!exports_guard.IsString(value) || (!IsFormat(schema4) || CheckFormat(stack, context, schema4, value)) && (!
|
|
14651
|
+
const result = IsBooleanSchema(schema4) ? CheckBooleanSchema(stack, context, schema4, value) : (!IsType(schema4) || CheckType(stack, context, schema4, value)) && (!(exports_guard.IsObject(value) && !exports_guard.IsArray(value)) || (!IsRequired(schema4) || CheckRequired(stack, context, schema4, value)) && (!IsAdditionalProperties(schema4) || CheckAdditionalProperties(stack, context, schema4, value)) && (!IsDependencies(schema4) || CheckDependencies(stack, context, schema4, value)) && (!IsDependentRequired(schema4) || CheckDependentRequired(stack, context, schema4, value)) && (!IsDependentSchemas(schema4) || CheckDependentSchemas(stack, context, schema4, value)) && (!IsPatternProperties(schema4) || CheckPatternProperties(stack, context, schema4, value)) && (!IsProperties(schema4) || CheckProperties(stack, context, schema4, value)) && (!IsPropertyNames(schema4) || CheckPropertyNames(stack, context, schema4, value)) && (!IsMinProperties(schema4) || CheckMinProperties(stack, context, schema4, value)) && (!IsMaxProperties(schema4) || CheckMaxProperties(stack, context, schema4, value))) && (!exports_guard.IsArray(value) || (!IsAdditionalItems(schema4) || CheckAdditionalItems(stack, context, schema4, value)) && (!IsContains(schema4) || CheckContains(stack, context, schema4, value)) && (!IsItems(schema4) || CheckItems(stack, context, schema4, value)) && (!IsMaxContains(schema4) || CheckMaxContains(stack, context, schema4, value)) && (!IsMaxItems(schema4) || CheckMaxItems(stack, context, schema4, value)) && (!IsMinContains(schema4) || CheckMinContains(stack, context, schema4, value)) && (!IsMinItems(schema4) || CheckMinItems(stack, context, schema4, value)) && (!IsPrefixItems(schema4) || CheckPrefixItems(stack, context, schema4, value)) && (!IsUniqueItems(schema4) || CheckUniqueItems(stack, context, schema4, value))) && (!exports_guard.IsString(value) || (!IsFormat(schema4) || CheckFormat(stack, context, schema4, value)) && (!IsMaxLength4(schema4) || CheckMaxLength(stack, context, schema4, value)) && (!IsMinLength4(schema4) || CheckMinLength(stack, context, schema4, value)) && (!IsPattern(schema4) || CheckPattern(stack, context, schema4, value))) && (!(exports_guard.IsNumber(value) || exports_guard.IsBigInt(value)) || (!IsExclusiveMaximum(schema4) || CheckExclusiveMaximum(stack, context, schema4, value)) && (!IsExclusiveMinimum(schema4) || CheckExclusiveMinimum(stack, context, schema4, value)) && (!IsMaximum(schema4) || CheckMaximum(stack, context, schema4, value)) && (!IsMinimum(schema4) || CheckMinimum(stack, context, schema4, value)) && (!IsMultipleOf2(schema4) || CheckMultipleOf(stack, context, schema4, value))) && (!IsRecursiveRef(schema4) || CheckRecursiveRef(stack, context, schema4, value)) && (!IsRef2(schema4) || CheckRef(stack, context, schema4, value)) && (!IsGuard2(schema4) || CheckGuard(stack, context, schema4, value)) && (!IsConst(schema4) || CheckConst(stack, context, schema4, value)) && (!IsEnum2(schema4) || CheckEnum(stack, context, schema4, value)) && (!IsIf(schema4) || CheckIf(stack, context, schema4, value)) && (!IsNot(schema4) || CheckNot(stack, context, schema4, value)) && (!IsAllOf(schema4) || CheckAllOf(stack, context, schema4, value)) && (!IsAnyOf(schema4) || CheckAnyOf(stack, context, schema4, value)) && (!IsOneOf(schema4) || CheckOneOf(stack, context, schema4, value)) && (!IsUnevaluatedItems(schema4) || (!exports_guard.IsArray(value) || CheckUnevaluatedItems(stack, context, schema4, value))) && (!IsUnevaluatedProperties(schema4) || (!exports_guard.IsObject(value) || CheckUnevaluatedProperties(stack, context, schema4, value))) && (!IsRefine2(schema4) || CheckRefine(stack, context, schema4, value));
|
|
14534
14652
|
stack.Pop(schema4);
|
|
14535
14653
|
return result;
|
|
14536
14654
|
}
|
|
14537
14655
|
function ErrorSchema(stack, context, schemaPath, instancePath, schema4, value) {
|
|
14538
14656
|
stack.Push(schema4);
|
|
14539
|
-
const result = IsBooleanSchema(schema4) ? ErrorBooleanSchema(stack, context, schemaPath, instancePath, schema4, value) : !!(+(!IsType(schema4) || ErrorType(stack, context, schemaPath, instancePath, schema4, value)) & +(!(exports_guard.IsObject(value) && !exports_guard.IsArray(value)) || !!(+(!IsRequired(schema4) || ErrorRequired(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsAdditionalProperties(schema4) || ErrorAdditionalProperties(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsDependencies(schema4) || ErrorDependencies(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsDependentRequired(schema4) || ErrorDependentRequired(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsDependentSchemas(schema4) || ErrorDependentSchemas(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsPatternProperties(schema4) || ErrorPatternProperties(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsProperties(schema4) || ErrorProperties(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsPropertyNames(schema4) || ErrorPropertyNames(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMinProperties(schema4) || ErrorMinProperties(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMaxProperties(schema4) || ErrorMaxProperties(stack, context, schemaPath, instancePath, schema4, value)))) & +(!exports_guard.IsArray(value) || !!(+(!IsAdditionalItems(schema4) || ErrorAdditionalItems(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsContains(schema4) || ErrorContains(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsItems(schema4) || ErrorItems(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMaxContains(schema4) || ErrorMaxContains(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMaxItems(schema4) || ErrorMaxItems(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMinContains(schema4) || ErrorMinContains(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMinItems(schema4) || ErrorMinItems(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsPrefixItems(schema4) || ErrorPrefixItems(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsUniqueItems(schema4) || ErrorUniqueItems(stack, context, schemaPath, instancePath, schema4, value)))) & +(!exports_guard.IsString(value) || !!(+(!IsFormat(schema4) || ErrorFormat(stack, context, schemaPath, instancePath, schema4, value)) & +(!
|
|
14657
|
+
const result = IsBooleanSchema(schema4) ? ErrorBooleanSchema(stack, context, schemaPath, instancePath, schema4, value) : !!(+(!IsType(schema4) || ErrorType(stack, context, schemaPath, instancePath, schema4, value)) & +(!(exports_guard.IsObject(value) && !exports_guard.IsArray(value)) || !!(+(!IsRequired(schema4) || ErrorRequired(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsAdditionalProperties(schema4) || ErrorAdditionalProperties(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsDependencies(schema4) || ErrorDependencies(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsDependentRequired(schema4) || ErrorDependentRequired(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsDependentSchemas(schema4) || ErrorDependentSchemas(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsPatternProperties(schema4) || ErrorPatternProperties(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsProperties(schema4) || ErrorProperties(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsPropertyNames(schema4) || ErrorPropertyNames(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMinProperties(schema4) || ErrorMinProperties(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMaxProperties(schema4) || ErrorMaxProperties(stack, context, schemaPath, instancePath, schema4, value)))) & +(!exports_guard.IsArray(value) || !!(+(!IsAdditionalItems(schema4) || ErrorAdditionalItems(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsContains(schema4) || ErrorContains(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsItems(schema4) || ErrorItems(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMaxContains(schema4) || ErrorMaxContains(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMaxItems(schema4) || ErrorMaxItems(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMinContains(schema4) || ErrorMinContains(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMinItems(schema4) || ErrorMinItems(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsPrefixItems(schema4) || ErrorPrefixItems(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsUniqueItems(schema4) || ErrorUniqueItems(stack, context, schemaPath, instancePath, schema4, value)))) & +(!exports_guard.IsString(value) || !!(+(!IsFormat(schema4) || ErrorFormat(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMaxLength4(schema4) || ErrorMaxLength(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMinLength4(schema4) || ErrorMinLength(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsPattern(schema4) || ErrorPattern(stack, context, schemaPath, instancePath, schema4, value)))) & +(!(exports_guard.IsNumber(value) || exports_guard.IsBigInt(value)) || !!(+(!IsExclusiveMaximum(schema4) || ErrorExclusiveMaximum(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsExclusiveMinimum(schema4) || ErrorExclusiveMinimum(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMaximum(schema4) || ErrorMaximum(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMinimum(schema4) || ErrorMinimum(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsMultipleOf2(schema4) || ErrorMultipleOf(stack, context, schemaPath, instancePath, schema4, value)))) & +(!IsRecursiveRef(schema4) || ErrorRecursiveRef(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsRef2(schema4) || ErrorRef(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsGuard2(schema4) || ErrorGuard(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsConst(schema4) || ErrorConst(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsEnum2(schema4) || ErrorEnum(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsIf(schema4) || ErrorIf(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsNot(schema4) || ErrorNot(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsAllOf(schema4) || ErrorAllOf(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsAnyOf(schema4) || ErrorAnyOf(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsOneOf(schema4) || ErrorOneOf(stack, context, schemaPath, instancePath, schema4, value)) & +(!IsUnevaluatedItems(schema4) || (!exports_guard.IsArray(value) || ErrorUnevaluatedItems(stack, context, schemaPath, instancePath, schema4, value))) & +(!IsUnevaluatedProperties(schema4) || (!exports_guard.IsObject(value) || ErrorUnevaluatedProperties(stack, context, schemaPath, instancePath, schema4, value)))) && (!IsRefine2(schema4) || ErrorRefine(stack, context, schemaPath, instancePath, schema4, value));
|
|
14540
14658
|
stack.Pop(schema4);
|
|
14541
14659
|
return result;
|
|
14542
14660
|
}
|
|
@@ -15974,7 +16092,7 @@ function FromString9(context, type3) {
|
|
|
15974
16092
|
const needsDefault = (IsPattern(type3) || IsFormat(type3)) && !IsDefault(type3);
|
|
15975
16093
|
if (needsDefault)
|
|
15976
16094
|
throw Error("Strings with format or pattern constraints must specify default");
|
|
15977
|
-
const minLength3 =
|
|
16095
|
+
const minLength3 = IsMinLength4(type3) ? type3.minLength : 0;
|
|
15978
16096
|
return "".padEnd(minLength3);
|
|
15979
16097
|
}
|
|
15980
16098
|
|
|
@@ -16145,6 +16263,10 @@ function Compile(...args) {
|
|
|
16145
16263
|
});
|
|
16146
16264
|
return new Validator(context, type3);
|
|
16147
16265
|
}
|
|
16266
|
+
// src/utilities/create-rule.ts
|
|
16267
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
16268
|
+
var createRule = ESLintUtils.RuleCreator((name) => `https://github.com/howmanysmall/eslint-cease-nonsense-rules/blob/main/docs/rules/${name}.md`);
|
|
16269
|
+
|
|
16148
16270
|
// src/rules/ban-instances.ts
|
|
16149
16271
|
var isArrayConfig = Compile(build_default.Array(build_default.String()));
|
|
16150
16272
|
var isObjectConfig = Compile(build_default.Record(build_default.String(), build_default.String()));
|
|
@@ -16170,11 +16292,7 @@ function normalizeConfig(options3) {
|
|
|
16170
16292
|
}
|
|
16171
16293
|
return { bannedClasses };
|
|
16172
16294
|
}
|
|
16173
|
-
var
|
|
16174
|
-
description: "Ban specified Roblox Instance classes in new Instance() calls and JSX elements.",
|
|
16175
|
-
recommended: false
|
|
16176
|
-
};
|
|
16177
|
-
var banInstances = {
|
|
16295
|
+
var ban_instances_default = createRule({
|
|
16178
16296
|
create(context) {
|
|
16179
16297
|
const config = normalizeConfig(context.options[0]);
|
|
16180
16298
|
if (config.bannedClasses.size === 0)
|
|
@@ -16228,9 +16346,11 @@ var banInstances = {
|
|
|
16228
16346
|
},
|
|
16229
16347
|
defaultOptions: [{ bannedInstances: [] }],
|
|
16230
16348
|
meta: {
|
|
16231
|
-
docs
|
|
16349
|
+
docs: {
|
|
16350
|
+
description: "Ban specified Roblox Instance classes in new Instance() calls and JSX elements."
|
|
16351
|
+
},
|
|
16232
16352
|
messages: {
|
|
16233
|
-
bannedInstance: "Instance class '{{className}}' is banned.",
|
|
16353
|
+
bannedInstance: "Instance class '{{className}}' is banned by project configuration. This class may cause performance issues, is deprecated, or has a better alternative. Check project guidelines for the recommended replacement.",
|
|
16234
16354
|
bannedInstanceCustom: "{{customMessage}}"
|
|
16235
16355
|
},
|
|
16236
16356
|
schema: [
|
|
@@ -16256,14 +16376,14 @@ var banInstances = {
|
|
|
16256
16376
|
}
|
|
16257
16377
|
],
|
|
16258
16378
|
type: "problem"
|
|
16259
|
-
}
|
|
16260
|
-
|
|
16261
|
-
|
|
16379
|
+
},
|
|
16380
|
+
name: "ban-instances"
|
|
16381
|
+
});
|
|
16262
16382
|
|
|
16263
16383
|
// src/rules/ban-react-fc.ts
|
|
16264
16384
|
import { TSESTree as TSESTree2 } from "@typescript-eslint/types";
|
|
16265
16385
|
var BANNED_FC_NAMES = new Set(["FC", "FunctionComponent", "VFC", "VoidFunctionComponent"]);
|
|
16266
|
-
var
|
|
16386
|
+
var ban_react_fc_default = createRule({
|
|
16267
16387
|
create(context) {
|
|
16268
16388
|
return {
|
|
16269
16389
|
VariableDeclarator(node) {
|
|
@@ -16292,21 +16412,20 @@ var banReactFC = {
|
|
|
16292
16412
|
defaultOptions: [],
|
|
16293
16413
|
meta: {
|
|
16294
16414
|
docs: {
|
|
16295
|
-
description: "Ban React.FC and similar component type annotations. Use explicit function declarations instead."
|
|
16296
|
-
recommended: true
|
|
16415
|
+
description: "Ban React.FC and similar component type annotations. Use explicit function declarations instead."
|
|
16297
16416
|
},
|
|
16298
16417
|
messages: {
|
|
16299
16418
|
banReactFC: "Avoid React.FC/FunctionComponent/VFC/VoidFunctionComponent types. They break debug information and profiling. Use explicit function declarations instead: `function Component(props: Props) { ... }`"
|
|
16300
16419
|
},
|
|
16301
16420
|
schema: [],
|
|
16302
16421
|
type: "problem"
|
|
16303
|
-
}
|
|
16304
|
-
|
|
16305
|
-
|
|
16422
|
+
},
|
|
16423
|
+
name: "ban-react-fc"
|
|
16424
|
+
});
|
|
16306
16425
|
|
|
16307
16426
|
// src/rules/enforce-ianitor-check-type.ts
|
|
16308
16427
|
import { TSESTree as TSESTree3 } from "@typescript-eslint/types";
|
|
16309
|
-
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
16428
|
+
import { ESLintUtils as ESLintUtils2 } from "@typescript-eslint/utils";
|
|
16310
16429
|
var DEFAULT_CONFIGURATION = {
|
|
16311
16430
|
baseThreshold: 10,
|
|
16312
16431
|
errorThreshold: 25,
|
|
@@ -16383,8 +16502,8 @@ function calculateIanitorComplexity(node) {
|
|
|
16383
16502
|
return 1;
|
|
16384
16503
|
}
|
|
16385
16504
|
}
|
|
16386
|
-
var
|
|
16387
|
-
var enforceIanitorCheckType =
|
|
16505
|
+
var createRule2 = ESLintUtils2.RuleCreator((name) => `https://github.com/howmanysmall/eslint-cease-nonsense-rules/blob/main/docs/rules/${name}.md`);
|
|
16506
|
+
var enforceIanitorCheckType = createRule2({
|
|
16388
16507
|
create(context) {
|
|
16389
16508
|
const [rawOptions] = context.options;
|
|
16390
16509
|
const config = { ...DEFAULT_CONFIGURATION, ...rawOptions };
|
|
@@ -17560,7 +17679,7 @@ function reportViolation(context, violation) {
|
|
|
17560
17679
|
node: violation.node
|
|
17561
17680
|
});
|
|
17562
17681
|
}
|
|
17563
|
-
var
|
|
17682
|
+
var no_async_constructor_default = createRule({
|
|
17564
17683
|
create(context) {
|
|
17565
17684
|
return {
|
|
17566
17685
|
"MethodDefinition[kind='constructor']"(node) {
|
|
@@ -17583,8 +17702,7 @@ var noAsyncConstructor = {
|
|
|
17583
17702
|
defaultOptions: [],
|
|
17584
17703
|
meta: {
|
|
17585
17704
|
docs: {
|
|
17586
|
-
description: "Disallow asynchronous operations inside class constructors. Constructors return immediately, " + "so async work causes race conditions, unhandled rejections, and incomplete object states."
|
|
17587
|
-
recommended: true
|
|
17705
|
+
description: "Disallow asynchronous operations inside class constructors. Constructors return immediately, " + "so async work causes race conditions, unhandled rejections, and incomplete object states."
|
|
17588
17706
|
},
|
|
17589
17707
|
messages: {
|
|
17590
17708
|
asyncIifeInConstructor: "Refactor this asynchronous operation outside of the constructor. " + "Async IIFEs create unhandled promises and incomplete object state.",
|
|
@@ -17595,9 +17713,9 @@ var noAsyncConstructor = {
|
|
|
17595
17713
|
},
|
|
17596
17714
|
schema: [],
|
|
17597
17715
|
type: "problem"
|
|
17598
|
-
}
|
|
17599
|
-
|
|
17600
|
-
|
|
17716
|
+
},
|
|
17717
|
+
name: "no-async-constructor"
|
|
17718
|
+
});
|
|
17601
17719
|
|
|
17602
17720
|
// src/rules/no-color3-constructor.ts
|
|
17603
17721
|
import { TSESTree as TSESTree4 } from "@typescript-eslint/types";
|
|
@@ -17622,7 +17740,7 @@ function collectNumericComponents(parameters3) {
|
|
|
17622
17740
|
}
|
|
17623
17741
|
return { allZero, components };
|
|
17624
17742
|
}
|
|
17625
|
-
var
|
|
17743
|
+
var no_color3_constructor_default = createRule({
|
|
17626
17744
|
create(context) {
|
|
17627
17745
|
return {
|
|
17628
17746
|
NewExpression(node) {
|
|
@@ -17658,10 +17776,10 @@ var noColor3Constructor = {
|
|
|
17658
17776
|
}
|
|
17659
17777
|
};
|
|
17660
17778
|
},
|
|
17779
|
+
defaultOptions: [],
|
|
17661
17780
|
meta: {
|
|
17662
17781
|
docs: {
|
|
17663
|
-
description: "Ban new Color3(...) except new Color3() or new Color3(0, 0, 0). Use Color3.fromRGB() instead."
|
|
17664
|
-
recommended: true
|
|
17782
|
+
description: "Ban new Color3(...) except new Color3() or new Color3(0, 0, 0). Use Color3.fromRGB() instead."
|
|
17665
17783
|
},
|
|
17666
17784
|
fixable: "code",
|
|
17667
17785
|
messages: {
|
|
@@ -17670,9 +17788,9 @@ var noColor3Constructor = {
|
|
|
17670
17788
|
},
|
|
17671
17789
|
schema: [],
|
|
17672
17790
|
type: "problem"
|
|
17673
|
-
}
|
|
17674
|
-
|
|
17675
|
-
|
|
17791
|
+
},
|
|
17792
|
+
name: "no-color3-constructor"
|
|
17793
|
+
});
|
|
17676
17794
|
|
|
17677
17795
|
// src/rules/no-commented-code.ts
|
|
17678
17796
|
import path from "node:path";
|
|
@@ -18026,27 +18144,27 @@ var noCommentedCode = {
|
|
|
18026
18144
|
if (trimmedValue === "}")
|
|
18027
18145
|
continue;
|
|
18028
18146
|
const balanced = injectMissingBraces(trimmedValue);
|
|
18029
|
-
if (containsCode(balanced, context.filename))
|
|
18030
|
-
|
|
18031
|
-
|
|
18032
|
-
|
|
18033
|
-
|
|
18034
|
-
|
|
18035
|
-
|
|
18036
|
-
|
|
18037
|
-
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
|
|
18041
|
-
|
|
18042
|
-
|
|
18043
|
-
|
|
18044
|
-
|
|
18045
|
-
|
|
18147
|
+
if (!containsCode(balanced, context.filename))
|
|
18148
|
+
return;
|
|
18149
|
+
const firstComment = group.comments.at(0);
|
|
18150
|
+
const lastComment = group.comments.at(-1);
|
|
18151
|
+
if (!(firstComment && lastComment))
|
|
18152
|
+
continue;
|
|
18153
|
+
context.report({
|
|
18154
|
+
loc: {
|
|
18155
|
+
end: lastComment.loc.end,
|
|
18156
|
+
start: firstComment.loc.start
|
|
18157
|
+
},
|
|
18158
|
+
messageId: "commentedCode",
|
|
18159
|
+
suggest: [
|
|
18160
|
+
{
|
|
18161
|
+
desc: "Remove this commented out code",
|
|
18162
|
+
fix(fixer) {
|
|
18163
|
+
return fixer.removeRange([firstComment.range[0], lastComment.range[1]]);
|
|
18046
18164
|
}
|
|
18047
|
-
|
|
18048
|
-
|
|
18049
|
-
}
|
|
18165
|
+
}
|
|
18166
|
+
]
|
|
18167
|
+
});
|
|
18050
18168
|
}
|
|
18051
18169
|
}
|
|
18052
18170
|
};
|
|
@@ -18058,7 +18176,7 @@ var noCommentedCode = {
|
|
|
18058
18176
|
},
|
|
18059
18177
|
hasSuggestions: true,
|
|
18060
18178
|
messages: {
|
|
18061
|
-
commentedCode: "
|
|
18179
|
+
commentedCode: "Commented-out code creates confusion about intent and clutters the codebase. Version control preserves history, making dead code comments unnecessary. Delete the commented code entirely. If needed later, retrieve it from git history."
|
|
18062
18180
|
},
|
|
18063
18181
|
schema: [],
|
|
18064
18182
|
type: "suggestion"
|
|
@@ -18512,7 +18630,7 @@ function isLikelyBinding(context, callee, patterns2) {
|
|
|
18512
18630
|
}
|
|
18513
18631
|
return object3.type === AST_NODE_TYPES2.CallExpression && isJoinBindingsCall(object3);
|
|
18514
18632
|
}
|
|
18515
|
-
var
|
|
18633
|
+
var no_identity_map_default = createRule({
|
|
18516
18634
|
create(context) {
|
|
18517
18635
|
const [{ bindingPatterns = DEFAULT_BINDING_PATTERNS } = {}] = context.options;
|
|
18518
18636
|
return {
|
|
@@ -18570,9 +18688,9 @@ var noIdentityMap = {
|
|
|
18570
18688
|
}
|
|
18571
18689
|
],
|
|
18572
18690
|
type: "suggestion"
|
|
18573
|
-
}
|
|
18574
|
-
|
|
18575
|
-
|
|
18691
|
+
},
|
|
18692
|
+
name: "no-identity-map"
|
|
18693
|
+
});
|
|
18576
18694
|
|
|
18577
18695
|
// src/rules/no-instance-methods-without-this.ts
|
|
18578
18696
|
import { AST_NODE_TYPES as AST_NODE_TYPES3 } from "@typescript-eslint/types";
|
|
@@ -18642,7 +18760,7 @@ function methodUsesThis(node) {
|
|
|
18642
18760
|
return false;
|
|
18643
18761
|
return traverseForThis(value, new WeakSet);
|
|
18644
18762
|
}
|
|
18645
|
-
var
|
|
18763
|
+
var no_instance_methods_without_this_default = createRule({
|
|
18646
18764
|
create(context) {
|
|
18647
18765
|
const [rawOptions] = context.options;
|
|
18648
18766
|
const options3 = normalizeOptions(rawOptions);
|
|
@@ -18664,8 +18782,7 @@ var noInstanceMethodsWithoutThis = {
|
|
|
18664
18782
|
defaultOptions: [DEFAULT_OPTIONS],
|
|
18665
18783
|
meta: {
|
|
18666
18784
|
docs: {
|
|
18667
|
-
description: "Detect instance methods that do not use 'this' and suggest converting them to standalone functions for better performance in roblox-ts."
|
|
18668
|
-
recommended: true
|
|
18785
|
+
description: "Detect instance methods that do not use 'this' and suggest converting them to standalone functions for better performance in roblox-ts."
|
|
18669
18786
|
},
|
|
18670
18787
|
messages: {
|
|
18671
18788
|
noInstanceMethodWithoutThis: "Method '{{methodName}}' does not use 'this' and creates unnecessary metatable overhead in roblox-ts. Convert it to a standalone function for better performance."
|
|
@@ -18694,12 +18811,12 @@ var noInstanceMethodsWithoutThis = {
|
|
|
18694
18811
|
}
|
|
18695
18812
|
],
|
|
18696
18813
|
type: "problem"
|
|
18697
|
-
}
|
|
18698
|
-
|
|
18699
|
-
|
|
18814
|
+
},
|
|
18815
|
+
name: "no-instance-methods-without-this"
|
|
18816
|
+
});
|
|
18700
18817
|
|
|
18701
18818
|
// src/rules/no-print.ts
|
|
18702
|
-
var
|
|
18819
|
+
var no_print_default = createRule({
|
|
18703
18820
|
create(context) {
|
|
18704
18821
|
return {
|
|
18705
18822
|
'CallExpression[callee.type="Identifier"][callee.name="print"]'(node) {
|
|
@@ -18710,19 +18827,19 @@ var noPrint = {
|
|
|
18710
18827
|
}
|
|
18711
18828
|
};
|
|
18712
18829
|
},
|
|
18830
|
+
defaultOptions: [],
|
|
18713
18831
|
meta: {
|
|
18714
18832
|
docs: {
|
|
18715
|
-
description: "Ban print() function calls. Use Log instead."
|
|
18716
|
-
recommended: false
|
|
18833
|
+
description: "Ban print() function calls. Use Log instead."
|
|
18717
18834
|
},
|
|
18718
18835
|
messages: {
|
|
18719
|
-
useLog: "
|
|
18836
|
+
useLog: "print() is a raw output function lacking log levels, timestamps, and filtering. Production systems require structured logging for debugging and monitoring. Replace print(...) with something from the logging package."
|
|
18720
18837
|
},
|
|
18721
18838
|
schema: [],
|
|
18722
18839
|
type: "problem"
|
|
18723
|
-
}
|
|
18724
|
-
|
|
18725
|
-
|
|
18840
|
+
},
|
|
18841
|
+
name: "no-print"
|
|
18842
|
+
});
|
|
18726
18843
|
|
|
18727
18844
|
// src/rules/no-shorthand-names.ts
|
|
18728
18845
|
import { TSESTree as TSESTree6 } from "@typescript-eslint/types";
|
|
@@ -19012,7 +19129,7 @@ var noShorthandNames = {
|
|
|
19012
19129
|
recommended: true
|
|
19013
19130
|
},
|
|
19014
19131
|
messages: {
|
|
19015
|
-
useReplacement: "
|
|
19132
|
+
useReplacement: "'{{shorthand}}' is a shorthand abbreviation that reduces code readability. Abbreviated names force readers to mentally expand them and can mean different things in different contexts. Rename to '{{replacement}}' for clarity and self-documenting code."
|
|
19016
19133
|
},
|
|
19017
19134
|
schema: [
|
|
19018
19135
|
{
|
|
@@ -19311,11 +19428,11 @@ function isStaticExpression(context, expression, seen, options3) {
|
|
|
19311
19428
|
case AST_NODE_TYPES4.ChainExpression:
|
|
19312
19429
|
return isStaticExpression(context, unwrapped.expression, seen, options3);
|
|
19313
19430
|
case AST_NODE_TYPES4.CallExpression:
|
|
19314
|
-
return context !== undefined && isStaticCallCallee(context, unwrapped.callee, seen, options3) && unwrapped.arguments.every((
|
|
19431
|
+
return context !== undefined && isStaticCallCallee(context, unwrapped.callee, seen, options3) && unwrapped.arguments.every((argument) => argument.type !== AST_NODE_TYPES4.SpreadElement && isStaticExpression(context, argument, seen, options3));
|
|
19315
19432
|
case AST_NODE_TYPES4.NewExpression:
|
|
19316
|
-
return context !== undefined && isStaticCallCallee(context, unwrapped.callee, seen, options3) && (unwrapped.arguments ?? []).every((
|
|
19433
|
+
return context !== undefined && isStaticCallCallee(context, unwrapped.callee, seen, options3) && (unwrapped.arguments ?? []).every((argument) => argument.type !== AST_NODE_TYPES4.SpreadElement && isStaticExpression(context, argument, seen, options3));
|
|
19317
19434
|
case AST_NODE_TYPES4.SequenceExpression:
|
|
19318
|
-
return unwrapped.expressions.length > 0 && unwrapped.expressions.every((
|
|
19435
|
+
return unwrapped.expressions.length > 0 && unwrapped.expressions.every((expression2) => isStaticExpression(context, expression2, seen, options3));
|
|
19319
19436
|
case AST_NODE_TYPES4.AssignmentExpression:
|
|
19320
19437
|
return isStaticExpression(context, unwrapped.right, seen, options3);
|
|
19321
19438
|
default:
|
|
@@ -19354,7 +19471,7 @@ function isSpringHookCall(node, options3) {
|
|
|
19354
19471
|
}
|
|
19355
19472
|
return false;
|
|
19356
19473
|
}
|
|
19357
|
-
var
|
|
19474
|
+
var no_useless_use_spring_default = createRule({
|
|
19358
19475
|
create(context) {
|
|
19359
19476
|
const [rawOptions] = context.options;
|
|
19360
19477
|
const normalized = {
|
|
@@ -19422,12 +19539,12 @@ var noUselessUseSpring = {
|
|
|
19422
19539
|
}
|
|
19423
19540
|
],
|
|
19424
19541
|
type: "suggestion"
|
|
19425
|
-
}
|
|
19426
|
-
|
|
19427
|
-
|
|
19542
|
+
},
|
|
19543
|
+
name: "no-useless-use-spring"
|
|
19544
|
+
});
|
|
19428
19545
|
|
|
19429
19546
|
// src/rules/no-warn.ts
|
|
19430
|
-
var
|
|
19547
|
+
var no_warn_default = createRule({
|
|
19431
19548
|
create(context) {
|
|
19432
19549
|
return {
|
|
19433
19550
|
'CallExpression[callee.type="Identifier"][callee.name="warn"]'(node) {
|
|
@@ -19438,19 +19555,19 @@ var noWarn = {
|
|
|
19438
19555
|
}
|
|
19439
19556
|
};
|
|
19440
19557
|
},
|
|
19558
|
+
defaultOptions: [],
|
|
19441
19559
|
meta: {
|
|
19442
19560
|
docs: {
|
|
19443
|
-
description: "Ban warn() function calls. Use Log instead."
|
|
19444
|
-
recommended: false
|
|
19561
|
+
description: "Ban warn() function calls. Use Log instead."
|
|
19445
19562
|
},
|
|
19446
19563
|
messages: {
|
|
19447
|
-
useLog: "
|
|
19564
|
+
useLog: "warn() is a raw output function lacking log levels, timestamps, and filtering. Production systems require structured logging for debugging and monitoring. Replace warn(...) with something from the logging package."
|
|
19448
19565
|
},
|
|
19449
19566
|
schema: [],
|
|
19450
19567
|
type: "problem"
|
|
19451
|
-
}
|
|
19452
|
-
|
|
19453
|
-
|
|
19568
|
+
},
|
|
19569
|
+
name: "no-warn"
|
|
19570
|
+
});
|
|
19454
19571
|
|
|
19455
19572
|
// src/rules/prefer-class-properties.ts
|
|
19456
19573
|
import { AST_NODE_TYPES as AST_NODE_TYPES5 } from "@typescript-eslint/utils";
|
|
@@ -19496,7 +19613,7 @@ function isStaticMemberExpression(node) {
|
|
|
19496
19613
|
function isConstructor(node) {
|
|
19497
19614
|
return node.type === AST_NODE_TYPES5.MethodDefinition && node.kind === "constructor" && node.key.type === AST_NODE_TYPES5.Identifier && node.key.name === "constructor";
|
|
19498
19615
|
}
|
|
19499
|
-
var
|
|
19616
|
+
var prefer_class_properties_default = createRule({
|
|
19500
19617
|
create(context) {
|
|
19501
19618
|
const option = context.options[0] ?? "always";
|
|
19502
19619
|
if (option === "never") {
|
|
@@ -19553,14 +19670,14 @@ var preferClassProperties = {
|
|
|
19553
19670
|
description: "Prefer class properties to assignment of literals in constructors."
|
|
19554
19671
|
},
|
|
19555
19672
|
messages: {
|
|
19556
|
-
unexpectedAssignment: "
|
|
19557
|
-
unexpectedClassProperty: "
|
|
19673
|
+
unexpectedAssignment: "Constructor assigns a literal value to this.property. Literals are static and known at class definition time. Move to a class property declaration: propertyName = value; at class level. This clarifies intent and reduces constructor complexity.",
|
|
19674
|
+
unexpectedClassProperty: "Class property declarations are disabled by rule configuration (mode: 'never'). Move initialization into the constructor: this.propertyName = value; inside constructor()."
|
|
19558
19675
|
},
|
|
19559
19676
|
schema: [{ enum: ["always", "never"], type: "string" }],
|
|
19560
19677
|
type: "suggestion"
|
|
19561
|
-
}
|
|
19562
|
-
|
|
19563
|
-
|
|
19678
|
+
},
|
|
19679
|
+
name: "prefer-class-properties"
|
|
19680
|
+
});
|
|
19564
19681
|
|
|
19565
19682
|
// src/rules/prefer-early-return.ts
|
|
19566
19683
|
import { AST_NODE_TYPES as AST_NODE_TYPES6 } from "@typescript-eslint/utils";
|
|
@@ -19580,7 +19697,7 @@ function canSimplifyConditionalBody(body, maxStatements) {
|
|
|
19580
19697
|
}
|
|
19581
19698
|
return isOffendingConsequent(statement.consequent, maxStatements);
|
|
19582
19699
|
}
|
|
19583
|
-
var
|
|
19700
|
+
var prefer_early_return_default = createRule({
|
|
19584
19701
|
create(context) {
|
|
19585
19702
|
const options3 = context.options[0] ?? {};
|
|
19586
19703
|
const maxStatements = options3.maximumStatements ?? DEFAULT_MAXIMUM_STATEMENTS;
|
|
@@ -19605,7 +19722,7 @@ var preferEarlyReturn = {
|
|
|
19605
19722
|
description: "Prefer early returns over full-body conditional wrapping in function declarations."
|
|
19606
19723
|
},
|
|
19607
19724
|
messages: {
|
|
19608
|
-
preferEarlyReturn: "
|
|
19725
|
+
preferEarlyReturn: "Function body is wrapped in a single conditional without an else branch. This increases nesting depth and cognitive load. Invert the condition and return early: if (!condition) return; then place the main logic at the top level."
|
|
19609
19726
|
},
|
|
19610
19727
|
schema: [
|
|
19611
19728
|
{
|
|
@@ -19617,9 +19734,9 @@ var preferEarlyReturn = {
|
|
|
19617
19734
|
}
|
|
19618
19735
|
],
|
|
19619
19736
|
type: "suggestion"
|
|
19620
|
-
}
|
|
19621
|
-
|
|
19622
|
-
|
|
19737
|
+
},
|
|
19738
|
+
name: "prefer-early-return"
|
|
19739
|
+
});
|
|
19623
19740
|
|
|
19624
19741
|
// src/rules/prefer-module-scope-constants.ts
|
|
19625
19742
|
var import_scope_manager3 = __toESM(require_dist2(), 1);
|
|
@@ -19636,7 +19753,7 @@ function isTopScope(scope) {
|
|
|
19636
19753
|
}
|
|
19637
19754
|
return false;
|
|
19638
19755
|
}
|
|
19639
|
-
var
|
|
19756
|
+
var prefer_module_scope_constants_default = createRule({
|
|
19640
19757
|
create(context) {
|
|
19641
19758
|
let inConstDeclaration = false;
|
|
19642
19759
|
return {
|
|
@@ -19678,9 +19795,9 @@ var preferModuleScopeConstants = {
|
|
|
19678
19795
|
},
|
|
19679
19796
|
schema: [],
|
|
19680
19797
|
type: "suggestion"
|
|
19681
|
-
}
|
|
19682
|
-
|
|
19683
|
-
|
|
19798
|
+
},
|
|
19799
|
+
name: "prefer-module-scope-constants"
|
|
19800
|
+
});
|
|
19684
19801
|
|
|
19685
19802
|
// src/rules/prefer-pascal-case-enums.ts
|
|
19686
19803
|
import { AST_NODE_TYPES as AST_NODE_TYPES8 } from "@typescript-eslint/utils";
|
|
@@ -19729,7 +19846,7 @@ function getIdentifierName(node) {
|
|
|
19729
19846
|
return;
|
|
19730
19847
|
return STARTS_WITH_DIGIT.test(node.value) ? undefined : node.value;
|
|
19731
19848
|
}
|
|
19732
|
-
var
|
|
19849
|
+
var prefer_pascal_case_enums_default = createRule({
|
|
19733
19850
|
create(context) {
|
|
19734
19851
|
function report(node, identifier3) {
|
|
19735
19852
|
context.report({
|
|
@@ -19759,13 +19876,13 @@ var preferPascalCaseEnums = {
|
|
|
19759
19876
|
description: "Enforce Pascal case when naming enums."
|
|
19760
19877
|
},
|
|
19761
19878
|
messages: {
|
|
19762
|
-
notPascalCase: "Enum '{{ identifier }}'
|
|
19879
|
+
notPascalCase: "Enum '{{ identifier }}' uses non-standard casing. TypeScript convention requires PascalCase for enum names and members to distinguish them from variables (camelCase) and constants (UPPER_CASE). Rename to PascalCase: capitalize first letter of each word, no underscores."
|
|
19763
19880
|
},
|
|
19764
19881
|
schema: [],
|
|
19765
19882
|
type: "suggestion"
|
|
19766
|
-
}
|
|
19767
|
-
|
|
19768
|
-
|
|
19883
|
+
},
|
|
19884
|
+
name: "prefer-pascal-case-enums"
|
|
19885
|
+
});
|
|
19769
19886
|
|
|
19770
19887
|
// src/utilities/pattern-replacement/pattern-matcher.ts
|
|
19771
19888
|
import { AST_NODE_TYPES as AST_NODE_TYPES10 } from "@typescript-eslint/types";
|
|
@@ -20091,7 +20208,7 @@ var isRuleOptions2 = Compile(build_default.Object({
|
|
|
20091
20208
|
function parsePatterns(patterns2) {
|
|
20092
20209
|
return patterns2.map((pattern5) => parsePattern(pattern5.match, pattern5.replacement, pattern5.when));
|
|
20093
20210
|
}
|
|
20094
|
-
var
|
|
20211
|
+
var prefer_pattern_replacements_default = createRule({
|
|
20095
20212
|
create(context) {
|
|
20096
20213
|
const validatedOptions = isRuleOptions2.Check(context.options[0]) ? context.options[0] : undefined;
|
|
20097
20214
|
if (!validatedOptions || validatedOptions.patterns.length === 0)
|
|
@@ -20116,14 +20233,20 @@ var preferPatternReplacements = {
|
|
|
20116
20233
|
const candidates2 = patternIndex.get(key);
|
|
20117
20234
|
if (!candidates2 || candidates2.length === 0)
|
|
20118
20235
|
return;
|
|
20236
|
+
const skippedConflicts = [];
|
|
20119
20237
|
for (const pattern5 of candidates2) {
|
|
20120
20238
|
const captures = matchParameters(pattern5.parameters, node.arguments, sourceCode);
|
|
20121
20239
|
if (!(captures && evaluateConditions(pattern5.conditions, captures) && canSafelySubstitute(captures))) {
|
|
20122
20240
|
continue;
|
|
20123
20241
|
}
|
|
20124
20242
|
const replacementId = getReplacementIdentifier(pattern5.replacement);
|
|
20125
|
-
if (replacementId && hasNameConflict(node, replacementId))
|
|
20243
|
+
if (replacementId && hasNameConflict(node, replacementId)) {
|
|
20244
|
+
skippedConflicts.push({
|
|
20245
|
+
conflict: replacementId,
|
|
20246
|
+
replacement: generateReplacement(pattern5.replacement, captures)
|
|
20247
|
+
});
|
|
20126
20248
|
continue;
|
|
20249
|
+
}
|
|
20127
20250
|
const originalText = sourceCode.getText(node);
|
|
20128
20251
|
const replacementText = generateReplacement(pattern5.replacement, captures);
|
|
20129
20252
|
context.report({
|
|
@@ -20132,8 +20255,22 @@ var preferPatternReplacements = {
|
|
|
20132
20255
|
messageId: "preferReplacement",
|
|
20133
20256
|
node
|
|
20134
20257
|
});
|
|
20258
|
+
for (const { replacement, conflict } of skippedConflicts) {
|
|
20259
|
+
context.report({
|
|
20260
|
+
data: { conflict, replacement },
|
|
20261
|
+
messageId: "skippedDueToConflict",
|
|
20262
|
+
node
|
|
20263
|
+
});
|
|
20264
|
+
}
|
|
20135
20265
|
return;
|
|
20136
20266
|
}
|
|
20267
|
+
for (const { replacement, conflict } of skippedConflicts) {
|
|
20268
|
+
context.report({
|
|
20269
|
+
data: { conflict, replacement },
|
|
20270
|
+
messageId: "skippedDueToConflict",
|
|
20271
|
+
node
|
|
20272
|
+
});
|
|
20273
|
+
}
|
|
20137
20274
|
}
|
|
20138
20275
|
return {
|
|
20139
20276
|
CallExpression: checkNode,
|
|
@@ -20143,12 +20280,12 @@ var preferPatternReplacements = {
|
|
|
20143
20280
|
defaultOptions: [{ patterns: [] }],
|
|
20144
20281
|
meta: {
|
|
20145
20282
|
docs: {
|
|
20146
|
-
description: "Enforce using configured replacements for common constructor/method patterns"
|
|
20147
|
-
recommended: false
|
|
20283
|
+
description: "Enforce using configured replacements for common constructor/method patterns"
|
|
20148
20284
|
},
|
|
20149
20285
|
fixable: "code",
|
|
20150
20286
|
messages: {
|
|
20151
|
-
preferReplacement: "Prefer '{{replacement}}' over '{{original}}'"
|
|
20287
|
+
preferReplacement: "Prefer '{{replacement}}' over '{{original}}'",
|
|
20288
|
+
skippedDueToConflict: "Pattern '{{replacement}}' was skipped because '{{conflict}}' is already in scope."
|
|
20152
20289
|
},
|
|
20153
20290
|
schema: [
|
|
20154
20291
|
{
|
|
@@ -20163,9 +20300,9 @@ var preferPatternReplacements = {
|
|
|
20163
20300
|
}
|
|
20164
20301
|
],
|
|
20165
20302
|
type: "suggestion"
|
|
20166
|
-
}
|
|
20167
|
-
|
|
20168
|
-
|
|
20303
|
+
},
|
|
20304
|
+
name: "prefer-pattern-replacements"
|
|
20305
|
+
});
|
|
20169
20306
|
|
|
20170
20307
|
// src/rules/prefer-sequence-overloads.ts
|
|
20171
20308
|
import { AST_NODE_TYPES as AST_NODE_TYPES11 } from "@typescript-eslint/types";
|
|
@@ -20211,11 +20348,7 @@ function extractKeypoint(element, descriptor) {
|
|
|
20211
20348
|
value: valueArgument
|
|
20212
20349
|
};
|
|
20213
20350
|
}
|
|
20214
|
-
var
|
|
20215
|
-
description: "Prefer the optimized ColorSequence and NumberSequence constructor overloads over passing ColorSequenceKeypoint or NumberSequenceKeypoint arrays when only using endpoints 0 and 1.",
|
|
20216
|
-
recommended: true
|
|
20217
|
-
};
|
|
20218
|
-
var preferSequenceOverloads = {
|
|
20351
|
+
var prefer_sequence_overloads_default = createRule({
|
|
20219
20352
|
create(context) {
|
|
20220
20353
|
const { sourceCode } = context;
|
|
20221
20354
|
return {
|
|
@@ -20261,7 +20394,9 @@ var preferSequenceOverloads = {
|
|
|
20261
20394
|
},
|
|
20262
20395
|
defaultOptions: [],
|
|
20263
20396
|
meta: {
|
|
20264
|
-
docs:
|
|
20397
|
+
docs: {
|
|
20398
|
+
description: "Prefer using single or two-point overloads for Roblox Sequence methods instead of all three overloads."
|
|
20399
|
+
},
|
|
20265
20400
|
fixable: "code",
|
|
20266
20401
|
messages: {
|
|
20267
20402
|
preferSingleOverload: "Use the single-argument {{sequenceName}} constructor overload instead of redundant keypoints when both endpoints share the same value.",
|
|
@@ -20269,9 +20404,9 @@ var preferSequenceOverloads = {
|
|
|
20269
20404
|
},
|
|
20270
20405
|
schema: [],
|
|
20271
20406
|
type: "problem"
|
|
20272
|
-
}
|
|
20273
|
-
|
|
20274
|
-
|
|
20407
|
+
},
|
|
20408
|
+
name: "prefer-sequence-overloads"
|
|
20409
|
+
});
|
|
20275
20410
|
|
|
20276
20411
|
// src/rules/prefer-singular-enums.ts
|
|
20277
20412
|
var IRREGULAR_PLURALS = new Set([
|
|
@@ -20385,7 +20520,7 @@ function isPlural(name) {
|
|
|
20385
20520
|
const last = getLastAlphaToken(name);
|
|
20386
20521
|
return last ? isPluralWord(last.lower, last.original) : false;
|
|
20387
20522
|
}
|
|
20388
|
-
var
|
|
20523
|
+
var prefer_singular_enums_default = createRule({
|
|
20389
20524
|
create(context) {
|
|
20390
20525
|
return {
|
|
20391
20526
|
TSEnumDeclaration(node) {
|
|
@@ -20406,13 +20541,13 @@ var preferSingularEnums = {
|
|
|
20406
20541
|
description: "Prefer singular TypeScript enums."
|
|
20407
20542
|
},
|
|
20408
20543
|
messages: {
|
|
20409
|
-
notSingular: "Enum '{{ name }}'
|
|
20544
|
+
notSingular: "Enum '{{ name }}' uses plural naming. Enums define a type of which only ONE value is selected at a time, so singular naming is semantically correct. Use 'Status' not 'Statuses', 'Color' not 'Colors'. Rename the enum to its singular form."
|
|
20410
20545
|
},
|
|
20411
20546
|
schema: [],
|
|
20412
20547
|
type: "suggestion"
|
|
20413
|
-
}
|
|
20414
|
-
|
|
20415
|
-
|
|
20548
|
+
},
|
|
20549
|
+
name: "prefer-singular-enums"
|
|
20550
|
+
});
|
|
20416
20551
|
|
|
20417
20552
|
// src/rules/prefer-udim2-shorthand.ts
|
|
20418
20553
|
import { TSESTree as TSESTree7 } from "@typescript-eslint/utils";
|
|
@@ -20654,7 +20789,7 @@ function exceedsMaxReturnProperties(node, scope) {
|
|
|
20654
20789
|
}
|
|
20655
20790
|
return countReturnElements(argument, scope) > MAX_RETURN_ELEMENTS;
|
|
20656
20791
|
}
|
|
20657
|
-
var
|
|
20792
|
+
var react_hooks_strict_return_default = createRule({
|
|
20658
20793
|
create(context) {
|
|
20659
20794
|
let hookDepth = 0;
|
|
20660
20795
|
function enterHook(node) {
|
|
@@ -20703,13 +20838,13 @@ var reactHooksStrictReturn = {
|
|
|
20703
20838
|
description: "Restrict the number of returned items from React hooks."
|
|
20704
20839
|
},
|
|
20705
20840
|
messages: {
|
|
20706
|
-
hooksStrictReturn: "
|
|
20841
|
+
hooksStrictReturn: "Hook returns more than 2 tuple elements. Destructuring large tuples causes positional errors and breaks when adding values. Return an object with named properties instead: `return { value, setValue, isLoading };`"
|
|
20707
20842
|
},
|
|
20708
20843
|
schema: [],
|
|
20709
20844
|
type: "suggestion"
|
|
20710
|
-
}
|
|
20711
|
-
|
|
20712
|
-
|
|
20845
|
+
},
|
|
20846
|
+
name: "react-hooks-strict-return"
|
|
20847
|
+
});
|
|
20713
20848
|
|
|
20714
20849
|
// src/rules/require-named-effect-functions.ts
|
|
20715
20850
|
import { TSESTree as TSESTree8 } from "@typescript-eslint/types";
|
|
@@ -20955,8 +21090,7 @@ var requireNamedEffectFunctions = {
|
|
|
20955
21090
|
return;
|
|
20956
21091
|
}
|
|
20957
21092
|
if (argumentNode.type === TSESTree8.AST_NODE_TYPES.FunctionExpression) {
|
|
20958
|
-
const
|
|
20959
|
-
const functionHasId = Boolean(functionExpressionNode.id);
|
|
21093
|
+
const functionHasId = Boolean(argumentNode.id);
|
|
20960
21094
|
if (functionHasId && argumentNode.async) {
|
|
20961
21095
|
context.report({
|
|
20962
21096
|
data: { hook: hookName },
|
|
@@ -20992,17 +21126,17 @@ var requireNamedEffectFunctions = {
|
|
|
20992
21126
|
recommended: false
|
|
20993
21127
|
},
|
|
20994
21128
|
messages: {
|
|
20995
|
-
anonymousFunction: "
|
|
20996
|
-
arrowFunction: "
|
|
20997
|
-
asyncAnonymousFunction: "Async anonymous
|
|
20998
|
-
asyncArrowFunction: "Async arrow
|
|
20999
|
-
asyncFunctionDeclaration: "Async function
|
|
21000
|
-
asyncFunctionExpression: "Async function
|
|
21001
|
-
functionExpression: "
|
|
21002
|
-
identifierReferencesArrow: "{{
|
|
21003
|
-
identifierReferencesAsyncArrow: "{{
|
|
21004
|
-
identifierReferencesAsyncFunction: "{{
|
|
21005
|
-
identifierReferencesCallback: "{{
|
|
21129
|
+
anonymousFunction: "Anonymous function passed to {{hook}}. debug.info returns empty string for anonymous functions, making stack traces useless for debugging. Extract to: function effectName() { ... } then pass effectName.",
|
|
21130
|
+
arrowFunction: "Arrow function passed to {{hook}}. Arrow functions have no debug name and create new instances each render. Extract to: function effectName() { ... } then pass effectName.",
|
|
21131
|
+
asyncAnonymousFunction: "Async anonymous function in {{hook}}. Two issues: (1) no debug name makes stack traces useless, (2) async effects require cancellation logic for unmount. Extract to: async function effectName() { ... } with cleanup.",
|
|
21132
|
+
asyncArrowFunction: "Async arrow function in {{hook}}. Two issues: (1) arrow functions have no debug name, (2) async effects require cancellation logic. Extract to: async function effectName() { ... } with cleanup.",
|
|
21133
|
+
asyncFunctionDeclaration: "Async function declaration passed to {{hook}}. Async effects require cancellation logic to handle component unmount. Implement cleanup or set allowAsync: true if cancellation is handled.",
|
|
21134
|
+
asyncFunctionExpression: "Async function expression in {{hook}}. Async effects require cancellation logic for unmount. Extract to a named async function declaration with cleanup, then pass the reference.",
|
|
21135
|
+
functionExpression: "Function expression passed to {{hook}}. Function expressions create new instances each render, breaking referential equality. Extract to: function effectName() { ... } at module or component top-level.",
|
|
21136
|
+
identifierReferencesArrow: "{{hook}} receives identifier pointing to arrow function. Arrow functions have no debug name and lack referential stability. Convert to: function effectName() { ... } then pass effectName.",
|
|
21137
|
+
identifierReferencesAsyncArrow: "{{hook}} receives identifier pointing to async arrow function. Two issues: (1) no debug name, (2) async effects require cancellation logic. Convert to: async function effectName() { ... } with cleanup.",
|
|
21138
|
+
identifierReferencesAsyncFunction: "{{hook}} receives identifier pointing to async function. Async effects require cancellation logic for unmount. Implement cleanup or set allowAsync: true if cancellation is handled.",
|
|
21139
|
+
identifierReferencesCallback: "{{hook}} receives identifier from useCallback/useMemo. These hooks return new references when dependencies change, causing unexpected effect re-runs. Use a stable function declaration: function effectName() { ... }"
|
|
21006
21140
|
},
|
|
21007
21141
|
schema: [
|
|
21008
21142
|
{
|
|
@@ -21895,40 +22029,44 @@ function ascendPastWrappers(node) {
|
|
|
21895
22029
|
return current;
|
|
21896
22030
|
}
|
|
21897
22031
|
function hasKeyAttribute(node) {
|
|
21898
|
-
for (const attribute of node.openingElement.attributes)
|
|
22032
|
+
for (const attribute of node.openingElement.attributes) {
|
|
21899
22033
|
if (attribute.type === TSESTree9.AST_NODE_TYPES.JSXAttribute && attribute.name.name === "key")
|
|
21900
22034
|
return true;
|
|
22035
|
+
}
|
|
21901
22036
|
return false;
|
|
21902
22037
|
}
|
|
21903
|
-
function
|
|
22038
|
+
function isHigherOrderComponent(callExpr) {
|
|
21904
22039
|
const { callee } = callExpr;
|
|
21905
|
-
if (callee.type === TSESTree9.AST_NODE_TYPES.Identifier)
|
|
22040
|
+
if (callee.type === TSESTree9.AST_NODE_TYPES.Identifier) {
|
|
21906
22041
|
return callee.name === "forwardRef" || callee.name === "memo";
|
|
21907
|
-
|
|
22042
|
+
}
|
|
22043
|
+
if (callee.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.object.type === TSESTree9.AST_NODE_TYPES.Identifier && callee.object.name === "React" && callee.property.type === TSESTree9.AST_NODE_TYPES.Identifier) {
|
|
21908
22044
|
return callee.property.name === "forwardRef" || callee.property.name === "memo";
|
|
22045
|
+
}
|
|
21909
22046
|
return false;
|
|
21910
22047
|
}
|
|
21911
22048
|
function getEnclosingFunctionLike(node) {
|
|
21912
22049
|
let current = node.parent;
|
|
21913
22050
|
while (current) {
|
|
21914
|
-
if (current.type === TSESTree9.AST_NODE_TYPES.ArrowFunctionExpression || current.type === TSESTree9.AST_NODE_TYPES.FunctionExpression || current.type === TSESTree9.AST_NODE_TYPES.FunctionDeclaration)
|
|
22051
|
+
if (current.type === TSESTree9.AST_NODE_TYPES.ArrowFunctionExpression || current.type === TSESTree9.AST_NODE_TYPES.FunctionExpression || current.type === TSESTree9.AST_NODE_TYPES.FunctionDeclaration) {
|
|
21915
22052
|
return current;
|
|
22053
|
+
}
|
|
21916
22054
|
current = current.parent;
|
|
21917
22055
|
}
|
|
21918
22056
|
return;
|
|
21919
22057
|
}
|
|
21920
|
-
function isIterationOrMemoCallback(
|
|
21921
|
-
const { callee } =
|
|
22058
|
+
function isIterationOrMemoCallback(callExpression, iterationMethods, memoizationHooks) {
|
|
22059
|
+
const { callee } = callExpression;
|
|
21922
22060
|
if (callee.type === TSESTree9.AST_NODE_TYPES.Identifier && memoizationHooks.has(callee.name))
|
|
21923
22061
|
return true;
|
|
21924
22062
|
if (callee.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.property.type === TSESTree9.AST_NODE_TYPES.Identifier) {
|
|
21925
|
-
const
|
|
21926
|
-
if (iterationMethods.has(
|
|
22063
|
+
const { name } = callee.property;
|
|
22064
|
+
if (iterationMethods.has(name))
|
|
21927
22065
|
return true;
|
|
21928
|
-
if (
|
|
22066
|
+
if (name === "from" && callee.object.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.object.object.type === TSESTree9.AST_NODE_TYPES.Identifier && callee.object.object.name === "Array" && callExpression.arguments.length >= 2) {
|
|
21929
22067
|
return true;
|
|
21930
22068
|
}
|
|
21931
|
-
if (
|
|
22069
|
+
if (name === "call" && callee.object.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.object.object.type === TSESTree9.AST_NODE_TYPES.MemberExpression && callee.object.object.property.type === TSESTree9.AST_NODE_TYPES.Identifier && iterationMethods.has(callee.object.object.property.name)) {
|
|
21932
22070
|
return true;
|
|
21933
22071
|
}
|
|
21934
22072
|
}
|
|
@@ -21980,23 +22118,24 @@ function referenceActsAsCallback(reference, iterationMethods, memoizationHooks)
|
|
|
21980
22118
|
const callExpression = findEnclosingCallExpression(reference.identifier);
|
|
21981
22119
|
if (!callExpression)
|
|
21982
22120
|
return false;
|
|
21983
|
-
if (
|
|
22121
|
+
if (isHigherOrderComponent(callExpression))
|
|
21984
22122
|
return false;
|
|
21985
22123
|
return isIterationOrMemoCallback(callExpression, iterationMethods, memoizationHooks);
|
|
21986
22124
|
}
|
|
21987
22125
|
function isFunctionUsedAsCallback(context, functionLike, iterationMethods, memoizationHooks) {
|
|
21988
22126
|
const inlineCall = findEnclosingCallExpression(functionLike);
|
|
21989
22127
|
if (inlineCall) {
|
|
21990
|
-
if (
|
|
22128
|
+
if (isHigherOrderComponent(inlineCall))
|
|
21991
22129
|
return false;
|
|
21992
22130
|
return isIterationOrMemoCallback(inlineCall, iterationMethods, memoizationHooks);
|
|
21993
22131
|
}
|
|
21994
22132
|
const variable = getVariableForFunction(context, functionLike);
|
|
21995
22133
|
if (!variable)
|
|
21996
22134
|
return false;
|
|
21997
|
-
for (const reference of variable.references)
|
|
22135
|
+
for (const reference of variable.references) {
|
|
21998
22136
|
if (referenceActsAsCallback(reference, iterationMethods, memoizationHooks))
|
|
21999
22137
|
return true;
|
|
22138
|
+
}
|
|
22000
22139
|
return false;
|
|
22001
22140
|
}
|
|
22002
22141
|
var SHOULD_ASCEND_TYPES = new Set([
|
|
@@ -22048,7 +22187,7 @@ function isTopLevelReturn(node) {
|
|
|
22048
22187
|
if (IS_FUNCTION_EXPRESSION.has(currentNode.type)) {
|
|
22049
22188
|
const functionParent = ascendPastWrappers(currentNode.parent);
|
|
22050
22189
|
if (functionParent?.type === TSESTree9.AST_NODE_TYPES.CallExpression) {
|
|
22051
|
-
return
|
|
22190
|
+
return isHigherOrderComponent(functionParent);
|
|
22052
22191
|
}
|
|
22053
22192
|
return true;
|
|
22054
22193
|
}
|
|
@@ -22056,8 +22195,9 @@ function isTopLevelReturn(node) {
|
|
|
22056
22195
|
}
|
|
22057
22196
|
if (parent.type === TSESTree9.AST_NODE_TYPES.ArrowFunctionExpression) {
|
|
22058
22197
|
const functionParent = ascendPastWrappers(parent.parent);
|
|
22059
|
-
if (functionParent?.type === TSESTree9.AST_NODE_TYPES.CallExpression)
|
|
22060
|
-
return
|
|
22198
|
+
if (functionParent?.type === TSESTree9.AST_NODE_TYPES.CallExpression) {
|
|
22199
|
+
return isHigherOrderComponent(functionParent);
|
|
22200
|
+
}
|
|
22061
22201
|
return true;
|
|
22062
22202
|
}
|
|
22063
22203
|
return false;
|
|
@@ -22122,11 +22262,7 @@ function isTernaryJSXChild(node) {
|
|
|
22122
22262
|
return false;
|
|
22123
22263
|
return containerParent.type === TSESTree9.AST_NODE_TYPES.JSXElement || containerParent.type === TSESTree9.AST_NODE_TYPES.JSXFragment;
|
|
22124
22264
|
}
|
|
22125
|
-
var
|
|
22126
|
-
description: "Enforce key props on all React elements except top-level returns",
|
|
22127
|
-
recommended: true
|
|
22128
|
-
};
|
|
22129
|
-
var requireReactComponentKeys = {
|
|
22265
|
+
var require_react_component_keys_default = createRule({
|
|
22130
22266
|
create(context) {
|
|
22131
22267
|
const options3 = {
|
|
22132
22268
|
...DEFAULT_OPTIONS3,
|
|
@@ -22178,10 +22314,12 @@ var requireReactComponentKeys = {
|
|
|
22178
22314
|
},
|
|
22179
22315
|
defaultOptions: [DEFAULT_OPTIONS3],
|
|
22180
22316
|
meta: {
|
|
22181
|
-
docs:
|
|
22317
|
+
docs: {
|
|
22318
|
+
description: "Require keys on React components when used in lists or iteration."
|
|
22319
|
+
},
|
|
22182
22320
|
messages: {
|
|
22183
|
-
missingKey: "
|
|
22184
|
-
rootComponentWithKey: "Root
|
|
22321
|
+
missingKey: "JSX element in list/callback lacks key prop. React Luau warns about missing keys in _G.__DEV__ mode. Add a unique `key` prop using a stable identifier (not array index).",
|
|
22322
|
+
rootComponentWithKey: "Root return has unnecessary key prop. The key gets overwritten by the parent anyway. Remove the `key` prop."
|
|
22185
22323
|
},
|
|
22186
22324
|
schema: [
|
|
22187
22325
|
{
|
|
@@ -22226,9 +22364,220 @@ var requireReactComponentKeys = {
|
|
|
22226
22364
|
}
|
|
22227
22365
|
],
|
|
22228
22366
|
type: "problem"
|
|
22229
|
-
}
|
|
22367
|
+
},
|
|
22368
|
+
name: "require-react-component-keys"
|
|
22369
|
+
});
|
|
22370
|
+
|
|
22371
|
+
// src/rules/require-react-display-names.ts
|
|
22372
|
+
import { TSESTree as TSESTree10 } from "@typescript-eslint/types";
|
|
22373
|
+
var DEFAULT_OPTIONS4 = {
|
|
22374
|
+
environment: "roblox-ts"
|
|
22230
22375
|
};
|
|
22231
|
-
var
|
|
22376
|
+
var REACT_SOURCES_ROBLOX = new Set(["@rbxts/react", "@rbxts/roact"]);
|
|
22377
|
+
var REACT_SOURCES_STANDARD = new Set(["react", "react-dom"]);
|
|
22378
|
+
function getReactSources(environment2) {
|
|
22379
|
+
return environment2 === "roblox-ts" ? REACT_SOURCES_ROBLOX : REACT_SOURCES_STANDARD;
|
|
22380
|
+
}
|
|
22381
|
+
function isReactImport(node, reactSources) {
|
|
22382
|
+
return reactSources.has(node.source.value);
|
|
22383
|
+
}
|
|
22384
|
+
function isMemoCall(node, memoIdentifiers, reactNamespaces) {
|
|
22385
|
+
const { callee } = node;
|
|
22386
|
+
if (callee.type === TSESTree10.AST_NODE_TYPES.Identifier)
|
|
22387
|
+
return memoIdentifiers.has(callee.name);
|
|
22388
|
+
if (callee.type === TSESTree10.AST_NODE_TYPES.MemberExpression && callee.object.type === TSESTree10.AST_NODE_TYPES.Identifier && callee.property.type === TSESTree10.AST_NODE_TYPES.Identifier) {
|
|
22389
|
+
return reactNamespaces.has(callee.object.name) && callee.property.name === "memo";
|
|
22390
|
+
}
|
|
22391
|
+
return false;
|
|
22392
|
+
}
|
|
22393
|
+
function isCreateContextCall(node, createContextIdentifiers, reactNamespaces) {
|
|
22394
|
+
const { callee } = node;
|
|
22395
|
+
if (callee.type === TSESTree10.AST_NODE_TYPES.Identifier)
|
|
22396
|
+
return createContextIdentifiers.has(callee.name);
|
|
22397
|
+
if (callee.type === TSESTree10.AST_NODE_TYPES.MemberExpression && callee.object.type === TSESTree10.AST_NODE_TYPES.Identifier && callee.property.type === TSESTree10.AST_NODE_TYPES.Identifier) {
|
|
22398
|
+
return reactNamespaces.has(callee.object.name) && callee.property.name === "createContext";
|
|
22399
|
+
}
|
|
22400
|
+
return false;
|
|
22401
|
+
}
|
|
22402
|
+
function getVariableName(node) {
|
|
22403
|
+
if (node.id.type === TSESTree10.AST_NODE_TYPES.Identifier)
|
|
22404
|
+
return node.id.name;
|
|
22405
|
+
return;
|
|
22406
|
+
}
|
|
22407
|
+
function isNodeInExport(node) {
|
|
22408
|
+
let current = node;
|
|
22409
|
+
while (current) {
|
|
22410
|
+
const { type: type3 } = current;
|
|
22411
|
+
if (type3 === TSESTree10.AST_NODE_TYPES.ExportNamedDeclaration)
|
|
22412
|
+
return true;
|
|
22413
|
+
if (type3 === TSESTree10.AST_NODE_TYPES.ExportDefaultDeclaration)
|
|
22414
|
+
return true;
|
|
22415
|
+
current = current.parent;
|
|
22416
|
+
}
|
|
22417
|
+
return false;
|
|
22418
|
+
}
|
|
22419
|
+
function isReferenceExported(reference) {
|
|
22420
|
+
return isNodeInExport(reference.identifier);
|
|
22421
|
+
}
|
|
22422
|
+
var require_react_display_names_default = createRule({
|
|
22423
|
+
create(context) {
|
|
22424
|
+
const options3 = {
|
|
22425
|
+
...DEFAULT_OPTIONS4,
|
|
22426
|
+
...context.options[0]
|
|
22427
|
+
};
|
|
22428
|
+
const reactSources = getReactSources(options3.environment);
|
|
22429
|
+
const memoIdentifiers = new Set;
|
|
22430
|
+
const createContextIdentifiers = new Set;
|
|
22431
|
+
const reactNamespaces = new Set;
|
|
22432
|
+
const trackedVariables = new Map;
|
|
22433
|
+
const displayNameAssignments = new Set;
|
|
22434
|
+
return {
|
|
22435
|
+
"AssignmentExpression[left.type='MemberExpression'][left.property.name='displayName']"(node) {
|
|
22436
|
+
const left = node.left;
|
|
22437
|
+
if (left.object.type === TSESTree10.AST_NODE_TYPES.Identifier) {
|
|
22438
|
+
displayNameAssignments.add(left.object.name);
|
|
22439
|
+
}
|
|
22440
|
+
},
|
|
22441
|
+
ExportDefaultDeclaration(node) {
|
|
22442
|
+
const { declaration } = node;
|
|
22443
|
+
if (declaration.type === TSESTree10.AST_NODE_TYPES.CallExpression) {
|
|
22444
|
+
if (isMemoCall(declaration, memoIdentifiers, reactNamespaces)) {
|
|
22445
|
+
context.report({
|
|
22446
|
+
messageId: "directMemoExport",
|
|
22447
|
+
node
|
|
22448
|
+
});
|
|
22449
|
+
return;
|
|
22450
|
+
}
|
|
22451
|
+
if (isCreateContextCall(declaration, createContextIdentifiers, reactNamespaces)) {
|
|
22452
|
+
context.report({
|
|
22453
|
+
messageId: "directContextExport",
|
|
22454
|
+
node
|
|
22455
|
+
});
|
|
22456
|
+
return;
|
|
22457
|
+
}
|
|
22458
|
+
}
|
|
22459
|
+
if (declaration.type === TSESTree10.AST_NODE_TYPES.Identifier) {
|
|
22460
|
+
const tracked = trackedVariables.get(declaration.name);
|
|
22461
|
+
if (tracked) {
|
|
22462
|
+
trackedVariables.set(declaration.name, {
|
|
22463
|
+
...tracked,
|
|
22464
|
+
isDefaultExported: true
|
|
22465
|
+
});
|
|
22466
|
+
}
|
|
22467
|
+
}
|
|
22468
|
+
},
|
|
22469
|
+
ExportNamedDeclaration(node) {
|
|
22470
|
+
if (!node.specifiers)
|
|
22471
|
+
return;
|
|
22472
|
+
for (const specifier of node.specifiers) {
|
|
22473
|
+
if (specifier.type !== TSESTree10.AST_NODE_TYPES.ExportSpecifier)
|
|
22474
|
+
continue;
|
|
22475
|
+
const localName = specifier.local.type === TSESTree10.AST_NODE_TYPES.Identifier ? specifier.local.name : specifier.local.value;
|
|
22476
|
+
const exportedName = specifier.exported.type === TSESTree10.AST_NODE_TYPES.Identifier ? specifier.exported.name : specifier.exported.value;
|
|
22477
|
+
if (exportedName === "default") {
|
|
22478
|
+
const tracked = trackedVariables.get(localName);
|
|
22479
|
+
if (tracked) {
|
|
22480
|
+
trackedVariables.set(localName, {
|
|
22481
|
+
...tracked,
|
|
22482
|
+
isDefaultExported: true
|
|
22483
|
+
});
|
|
22484
|
+
}
|
|
22485
|
+
}
|
|
22486
|
+
}
|
|
22487
|
+
},
|
|
22488
|
+
ImportDeclaration(node) {
|
|
22489
|
+
if (!isReactImport(node, reactSources))
|
|
22490
|
+
return;
|
|
22491
|
+
for (const specifier of node.specifiers) {
|
|
22492
|
+
if (specifier.type === TSESTree10.AST_NODE_TYPES.ImportDefaultSpecifier || specifier.type === TSESTree10.AST_NODE_TYPES.ImportNamespaceSpecifier) {
|
|
22493
|
+
reactNamespaces.add(specifier.local.name);
|
|
22494
|
+
} else if (specifier.type === TSESTree10.AST_NODE_TYPES.ImportSpecifier) {
|
|
22495
|
+
const importedName = specifier.imported.type === TSESTree10.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
|
|
22496
|
+
if (importedName === "memo")
|
|
22497
|
+
memoIdentifiers.add(specifier.local.name);
|
|
22498
|
+
else if (importedName === "createContext")
|
|
22499
|
+
createContextIdentifiers.add(specifier.local.name);
|
|
22500
|
+
}
|
|
22501
|
+
}
|
|
22502
|
+
},
|
|
22503
|
+
"Program:exit"() {
|
|
22504
|
+
for (const [name, tracked] of trackedVariables) {
|
|
22505
|
+
const hasDisplayName = displayNameAssignments.has(name);
|
|
22506
|
+
if (hasDisplayName)
|
|
22507
|
+
continue;
|
|
22508
|
+
const declaredVariables = context.sourceCode.getDeclaredVariables(tracked.node);
|
|
22509
|
+
const variable = declaredVariables.find((declared) => declared.name === name);
|
|
22510
|
+
let isExported = tracked.isDefaultExported;
|
|
22511
|
+
if (variable)
|
|
22512
|
+
isExported ||= variable.references.some(isReferenceExported);
|
|
22513
|
+
const declarationParent = tracked.node.parent;
|
|
22514
|
+
if (declarationParent?.parent?.type === TSESTree10.AST_NODE_TYPES.ExportNamedDeclaration) {
|
|
22515
|
+
isExported = true;
|
|
22516
|
+
}
|
|
22517
|
+
if (isExported) {
|
|
22518
|
+
context.report({
|
|
22519
|
+
data: { name },
|
|
22520
|
+
messageId: tracked.kind === "memo" ? "missingMemoDisplayName" : "missingContextDisplayName",
|
|
22521
|
+
node: tracked.node
|
|
22522
|
+
});
|
|
22523
|
+
}
|
|
22524
|
+
}
|
|
22525
|
+
},
|
|
22526
|
+
VariableDeclarator(node) {
|
|
22527
|
+
if (!node.init || node.init.type !== TSESTree10.AST_NODE_TYPES.CallExpression)
|
|
22528
|
+
return;
|
|
22529
|
+
const name = getVariableName(node);
|
|
22530
|
+
if (!name)
|
|
22531
|
+
return;
|
|
22532
|
+
if (isMemoCall(node.init, memoIdentifiers, reactNamespaces)) {
|
|
22533
|
+
trackedVariables.set(name, {
|
|
22534
|
+
hasDisplayName: false,
|
|
22535
|
+
isDefaultExported: false,
|
|
22536
|
+
kind: "memo",
|
|
22537
|
+
name,
|
|
22538
|
+
node
|
|
22539
|
+
});
|
|
22540
|
+
} else if (isCreateContextCall(node.init, createContextIdentifiers, reactNamespaces)) {
|
|
22541
|
+
trackedVariables.set(name, {
|
|
22542
|
+
hasDisplayName: false,
|
|
22543
|
+
isDefaultExported: false,
|
|
22544
|
+
kind: "context",
|
|
22545
|
+
name,
|
|
22546
|
+
node
|
|
22547
|
+
});
|
|
22548
|
+
}
|
|
22549
|
+
}
|
|
22550
|
+
};
|
|
22551
|
+
},
|
|
22552
|
+
defaultOptions: [DEFAULT_OPTIONS4],
|
|
22553
|
+
meta: {
|
|
22554
|
+
docs: {
|
|
22555
|
+
description: "Require displayName property on exported React.memo components and React.createContext contexts for better debugging."
|
|
22556
|
+
},
|
|
22557
|
+
messages: {
|
|
22558
|
+
directContextExport: "Do not export createContext result directly. Assign to a variable, set displayName, then export.",
|
|
22559
|
+
directMemoExport: "Do not export memo result directly. Assign to a variable, set displayName, then export both named and default.",
|
|
22560
|
+
missingContextDisplayName: "Exported Context '{{name}}' is missing displayName. Add `{{name}}.displayName = \"{{name}}\";` before exporting.",
|
|
22561
|
+
missingMemoDisplayName: "Exported memoized component '{{name}}' is missing displayName. Add `{{name}}.displayName = \"{{name}}\";` before exporting."
|
|
22562
|
+
},
|
|
22563
|
+
schema: [
|
|
22564
|
+
{
|
|
22565
|
+
additionalProperties: false,
|
|
22566
|
+
properties: {
|
|
22567
|
+
environment: {
|
|
22568
|
+
default: "roblox-ts",
|
|
22569
|
+
description: "The React environment: 'roblox-ts' uses @rbxts/react, 'standard' uses react.",
|
|
22570
|
+
enum: ["roblox-ts", "standard"],
|
|
22571
|
+
type: "string"
|
|
22572
|
+
}
|
|
22573
|
+
},
|
|
22574
|
+
type: "object"
|
|
22575
|
+
}
|
|
22576
|
+
],
|
|
22577
|
+
type: "problem"
|
|
22578
|
+
},
|
|
22579
|
+
name: "require-react-display-names"
|
|
22580
|
+
});
|
|
22232
22581
|
|
|
22233
22582
|
// src/rules/strict-component-boundaries.ts
|
|
22234
22583
|
import { basename, extname, relative } from "node:path";
|
|
@@ -22274,7 +22623,7 @@ function isValidFixtureImport(pathParts) {
|
|
|
22274
22623
|
const partsBeforeFixture = pathParts.slice(0, fixtureIndex);
|
|
22275
22624
|
return !hasAnotherComponentInPath(partsBeforeFixture);
|
|
22276
22625
|
}
|
|
22277
|
-
var
|
|
22626
|
+
var strict_component_boundaries_default = createRule({
|
|
22278
22627
|
create(context) {
|
|
22279
22628
|
const [{ allow = [], maxDepth = 1 } = {}] = context.options;
|
|
22280
22629
|
const allowPatterns = allow.map(toRegExp);
|
|
@@ -22336,21 +22685,21 @@ var strictComponentBoundaries = {
|
|
|
22336
22685
|
}
|
|
22337
22686
|
],
|
|
22338
22687
|
type: "problem"
|
|
22339
|
-
}
|
|
22340
|
-
|
|
22341
|
-
|
|
22688
|
+
},
|
|
22689
|
+
name: "strict-component-boundaries"
|
|
22690
|
+
});
|
|
22342
22691
|
|
|
22343
22692
|
// src/rules/use-exhaustive-dependencies.ts
|
|
22344
|
-
import { TSESTree as
|
|
22693
|
+
import { TSESTree as TSESTree11 } from "@typescript-eslint/types";
|
|
22345
22694
|
var FUNCTION_DECLARATIONS = new Set([
|
|
22346
|
-
|
|
22347
|
-
|
|
22348
|
-
|
|
22695
|
+
TSESTree11.AST_NODE_TYPES.FunctionExpression,
|
|
22696
|
+
TSESTree11.AST_NODE_TYPES.ArrowFunctionExpression,
|
|
22697
|
+
TSESTree11.AST_NODE_TYPES.FunctionDeclaration
|
|
22349
22698
|
]);
|
|
22350
22699
|
var UNSTABLE_VALUES = new Set([
|
|
22351
22700
|
...FUNCTION_DECLARATIONS,
|
|
22352
|
-
|
|
22353
|
-
|
|
22701
|
+
TSESTree11.AST_NODE_TYPES.ObjectExpression,
|
|
22702
|
+
TSESTree11.AST_NODE_TYPES.ArrayExpression
|
|
22354
22703
|
]);
|
|
22355
22704
|
var testingMetrics = {
|
|
22356
22705
|
moduleLevelStableConst: 0,
|
|
@@ -22434,9 +22783,9 @@ var GLOBAL_BUILTINS = new Set([
|
|
|
22434
22783
|
]);
|
|
22435
22784
|
function getHookName4(node) {
|
|
22436
22785
|
const { callee } = node;
|
|
22437
|
-
if (callee.type ===
|
|
22786
|
+
if (callee.type === TSESTree11.AST_NODE_TYPES.Identifier)
|
|
22438
22787
|
return callee.name;
|
|
22439
|
-
if (callee.type ===
|
|
22788
|
+
if (callee.type === TSESTree11.AST_NODE_TYPES.MemberExpression && callee.property.type === TSESTree11.AST_NODE_TYPES.Identifier) {
|
|
22440
22789
|
return callee.property.name;
|
|
22441
22790
|
}
|
|
22442
22791
|
return;
|
|
@@ -22444,9 +22793,9 @@ function getHookName4(node) {
|
|
|
22444
22793
|
function getMemberExpressionDepth(node) {
|
|
22445
22794
|
let depth = 0;
|
|
22446
22795
|
let current = node;
|
|
22447
|
-
if (current.type ===
|
|
22796
|
+
if (current.type === TSESTree11.AST_NODE_TYPES.ChainExpression)
|
|
22448
22797
|
current = current.expression;
|
|
22449
|
-
while (current.type ===
|
|
22798
|
+
while (current.type === TSESTree11.AST_NODE_TYPES.MemberExpression) {
|
|
22450
22799
|
depth += 1;
|
|
22451
22800
|
current = current.object;
|
|
22452
22801
|
}
|
|
@@ -22454,36 +22803,36 @@ function getMemberExpressionDepth(node) {
|
|
|
22454
22803
|
}
|
|
22455
22804
|
function getRootIdentifier(node) {
|
|
22456
22805
|
let current = node;
|
|
22457
|
-
if (current.type ===
|
|
22806
|
+
if (current.type === TSESTree11.AST_NODE_TYPES.ChainExpression)
|
|
22458
22807
|
current = current.expression;
|
|
22459
|
-
while (current.type ===
|
|
22460
|
-
if (current.type ===
|
|
22808
|
+
while (current.type === TSESTree11.AST_NODE_TYPES.MemberExpression || current.type === TSESTree11.AST_NODE_TYPES.TSNonNullExpression) {
|
|
22809
|
+
if (current.type === TSESTree11.AST_NODE_TYPES.MemberExpression)
|
|
22461
22810
|
current = current.object;
|
|
22462
22811
|
else
|
|
22463
22812
|
current = current.expression;
|
|
22464
22813
|
}
|
|
22465
|
-
return current.type ===
|
|
22814
|
+
return current.type === TSESTree11.AST_NODE_TYPES.Identifier ? current : undefined;
|
|
22466
22815
|
}
|
|
22467
22816
|
function nodeToDependencyString(node, sourceCode) {
|
|
22468
22817
|
return sourceCode.getText(node);
|
|
22469
22818
|
}
|
|
22470
22819
|
function nodeToSafeDependencyPath(node, sourceCode) {
|
|
22471
|
-
if (node.type ===
|
|
22820
|
+
if (node.type === TSESTree11.AST_NODE_TYPES.Identifier)
|
|
22472
22821
|
return node.name;
|
|
22473
|
-
if (node.type ===
|
|
22822
|
+
if (node.type === TSESTree11.AST_NODE_TYPES.ChainExpression) {
|
|
22474
22823
|
return nodeToSafeDependencyPath(node.expression, sourceCode);
|
|
22475
22824
|
}
|
|
22476
22825
|
if (TS_RUNTIME_EXPRESSIONS.has(node.type)) {
|
|
22477
22826
|
const expr = node;
|
|
22478
22827
|
return nodeToSafeDependencyPath(expr.expression, sourceCode);
|
|
22479
22828
|
}
|
|
22480
|
-
if (node.type ===
|
|
22829
|
+
if (node.type === TSESTree11.AST_NODE_TYPES.MemberExpression) {
|
|
22481
22830
|
const objectPath = nodeToSafeDependencyPath(node.object, sourceCode);
|
|
22482
22831
|
if (node.computed) {
|
|
22483
22832
|
const propertyText = sourceCode.getText(node.property);
|
|
22484
22833
|
return `${objectPath}[${propertyText}]`;
|
|
22485
22834
|
}
|
|
22486
|
-
const propertyName = node.property.type ===
|
|
22835
|
+
const propertyName = node.property.type === TSESTree11.AST_NODE_TYPES.Identifier ? node.property.name : "";
|
|
22487
22836
|
const separator = node.optional ? "?." : ".";
|
|
22488
22837
|
return `${objectPath}${separator}${propertyName}`;
|
|
22489
22838
|
}
|
|
@@ -22492,13 +22841,13 @@ function nodeToSafeDependencyPath(node, sourceCode) {
|
|
|
22492
22841
|
function isStableArrayIndex(stableResult, node, identifierName) {
|
|
22493
22842
|
if (!stableResult)
|
|
22494
22843
|
return false;
|
|
22495
|
-
if (!(stableResult instanceof Set) || node.type !==
|
|
22844
|
+
if (!(stableResult instanceof Set) || node.type !== TSESTree11.AST_NODE_TYPES.VariableDeclarator || node.id.type !== TSESTree11.AST_NODE_TYPES.ArrayPattern) {
|
|
22496
22845
|
return false;
|
|
22497
22846
|
}
|
|
22498
22847
|
const { elements } = node.id;
|
|
22499
22848
|
let index2 = 0;
|
|
22500
22849
|
for (const element of elements) {
|
|
22501
|
-
if (element.type ===
|
|
22850
|
+
if (element.type === TSESTree11.AST_NODE_TYPES.Identifier && element.name === identifierName) {
|
|
22502
22851
|
return stableResult.has(index2);
|
|
22503
22852
|
}
|
|
22504
22853
|
index2 += 1;
|
|
@@ -22507,7 +22856,7 @@ function isStableArrayIndex(stableResult, node, identifierName) {
|
|
|
22507
22856
|
}
|
|
22508
22857
|
function isStableHookValue(init, node, identifierName, stableHooks) {
|
|
22509
22858
|
const castInit = init;
|
|
22510
|
-
if (castInit.type !==
|
|
22859
|
+
if (castInit.type !== TSESTree11.AST_NODE_TYPES.CallExpression)
|
|
22511
22860
|
return false;
|
|
22512
22861
|
const hookName = getHookName4(castInit);
|
|
22513
22862
|
if (!hookName)
|
|
@@ -22527,35 +22876,35 @@ function isStableValue(variable, identifierName, stableHooks) {
|
|
|
22527
22876
|
const { node, type: type3 } = definition;
|
|
22528
22877
|
if (STABLE_VALUE_TYPES.has(type3))
|
|
22529
22878
|
return true;
|
|
22530
|
-
if (type3 === "Variable" && node.type ===
|
|
22879
|
+
if (type3 === "Variable" && node.type === TSESTree11.AST_NODE_TYPES.VariableDeclarator) {
|
|
22531
22880
|
const { parent } = node;
|
|
22532
|
-
if (!parent || parent.type !==
|
|
22881
|
+
if (!parent || parent.type !== TSESTree11.AST_NODE_TYPES.VariableDeclaration || parent.kind !== "const") {
|
|
22533
22882
|
continue;
|
|
22534
22883
|
}
|
|
22535
22884
|
const init = node.init;
|
|
22536
22885
|
if (init && isStableHookValue(init, node, identifierName, stableHooks))
|
|
22537
22886
|
return true;
|
|
22538
|
-
if (init?.type ===
|
|
22887
|
+
if (init?.type === TSESTree11.AST_NODE_TYPES.CallExpression) {
|
|
22539
22888
|
const { callee } = init;
|
|
22540
|
-
if (callee.type ===
|
|
22889
|
+
if (callee.type === TSESTree11.AST_NODE_TYPES.MemberExpression && callee.object.type === TSESTree11.AST_NODE_TYPES.Identifier && callee.object.name === "React" && callee.property.type === TSESTree11.AST_NODE_TYPES.Identifier && callee.property.name === "joinBindings") {
|
|
22541
22890
|
return true;
|
|
22542
22891
|
}
|
|
22543
|
-
if (callee.type ===
|
|
22892
|
+
if (callee.type === TSESTree11.AST_NODE_TYPES.MemberExpression && callee.property.type === TSESTree11.AST_NODE_TYPES.Identifier && callee.property.name === "map") {
|
|
22544
22893
|
return true;
|
|
22545
22894
|
}
|
|
22546
22895
|
}
|
|
22547
22896
|
if (init) {
|
|
22548
|
-
if (init.type ===
|
|
22897
|
+
if (init.type === TSESTree11.AST_NODE_TYPES.Literal || init.type === TSESTree11.AST_NODE_TYPES.TemplateLiteral) {
|
|
22549
22898
|
return true;
|
|
22550
22899
|
}
|
|
22551
|
-
if (init.type ===
|
|
22900
|
+
if (init.type === TSESTree11.AST_NODE_TYPES.UnaryExpression && init.argument.type === TSESTree11.AST_NODE_TYPES.Literal) {
|
|
22552
22901
|
return true;
|
|
22553
22902
|
}
|
|
22554
22903
|
}
|
|
22555
22904
|
const variableDefinition = variable.defs.find((definition2) => definition2.node === node);
|
|
22556
|
-
if (variableDefinition && variableDefinition.node.type ===
|
|
22905
|
+
if (variableDefinition && variableDefinition.node.type === TSESTree11.AST_NODE_TYPES.VariableDeclarator) {
|
|
22557
22906
|
const declarationParent = variableDefinition.node.parent?.parent;
|
|
22558
|
-
if (declarationParent && (declarationParent.type ===
|
|
22907
|
+
if (declarationParent && (declarationParent.type === TSESTree11.AST_NODE_TYPES.Program || declarationParent.type === TSESTree11.AST_NODE_TYPES.ExportNamedDeclaration)) {
|
|
22559
22908
|
testingMetrics.moduleLevelStableConst += 1;
|
|
22560
22909
|
return true;
|
|
22561
22910
|
}
|
|
@@ -22568,14 +22917,14 @@ function findTopmostMemberExpression(node) {
|
|
|
22568
22917
|
let current = node;
|
|
22569
22918
|
let { parent } = node;
|
|
22570
22919
|
while (parent) {
|
|
22571
|
-
if (parent.type ===
|
|
22572
|
-
if (current.type ===
|
|
22920
|
+
if (parent.type === TSESTree11.AST_NODE_TYPES.CallExpression && parent.callee === current) {
|
|
22921
|
+
if (current.type === TSESTree11.AST_NODE_TYPES.MemberExpression)
|
|
22573
22922
|
return current.object;
|
|
22574
22923
|
break;
|
|
22575
22924
|
}
|
|
22576
|
-
const isMemberParent = parent.type ===
|
|
22577
|
-
const isChainParent = parent.type ===
|
|
22578
|
-
const isNonNullParent = parent.type ===
|
|
22925
|
+
const isMemberParent = parent.type === TSESTree11.AST_NODE_TYPES.MemberExpression && parent.object === current;
|
|
22926
|
+
const isChainParent = parent.type === TSESTree11.AST_NODE_TYPES.ChainExpression;
|
|
22927
|
+
const isNonNullParent = parent.type === TSESTree11.AST_NODE_TYPES.TSNonNullExpression;
|
|
22579
22928
|
if (!(isMemberParent || isChainParent || isNonNullParent))
|
|
22580
22929
|
break;
|
|
22581
22930
|
current = parent;
|
|
@@ -22584,21 +22933,21 @@ function findTopmostMemberExpression(node) {
|
|
|
22584
22933
|
return current;
|
|
22585
22934
|
}
|
|
22586
22935
|
var IS_CEASE_BOUNDARY = new Set([
|
|
22587
|
-
|
|
22588
|
-
|
|
22589
|
-
|
|
22590
|
-
|
|
22936
|
+
TSESTree11.AST_NODE_TYPES.FunctionDeclaration,
|
|
22937
|
+
TSESTree11.AST_NODE_TYPES.FunctionExpression,
|
|
22938
|
+
TSESTree11.AST_NODE_TYPES.ArrowFunctionExpression,
|
|
22939
|
+
TSESTree11.AST_NODE_TYPES.VariableDeclarator
|
|
22591
22940
|
]);
|
|
22592
22941
|
var TS_RUNTIME_EXPRESSIONS = new Set([
|
|
22593
|
-
|
|
22594
|
-
|
|
22595
|
-
|
|
22596
|
-
|
|
22597
|
-
|
|
22942
|
+
TSESTree11.AST_NODE_TYPES.TSNonNullExpression,
|
|
22943
|
+
TSESTree11.AST_NODE_TYPES.TSAsExpression,
|
|
22944
|
+
TSESTree11.AST_NODE_TYPES.TSSatisfiesExpression,
|
|
22945
|
+
TSESTree11.AST_NODE_TYPES.TSTypeAssertion,
|
|
22946
|
+
TSESTree11.AST_NODE_TYPES.TSInstantiationExpression
|
|
22598
22947
|
]);
|
|
22599
22948
|
function isComputedPropertyIdentifier(identifier3) {
|
|
22600
22949
|
const { parent } = identifier3;
|
|
22601
|
-
return parent?.type ===
|
|
22950
|
+
return parent?.type === TSESTree11.AST_NODE_TYPES.Property && parent.computed && parent.key === identifier3;
|
|
22602
22951
|
}
|
|
22603
22952
|
function isInTypePosition(identifier3) {
|
|
22604
22953
|
let parent = identifier3.parent;
|
|
@@ -22652,10 +23001,10 @@ function resolveFunctionReference(identifier3, scope) {
|
|
|
22652
23001
|
return;
|
|
22653
23002
|
for (const definition of variable.defs) {
|
|
22654
23003
|
const { node } = definition;
|
|
22655
|
-
if (node.type ===
|
|
23004
|
+
if (node.type === TSESTree11.AST_NODE_TYPES.FunctionDeclaration) {
|
|
22656
23005
|
return node;
|
|
22657
23006
|
}
|
|
22658
|
-
if (node.type ===
|
|
23007
|
+
if (node.type === TSESTree11.AST_NODE_TYPES.VariableDeclarator && node.init && (node.init.type === TSESTree11.AST_NODE_TYPES.ArrowFunctionExpression || node.init.type === TSESTree11.AST_NODE_TYPES.FunctionExpression)) {
|
|
22659
23008
|
return node.init;
|
|
22660
23009
|
}
|
|
22661
23010
|
}
|
|
@@ -22665,7 +23014,7 @@ function collectCaptures(node, sourceCode) {
|
|
|
22665
23014
|
const captures = new Array;
|
|
22666
23015
|
const captureSet = new Set;
|
|
22667
23016
|
function visit(current) {
|
|
22668
|
-
if (current.type ===
|
|
23017
|
+
if (current.type === TSESTree11.AST_NODE_TYPES.Identifier) {
|
|
22669
23018
|
const { name } = current;
|
|
22670
23019
|
if (captureSet.has(name) || GLOBAL_BUILTINS.has(name) || isInTypePosition(current))
|
|
22671
23020
|
return;
|
|
@@ -22707,21 +23056,21 @@ function collectCaptures(node, sourceCode) {
|
|
|
22707
23056
|
}
|
|
22708
23057
|
}
|
|
22709
23058
|
}
|
|
22710
|
-
if (current.type ===
|
|
23059
|
+
if (current.type === TSESTree11.AST_NODE_TYPES.TSSatisfiesExpression || current.type === TSESTree11.AST_NODE_TYPES.TSAsExpression || current.type === TSESTree11.AST_NODE_TYPES.TSTypeAssertion || current.type === TSESTree11.AST_NODE_TYPES.TSNonNullExpression) {
|
|
22711
23060
|
visit(current.expression);
|
|
22712
23061
|
return;
|
|
22713
23062
|
}
|
|
22714
|
-
if (current.type ===
|
|
23063
|
+
if (current.type === TSESTree11.AST_NODE_TYPES.MemberExpression) {
|
|
22715
23064
|
visit(current.object);
|
|
22716
23065
|
if (current.computed)
|
|
22717
23066
|
visit(current.property);
|
|
22718
23067
|
return;
|
|
22719
23068
|
}
|
|
22720
|
-
if (current.type ===
|
|
23069
|
+
if (current.type === TSESTree11.AST_NODE_TYPES.ChainExpression) {
|
|
22721
23070
|
visit(current.expression);
|
|
22722
23071
|
return;
|
|
22723
23072
|
}
|
|
22724
|
-
if (current.type ===
|
|
23073
|
+
if (current.type === TSESTree11.AST_NODE_TYPES.Property) {
|
|
22725
23074
|
if (current.computed)
|
|
22726
23075
|
visit(current.key);
|
|
22727
23076
|
visit(current.value);
|
|
@@ -22746,7 +23095,7 @@ function parseDependencies(node, sourceCode) {
|
|
|
22746
23095
|
for (const element of node.elements) {
|
|
22747
23096
|
if (!element)
|
|
22748
23097
|
continue;
|
|
22749
|
-
const actualNode = element.type ===
|
|
23098
|
+
const actualNode = element.type === TSESTree11.AST_NODE_TYPES.SpreadElement ? element.argument : element;
|
|
22750
23099
|
const name = nodeToDependencyString(actualNode, sourceCode);
|
|
22751
23100
|
const depth = getMemberExpressionDepth(actualNode);
|
|
22752
23101
|
dependencies4.push({
|
|
@@ -22823,9 +23172,9 @@ var useExhaustiveDependencies = {
|
|
|
22823
23172
|
if (closureArgument === undefined)
|
|
22824
23173
|
return;
|
|
22825
23174
|
let closureFunction;
|
|
22826
|
-
if (closureArgument.type ===
|
|
23175
|
+
if (closureArgument.type === TSESTree11.AST_NODE_TYPES.ArrowFunctionExpression || closureArgument.type === TSESTree11.AST_NODE_TYPES.FunctionExpression) {
|
|
22827
23176
|
closureFunction = closureArgument;
|
|
22828
|
-
} else if (closureArgument.type ===
|
|
23177
|
+
} else if (closureArgument.type === TSESTree11.AST_NODE_TYPES.Identifier) {
|
|
22829
23178
|
const scope = getScope(callNode);
|
|
22830
23179
|
closureFunction = resolveFunctionReference(closureArgument, scope);
|
|
22831
23180
|
}
|
|
@@ -22859,7 +23208,7 @@ var useExhaustiveDependencies = {
|
|
|
22859
23208
|
}
|
|
22860
23209
|
if (!dependenciesArgument)
|
|
22861
23210
|
return;
|
|
22862
|
-
if (dependenciesArgument.type !==
|
|
23211
|
+
if (dependenciesArgument.type !== TSESTree11.AST_NODE_TYPES.ArrayExpression)
|
|
22863
23212
|
return;
|
|
22864
23213
|
const dependenciesArray = dependenciesArgument;
|
|
22865
23214
|
const captures = collectCaptures(closureFunction, context.sourceCode);
|
|
@@ -23069,7 +23418,7 @@ var useExhaustiveDependencies = {
|
|
|
23069
23418
|
var use_exhaustive_dependencies_default = useExhaustiveDependencies;
|
|
23070
23419
|
|
|
23071
23420
|
// src/rules/use-hook-at-top-level.ts
|
|
23072
|
-
import { TSESTree as
|
|
23421
|
+
import { TSESTree as TSESTree12 } from "@typescript-eslint/types";
|
|
23073
23422
|
var HOOK_NAME_PATTERN = /^use[A-Z]/;
|
|
23074
23423
|
var COMPONENT_NAME_PATTERN2 = /^[A-Z]/;
|
|
23075
23424
|
function isReactHook(name) {
|
|
@@ -23079,23 +23428,23 @@ function isComponent(name) {
|
|
|
23079
23428
|
return COMPONENT_NAME_PATTERN2.test(name);
|
|
23080
23429
|
}
|
|
23081
23430
|
function isComponentOrHook(node) {
|
|
23082
|
-
if (node.type ===
|
|
23431
|
+
if (node.type === TSESTree12.AST_NODE_TYPES.FunctionDeclaration && node.id) {
|
|
23083
23432
|
const { name } = node.id;
|
|
23084
23433
|
return isComponent(name) || isReactHook(name);
|
|
23085
23434
|
}
|
|
23086
|
-
if (node.type ===
|
|
23435
|
+
if (node.type === TSESTree12.AST_NODE_TYPES.FunctionExpression || node.type === TSESTree12.AST_NODE_TYPES.ArrowFunctionExpression) {
|
|
23087
23436
|
const { parent } = node;
|
|
23088
23437
|
if (parent === undefined)
|
|
23089
23438
|
return false;
|
|
23090
|
-
if (parent.type ===
|
|
23439
|
+
if (parent.type === TSESTree12.AST_NODE_TYPES.VariableDeclarator && parent.id.type === TSESTree12.AST_NODE_TYPES.Identifier) {
|
|
23091
23440
|
const { name } = parent.id;
|
|
23092
23441
|
return isComponent(name) || isReactHook(name);
|
|
23093
23442
|
}
|
|
23094
|
-
if (parent.type ===
|
|
23443
|
+
if (parent.type === TSESTree12.AST_NODE_TYPES.Property && parent.key.type === TSESTree12.AST_NODE_TYPES.Identifier) {
|
|
23095
23444
|
const { name } = parent.key;
|
|
23096
23445
|
return isComponent(name) || isReactHook(name);
|
|
23097
23446
|
}
|
|
23098
|
-
if (parent.type ===
|
|
23447
|
+
if (parent.type === TSESTree12.AST_NODE_TYPES.MethodDefinition && parent.key.type === TSESTree12.AST_NODE_TYPES.Identifier) {
|
|
23099
23448
|
const { name } = parent.key;
|
|
23100
23449
|
return isComponent(name) || isReactHook(name);
|
|
23101
23450
|
}
|
|
@@ -23104,17 +23453,17 @@ function isComponentOrHook(node) {
|
|
|
23104
23453
|
}
|
|
23105
23454
|
function isHookCall(node) {
|
|
23106
23455
|
const { callee } = node;
|
|
23107
|
-
if (callee.type ===
|
|
23456
|
+
if (callee.type === TSESTree12.AST_NODE_TYPES.Identifier)
|
|
23108
23457
|
return isReactHook(callee.name);
|
|
23109
|
-
if (callee.type ===
|
|
23458
|
+
if (callee.type === TSESTree12.AST_NODE_TYPES.MemberExpression && callee.property.type === TSESTree12.AST_NODE_TYPES.Identifier) {
|
|
23110
23459
|
return isReactHook(callee.property.name);
|
|
23111
23460
|
}
|
|
23112
23461
|
return false;
|
|
23113
23462
|
}
|
|
23114
23463
|
var FUNCTION_BOUNDARIES2 = new Set([
|
|
23115
|
-
|
|
23116
|
-
|
|
23117
|
-
|
|
23464
|
+
TSESTree12.AST_NODE_TYPES.FunctionDeclaration,
|
|
23465
|
+
TSESTree12.AST_NODE_TYPES.FunctionExpression,
|
|
23466
|
+
TSESTree12.AST_NODE_TYPES.ArrowFunctionExpression
|
|
23118
23467
|
]);
|
|
23119
23468
|
function isInFinallyBlock(node) {
|
|
23120
23469
|
let current = node.parent;
|
|
@@ -23123,7 +23472,7 @@ function isInFinallyBlock(node) {
|
|
|
23123
23472
|
for (let depth = 0;depth < maxDepth && current; depth += 1) {
|
|
23124
23473
|
if (FUNCTION_BOUNDARIES2.has(current.type))
|
|
23125
23474
|
break;
|
|
23126
|
-
if (current.type ===
|
|
23475
|
+
if (current.type === TSESTree12.AST_NODE_TYPES.TryStatement) {
|
|
23127
23476
|
let checkNode = node;
|
|
23128
23477
|
while (checkNode && checkNode !== current) {
|
|
23129
23478
|
if (checkNode === current.finalizer) {
|
|
@@ -23171,14 +23520,14 @@ var useHookAtTopLevel = {
|
|
|
23171
23520
|
if (ignoreHooks?.includes(hookName))
|
|
23172
23521
|
return true;
|
|
23173
23522
|
if (importSources && Object.keys(importSources).length > 0) {
|
|
23174
|
-
if (node.callee.type ===
|
|
23175
|
-
const objectName = node.callee.object.type ===
|
|
23523
|
+
if (node.callee.type === TSESTree12.AST_NODE_TYPES.MemberExpression) {
|
|
23524
|
+
const objectName = node.callee.object.type === TSESTree12.AST_NODE_TYPES.Identifier ? node.callee.object.name : undefined;
|
|
23176
23525
|
if (objectName && importSources[objectName] === false)
|
|
23177
23526
|
return true;
|
|
23178
23527
|
if (objectName && importSources[objectName] === true)
|
|
23179
23528
|
return false;
|
|
23180
23529
|
}
|
|
23181
|
-
if (node.callee.type ===
|
|
23530
|
+
if (node.callee.type === TSESTree12.AST_NODE_TYPES.Identifier) {
|
|
23182
23531
|
const importSource = importSourceMap.get(hookName);
|
|
23183
23532
|
if (importSource && importSources[importSource] === false)
|
|
23184
23533
|
return true;
|
|
@@ -23193,7 +23542,7 @@ var useHookAtTopLevel = {
|
|
|
23193
23542
|
const current = getCurrentContext();
|
|
23194
23543
|
const depth = current ? current.functionDepth + 1 : 0;
|
|
23195
23544
|
const isComponentOrHookFlag = isComponentOrHook(functionNode);
|
|
23196
|
-
if (functionNode.type ===
|
|
23545
|
+
if (functionNode.type === TSESTree12.AST_NODE_TYPES.FunctionDeclaration && functionNode.id) {
|
|
23197
23546
|
currentFunctionName = functionNode.id.name;
|
|
23198
23547
|
}
|
|
23199
23548
|
if (current?.isComponentOrHook) {
|
|
@@ -23232,7 +23581,7 @@ var useHookAtTopLevel = {
|
|
|
23232
23581
|
if (!isHookCall(callNode))
|
|
23233
23582
|
return;
|
|
23234
23583
|
const { callee } = callNode;
|
|
23235
|
-
const hookName = callee.type ===
|
|
23584
|
+
const hookName = callee.type === TSESTree12.AST_NODE_TYPES.Identifier ? callee.name : callee.type === TSESTree12.AST_NODE_TYPES.MemberExpression && callee.property.type === TSESTree12.AST_NODE_TYPES.Identifier ? callee.property.name : undefined;
|
|
23236
23585
|
if (!hookName || shouldIgnoreHook(hookName, callNode))
|
|
23237
23586
|
return;
|
|
23238
23587
|
const current = getCurrentContext();
|
|
@@ -23330,10 +23679,10 @@ var useHookAtTopLevel = {
|
|
|
23330
23679
|
if (!configuration.importSources || Object.keys(configuration.importSources).length === 0)
|
|
23331
23680
|
return;
|
|
23332
23681
|
for (const specifier of importNode.specifiers) {
|
|
23333
|
-
if (specifier.type !==
|
|
23682
|
+
if (specifier.type !== TSESTree12.AST_NODE_TYPES.ImportSpecifier)
|
|
23334
23683
|
continue;
|
|
23335
23684
|
const { imported } = specifier;
|
|
23336
|
-
if (imported.type !==
|
|
23685
|
+
if (imported.type !== TSESTree12.AST_NODE_TYPES.Identifier)
|
|
23337
23686
|
continue;
|
|
23338
23687
|
if (isReactHook(imported.name))
|
|
23339
23688
|
importSourceMap.set(specifier.local.name, source);
|
|
@@ -23509,6 +23858,9 @@ function createNoUselessUseSpringOptions(options3 = {}) {
|
|
|
23509
23858
|
function createPreferPatternReplacementsOptions(patterns2 = []) {
|
|
23510
23859
|
return { patterns: patterns2 };
|
|
23511
23860
|
}
|
|
23861
|
+
function createRequireReactDisplayNamesOptions(options3 = {}) {
|
|
23862
|
+
return { environment: "roblox-ts", ...options3 };
|
|
23863
|
+
}
|
|
23512
23864
|
|
|
23513
23865
|
// src/index.ts
|
|
23514
23866
|
var rules = {
|
|
@@ -23538,6 +23890,7 @@ var rules = {
|
|
|
23538
23890
|
"require-named-effect-functions": require_named_effect_functions_default,
|
|
23539
23891
|
"require-paired-calls": require_paired_calls_default,
|
|
23540
23892
|
"require-react-component-keys": require_react_component_keys_default,
|
|
23893
|
+
"require-react-display-names": require_react_display_names_default,
|
|
23541
23894
|
"strict-component-boundaries": strict_component_boundaries_default,
|
|
23542
23895
|
"use-exhaustive-dependencies": use_exhaustive_dependencies_default,
|
|
23543
23896
|
"use-hook-at-top-level": use_hook_at_top_level_default
|
|
@@ -23562,6 +23915,7 @@ var recommended = {
|
|
|
23562
23915
|
"cease-nonsense/prefer-udim2-shorthand": "error",
|
|
23563
23916
|
"cease-nonsense/require-named-effect-functions": "error",
|
|
23564
23917
|
"cease-nonsense/require-react-component-keys": "error",
|
|
23918
|
+
"cease-nonsense/require-react-display-names": "error",
|
|
23565
23919
|
"cease-nonsense/use-exhaustive-dependencies": "error",
|
|
23566
23920
|
"cease-nonsense/use-hook-at-top-level": "error"
|
|
23567
23921
|
}
|
|
@@ -23577,6 +23931,7 @@ export {
|
|
|
23577
23931
|
src_default as default,
|
|
23578
23932
|
createUseHookAtTopLevelOptions,
|
|
23579
23933
|
createUseExhaustiveDependenciesOptions,
|
|
23934
|
+
createRequireReactDisplayNamesOptions,
|
|
23580
23935
|
createRequirePairedCallsOptions,
|
|
23581
23936
|
createReactKeysOptions,
|
|
23582
23937
|
createPreferPatternReplacementsOptions,
|
|
@@ -23591,4 +23946,4 @@ export {
|
|
|
23591
23946
|
createBanInstancesOptions
|
|
23592
23947
|
};
|
|
23593
23948
|
|
|
23594
|
-
//# debugId=
|
|
23949
|
+
//# debugId=2B2944174D0F631464756E2164756E21
|