Skip to content

Commit 8902897

Browse files
authored
Merge pull request #12990 from CesiumGS/detect-and-remove-unused-eslint-disable-directives
Detect and remove unused eslint disable directives
2 parents 4b77c39 + 572b34f commit 8902897

16 files changed

+116
-166
lines changed

Apps/CesiumViewer/CesiumViewer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// eslint-disable-next-line no-undef
21
window.CESIUM_BASE_URL = window.CESIUM_BASE_URL
32
? window.CESIUM_BASE_URL
43
: "../../Build/CesiumUnminified/";

Specs/MetadataTester.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,10 @@ function createBuffer(values, componentType) {
401401
typedArray = new Uint32Array(values);
402402
break;
403403
case MetadataComponentType.INT64:
404-
typedArray = new BigInt64Array(values); // eslint-disable-line
404+
typedArray = new BigInt64Array(values);
405405
break;
406406
case MetadataComponentType.UINT64:
407-
typedArray = new BigUint64Array(values); // eslint-disable-line
407+
typedArray = new BigUint64Array(values);
408408
break;
409409
case MetadataComponentType.FLOAT32:
410410
typedArray = new Float32Array(values);

eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ export default [
3131
},
3232
{
3333
...configCesium.configs.recommended,
34+
linterOptions: {
35+
reportUnusedDisableDirectives: "error",
36+
},
3437
languageOptions: {
3538
sourceType: "module",
3639
},

packages/engine/Source/Core/FeatureDetection.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,10 @@ if (typeof ArrayBuffer !== "undefined") {
282282
}
283283

284284
if (typeof BigInt64Array !== "undefined") {
285-
// eslint-disable-next-line no-undef
286285
typedArrayTypes.push(BigInt64Array);
287286
}
288287

289288
if (typeof BigUint64Array !== "undefined") {
290-
// eslint-disable-next-line no-undef
291289
typedArrayTypes.push(BigUint64Array);
292290
}
293291
}

packages/engine/Source/Core/HilbertOrder.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ HilbertOrder.encode2D = function (level, x, y) {
3838
let rx,
3939
ry,
4040
s,
41-
// eslint-disable-next-line no-undef
4241
index = BigInt(0);
4342

4443
for (s = n / 2; s > 0; s /= 2) {
4544
rx = (p.x & s) > 0 ? 1 : 0;
4645
ry = (p.y & s) > 0 ? 1 : 0;
47-
// eslint-disable-next-line no-undef
4846
index += BigInt(((3 * rx) ^ ry) * s * s);
4947
rotate(n, p, rx, ry);
5048
}
@@ -67,7 +65,6 @@ HilbertOrder.decode2D = function (level, index) {
6765
if (level < 1) {
6866
throw new DeveloperError("Hilbert level cannot be less than 1.");
6967
}
70-
// eslint-disable-next-line no-undef
7168
if (index < BigInt(0) || index >= BigInt(Math.pow(4, level))) {
7269
throw new DeveloperError(
7370
"Hilbert index exceeds valid maximum for given level.",
@@ -83,14 +80,11 @@ HilbertOrder.decode2D = function (level, index) {
8380
let rx, ry, s, t;
8481

8582
for (s = 1, t = index; s < n; s *= 2) {
86-
// eslint-disable-next-line no-undef
8783
rx = 1 & Number(t / BigInt(2));
88-
// eslint-disable-next-line no-undef
8984
ry = 1 & Number(t ^ BigInt(rx));
9085
rotate(s, p, rx, ry);
9186
p.x += s * rx;
9287
p.y += s * ry;
93-
// eslint-disable-next-line no-undef
9488
t /= BigInt(4);
9589
}
9690

packages/engine/Source/Core/S2Cell.js

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable new-cap */
21
import Cartesian3 from "./Cartesian3.js";
32
import Cartographic from "./Cartographic.js";
43
import Check from "./Check.js";
@@ -209,15 +208,12 @@ S2Cell.isValidId = function (cellId) {
209208
}
210209

211210
// Check if face bits indicate a valid value, in range [0-5].
212-
// eslint-disable-next-line
213211
if (cellId >> BigInt(S2_POSITION_BITS) > 5) {
214212
return false;
215213
}
216214

217215
// Check trailing 1 bit is in one of the even bit positions allowed for the 30 levels, using a bitmask.
218-
// eslint-disable-next-line no-undef
219216
const lowestSetBit = cellId & (~cellId + BigInt(1));
220-
// eslint-disable-next-line
221217
if (!(lowestSetBit & BigInt("0x1555555555555555"))) {
222218
return false;
223219
}
@@ -296,14 +292,12 @@ S2Cell.getLevel = function (cellId) {
296292
//>>includeEnd('debug');
297293

298294
let lsbPosition = 0;
299-
// eslint-disable-next-line
300295
while (cellId !== BigInt(0)) {
301-
// eslint-disable-next-line
302296
if (cellId & BigInt(1)) {
303297
break;
304298
}
305299
lsbPosition++;
306-
cellId = cellId >> BigInt(1); // eslint-disable-line
300+
cellId = cellId >> BigInt(1);
307301
}
308302

309303
// We use (>> 1) because there are 2 bits per level.
@@ -329,10 +323,8 @@ S2Cell.prototype.getChild = function (index) {
329323
//>>includeEnd('debug');
330324

331325
// Shift sentinel bit 2 positions to the right.
332-
// eslint-disable-next-line no-undef
333326
const newLsb = lsb(this._cellId) >> BigInt(2);
334327
// Insert child index before the sentinel bit.
335-
// eslint-disable-next-line no-undef
336328
const childCellId = this._cellId + BigInt(2 * index + 1 - 4) * newLsb;
337329
return new S2Cell(childCellId);
338330
};
@@ -350,10 +342,8 @@ S2Cell.prototype.getParent = function () {
350342
}
351343
//>>includeEnd('debug');
352344
// Shift the sentinel bit 2 positions to the left.
353-
// eslint-disable-next-line no-undef
354345
const newLsb = lsb(this._cellId) << BigInt(2);
355346
// Erase the left over bits to the right of the sentinel bit.
356-
// eslint-disable-next-line no-undef
357347
return new S2Cell((this._cellId & (~newLsb + BigInt(1))) | newLsb);
358348
};
359349

@@ -455,7 +445,6 @@ S2Cell.fromFacePositionLevel = function (face, position, level) {
455445
).join("0");
456446
const positionSuffixPadding = Array(S2_POSITION_BITS - 2 * level).join("0");
457447

458-
// eslint-disable-next-line no-undef
459448
const cellId = BigInt(
460449
`0b${faceBitString}${positionPrefixPadding}${positionBitString}1${
461450
// Adding the sentinel bit that always follows the position bits.
@@ -500,7 +489,7 @@ function convertCellIdToFaceSiTi(cellId, level) {
500489
// that represent the parent cell center.
501490
const isLeaf = level === 30;
502491
const shouldCorrect =
503-
!isLeaf && (BigInt(i) ^ (cellId >> BigInt(2))) & BigInt(1); // eslint-disable-line
492+
!isLeaf && (BigInt(i) ^ (cellId >> BigInt(2))) & BigInt(1);
504493
const correction = isLeaf ? 1 : shouldCorrect ? 2 : 0;
505494
const si = (i << 1) + correction;
506495
const ti = (j << 1) + correction;
@@ -515,7 +504,6 @@ function convertCellIdToFaceIJ(cellId) {
515504
generateLookupTable();
516505
}
517506

518-
// eslint-disable-next-line no-undef
519507
const face = Number(cellId >> BigInt(S2_POSITION_BITS));
520508
let bits = face & S2_SWAP_MASK;
521509
const lookupMask = (1 << S2_LOOKUP_BITS) - 1;
@@ -529,7 +517,7 @@ function convertCellIdToFaceIJ(cellId) {
529517
const extractMask = (1 << (2 * numberOfBits)) - 1;
530518
bits +=
531519
Number(
532-
(cellId >> BigInt(k * 2 * S2_LOOKUP_BITS + 1)) & BigInt(extractMask), // eslint-disable-line
520+
(cellId >> BigInt(k * 2 * S2_LOOKUP_BITS + 1)) & BigInt(extractMask),
533521
) << 2;
534522

535523
bits = S2_LOOKUP_IJ[bits];
@@ -715,15 +703,15 @@ function generateLookupTable() {
715703
* @private
716704
*/
717705
function lsb(cellId) {
718-
return cellId & (~cellId + BigInt(1)); // eslint-disable-line
706+
return cellId & (~cellId + BigInt(1));
719707
}
720708

721709
/**
722710
* Return the lowest-numbered bit that is on for cells at the given level.
723711
* @private
724712
*/
725713
function lsbForLevel(level) {
726-
return BigInt(1) << BigInt(2 * (S2_MAX_LEVEL - level)); // eslint-disable-line
714+
return BigInt(1) << BigInt(2 * (S2_MAX_LEVEL - level));
727715
}
728716

729717
// Lookup table for getting trailing zero bits.
@@ -740,7 +728,7 @@ const Mod67BitPosition = [
740728
* @private
741729
*/
742730
function countTrailingZeroBits(x) {
743-
return Mod67BitPosition[(-x & x) % BigInt(67)]; // eslint-disable-line
731+
return Mod67BitPosition[(-x & x) % BigInt(67)];
744732
}
745733

746734
export default S2Cell;

packages/engine/Source/Scene/GaussianSplat3DTileContent.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ Object.defineProperties(GaussianSplat3DTileContent.prototype, {
236236
* @readonly
237237
*/
238238
batchTableByteLength: {
239-
// eslint-disable-next-line getter-return
240239
get: function () {
241240
return 0;
242241
},

packages/engine/Source/Scene/Implicit3DTileContent.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,15 +905,13 @@ function deriveBoundingVolumeS2(
905905
}
906906

907907
// Extract the first 3 face bits from the 64-bit S2 cell ID.
908-
// eslint-disable-next-line no-undef
909908
const face = Number(parentTile._boundingVolume.s2Cell._cellId >> BigInt(61));
910909
// The Hilbert curve is rotated for the "odd" faces on the S2 Earthcube.
911910
// See http://s2geometry.io/devguide/img/s2cell_global.jpg
912911
const position =
913912
face % 2 === 0
914913
? HilbertOrder.encode2D(level, x, y)
915914
: HilbertOrder.encode2D(level, y, x);
916-
// eslint-disable-next-line no-undef
917915
const cell = S2Cell.fromFacePositionLevel(face, BigInt(position), level);
918916

919917
let minHeight, maxHeight;

packages/engine/Source/Scene/MetadataComponentType.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ MetadataComponentType.getMinimum = function (type) {
119119
return 0;
120120
case MetadataComponentType.INT64:
121121
if (FeatureDetection.supportsBigInt()) {
122-
return BigInt("-9223372036854775808"); // eslint-disable-line
122+
return BigInt("-9223372036854775808");
123123
}
124124
return -Math.pow(2, 63);
125125
case MetadataComponentType.UINT64:
126126
if (FeatureDetection.supportsBigInt()) {
127-
return BigInt(0); // eslint-disable-line
127+
return BigInt(0);
128128
}
129129
return 0;
130130
case MetadataComponentType.FLOAT32:
@@ -168,13 +168,13 @@ MetadataComponentType.getMaximum = function (type) {
168168
case MetadataComponentType.INT64:
169169
if (FeatureDetection.supportsBigInt()) {
170170
// Need to initialize with a string otherwise the value will be 9223372036854775808
171-
return BigInt("9223372036854775807"); // eslint-disable-line
171+
return BigInt("9223372036854775807");
172172
}
173173
return Math.pow(2, 63) - 1;
174174
case MetadataComponentType.UINT64:
175175
if (FeatureDetection.supportsBigInt()) {
176176
// Need to initialize with a string otherwise the value will be 18446744073709551616
177-
return BigInt("18446744073709551615"); // eslint-disable-line
177+
return BigInt("18446744073709551615");
178178
}
179179
return Math.pow(2, 64) - 1;
180180
case MetadataComponentType.FLOAT32:
@@ -333,7 +333,7 @@ MetadataComponentType.unnormalize = function (value, type) {
333333
type === MetadataComponentType.UINT64) &&
334334
FeatureDetection.supportsBigInt()
335335
) {
336-
value = BigInt(value); // eslint-disable-line
336+
value = BigInt(value);
337337
}
338338

339339
if (value > max) {

packages/engine/Source/Scene/MetadataTableProperty.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,6 @@ function getInt64NumberFallback(index, values) {
549549
function getInt64BigIntFallback(index, values) {
550550
const dataView = values.dataView;
551551
const byteOffset = index * 8;
552-
// eslint-disable-next-line no-undef
553552
let value = BigInt(0);
554553
const isNegative = (dataView.getUint8(byteOffset + 7) & 0x80) > 0;
555554
let carrying = true;
@@ -565,7 +564,7 @@ function getInt64BigIntFallback(index, values) {
565564
byte = ~byte & 0xff;
566565
}
567566
}
568-
value += BigInt(byte) * (BigInt(1) << BigInt(i * 8)); // eslint-disable-line
567+
value += BigInt(byte) * (BigInt(1) << BigInt(i * 8));
569568
}
570569
if (isNegative) {
571570
value = -value;
@@ -592,14 +591,11 @@ function getUint64BigIntFallback(index, values) {
592591
const byteOffset = index * 8;
593592

594593
// Split 64-bit number into two 32-bit (4-byte) parts
595-
// eslint-disable-next-line no-undef
596594
const left = BigInt(dataView.getUint32(byteOffset, true));
597595

598-
// eslint-disable-next-line no-undef
599596
const right = BigInt(dataView.getUint32(byteOffset + 4, true));
600597

601598
// Combine the two 32-bit values
602-
// eslint-disable-next-line no-undef
603599
const value = left + BigInt(4294967296) * right;
604600

605601
return value;
@@ -770,15 +766,14 @@ function BufferView(bufferView, componentType, length) {
770766
return getInt64BigIntFallback(index, that);
771767
};
772768
} else {
773-
// eslint-disable-next-line
774769
typedArray = new BigInt64Array(
775770
bufferView.buffer,
776771
bufferView.byteOffset,
777772
length,
778773
);
779774
setFunction = function (index, value) {
780775
// Convert the number to a BigInt before setting the value in the typed array
781-
that.typedArray[index] = BigInt(value); // eslint-disable-line
776+
that.typedArray[index] = BigInt(value);
782777
};
783778
}
784779
} else if (componentType === MetadataComponentType.UINT64) {
@@ -804,15 +799,14 @@ function BufferView(bufferView, componentType, length) {
804799
return getUint64BigIntFallback(index, that);
805800
};
806801
} else {
807-
// eslint-disable-next-line
808802
typedArray = new BigUint64Array(
809803
bufferView.buffer,
810804
bufferView.byteOffset,
811805
length,
812806
);
813807
setFunction = function (index, value) {
814808
// Convert the number to a BigInt before setting the value in the typed array
815-
that.typedArray[index] = BigInt(value); // eslint-disable-line
809+
that.typedArray[index] = BigInt(value);
816810
};
817811
}
818812
} else {

0 commit comments

Comments
 (0)