Skip to content

Commit 96efa0f

Browse files
stepankuzmingithub-actions[bot]
authored andcommitted
Enable more e18e rules
GitOrigin-RevId: 759e02a67c5364a669dab878bde3b22fe77a1148
1 parent 6be54fc commit 96efa0f

57 files changed

Lines changed: 179 additions & 224 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3d-style/data/bucket/building_bucket.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ export class BuildingBucket implements BucketWithGroundEffect {
504504
continue;
505505

506506
let buildingId: number | null = null;
507-
if (feature.properties && feature.properties.hasOwnProperty('building_id')) {
507+
if (feature.properties && Object.hasOwn(feature.properties, 'building_id')) {
508508
buildingId = Number(feature.properties['building_id']);
509509
if (disabledBuildings.has(buildingId)) {
510510
continue;
@@ -1473,7 +1473,7 @@ export class BuildingBucket implements BucketWithGroundEffect {
14731473
// We use a lookup table to cache the results of the footprint search
14741474
// to avoid searching through all footprints for every tile coordinate.
14751475
const lookupKey = (x + EXTENT) * 4 * EXTENT + (y + EXTENT);
1476-
if (this.footprintLookup.hasOwnProperty(lookupKey)) {
1476+
if (Object.hasOwn(this.footprintLookup, lookupKey)) {
14771477
const footprint = this.footprintLookup[lookupKey];
14781478
return footprint ? {height: footprint.height, hidden: footprint.hiddenFlags !== BUILDING_VISIBLE} : undefined;
14791479
}

3d-style/data/bucket/model_bucket.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class ModelBucket implements Bucket {
243243
for (const {feature, id, index, sourceLayerIndex} of features) {
244244
// use non numeric id, if in properties, too.
245245
const featureId = (id != null) ? id :
246-
(feature.properties && feature.properties.hasOwnProperty("id")) ? feature.properties["id"] : undefined;
246+
(feature.properties && Object.hasOwn(feature.properties, "id")) ? feature.properties["id"] : undefined;
247247
const evaluationFeature = toEvaluationFeature(feature, needGeometry);
248248

249249
if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom, {worldview: this.worldview, activeFloors: options.activeFloors}), evaluationFeature, canonical))
@@ -305,7 +305,7 @@ class ModelBucket implements Bucket {
305305
for (const modelId in this.instancesPerModel) {
306306
const instances: PerModelAttributes = this.instancesPerModel[modelId];
307307
for (const id in states) {
308-
if (instances.idToFeaturesIndex.hasOwnProperty(id)) {
308+
if (Object.hasOwn(instances.idToFeaturesIndex, id)) {
309309
const feature = instances.features[instances.idToFeaturesIndex[id]];
310310
this.evaluate(feature, states[id], instances, true);
311311
this.uploaded = false;

3d-style/data/bucket/tiled_3d_model_bucket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ class Tiled3dModelBucket implements Bucket {
593593
for (const nodeInfo of this.getNodesInfo()) {
594594
const footprint = nodeInfo.node.footprint;
595595
// Node is visible if its footprint passes the replacement check
596-
nodeInfo.hiddenByReplacement = !!footprint && !activeReplacements.find(region => region.footprint === footprint);
596+
nodeInfo.hiddenByReplacement = !!footprint && !activeReplacements.some(region => region.footprint === footprint);
597597
}
598598
}
599599

3d-style/elevation/elevated_structures.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,9 @@ export class ElevatedStructures {
288288
}
289289
// Each edge of the exterior ring is a potential portal
290290
const exterior = polygon[0];
291-
assert(exterior.length > 1 && pointsEqual(exterior[0], exterior[exterior.length - 1]));
291+
assert(exterior.length > 1 && pointsEqual(exterior[0], exterior.at(-1)));
292292

293-
let prevEdgeHash = ElevatedStructures.computeEdgeHash(exterior[exterior.length - 2], exterior[exterior.length - 1]);
293+
let prevEdgeHash = ElevatedStructures.computeEdgeHash(exterior[exterior.length - 2], exterior.at(-1));
294294

295295
for (let i = 0; i < exterior.length - 1; i++) {
296296
const a = exterior[i + 0];

3d-style/elevation/elevation_feature_parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class PropertyParser {
6969
}
7070

7171
private get(name: string, required, setter: Setter, convert?: Convert): PropertyParser {
72-
const value = this.feature.properties.hasOwnProperty(name) ? +this.feature.properties[name] : undefined;
72+
const value = Object.hasOwn(this.feature.properties, name) ? +this.feature.properties[name] : undefined;
7373
if (this._valid && value !== undefined && !Number.isNaN(value)) {
7474
if (convert) {
7575
setter(convert(value));

3d-style/render/draw_model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ function drawVectorLayerModels(painter: Painter, source: SourceCache, layer: Mod
781781
layer.modelManager = modelManager;
782782
const shadowRenderer = painter.shadowRenderer;
783783

784-
if (!layer._unevaluatedLayout._values.hasOwnProperty('model-id')) { return; }
784+
if (!Object.hasOwn(layer._unevaluatedLayout._values, 'model-id')) { return; }
785785

786786
const modelIdUnevaluatedProperty = layer._unevaluatedLayout._values['model-id'];
787787

3d-style/render/shadow_renderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ export class ShadowRenderer {
525525
const meterInTiles = tileToMeter(unwrappedTileID.canonical);
526526
const texelScale = 2.0 / transform.tileSize * EXTENT / this._shadowParameters.shadowMapResolution;
527527
const shadowTexelInTileCoords0 = texelScale * this._cascades[0].boundingSphereRadius;
528-
const shadowTexelInTileCoords1 = texelScale * this._cascades[this._cascades.length - 1].boundingSphereRadius;
528+
const shadowTexelInTileCoords1 = texelScale * this._cascades.at(-1).boundingSphereRadius;
529529
// Instanced model tiles could have smoothened (shared among neighbor faces) normals. Normal is not surface normal
530530
// and this is why it is needed to increase the offset. 3.0 in case of model-tile could be alternatively replaced by
531531
// 2.0 if normal would not get scaled by dotScale in shadow_normal_offset().

3d-style/source/model_loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ function parseLegacyFootprintMesh(gltfNode: GLTFNode): FootprintMesh | null | un
377377
return null;
378378
}
379379

380-
if (vertices.length > 1 && vertices[vertices.length - 1].equals(vertices[0])) {
380+
if (vertices.length > 1 && vertices.at(-1).equals(vertices[0])) {
381381
vertices.pop();
382382
}
383383

3d-style/source/model_source.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class ModelSource extends Evented<SourceEvents> implements ISource {
202202
orientation: [0, 0, 0]
203203
};
204204

205-
if (value.hasOwnProperty('orientation')) {
205+
if (Object.hasOwn(value, 'orientation')) {
206206
const orientation = value['orientation'] as Float32Array;
207207
if (orientation) {
208208
nodeOverride.orientation = orientation;

3d-style/style/style_layer/model_style_layer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ class ModelStyleLayer extends StyleLayer {
181181
for (const modelId in bucket.instancesPerModel) {
182182
const instances = bucket.instancesPerModel[modelId];
183183
const featureId = feature.id !== undefined ? feature.id :
184-
(feature.properties && feature.properties.hasOwnProperty("id")) ? (feature.properties["id"] as string | number) : undefined;
185-
if (instances.idToFeaturesIndex.hasOwnProperty(featureId)) {
184+
(feature.properties && Object.hasOwn(feature.properties, "id")) ? (feature.properties["id"] as string | number) : undefined;
185+
if (Object.hasOwn(instances.idToFeaturesIndex, featureId)) {
186186
const modelFeature = instances.features[instances.idToFeaturesIndex[featureId]];
187187
const model = modelManager.getModel(modelId, scope || this.scope);
188188
if (!model) return false;

0 commit comments

Comments
 (0)