Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce semicolons as member delimters #282

Merged
merged 1 commit into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"warn",
{ "argsIgnorePattern": "^_" }
],
"@typescript-eslint/member-delimiter-style": ["error"],
// Disable no-undef. It's covered by @typescript-eslint
"no-undef": "off",
// temporarily disabled due to https://github.com/babel/babel-eslint/issues/485
Expand Down
58 changes: 29 additions & 29 deletions src/data/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,46 @@ import type {CanonicalTileID} from '../source/tile_id';
import Point from '../symbol/point';

export type BucketParameters<Layer extends TypedStyleLayer> = {
index: number,
layers: Array<Layer>,
zoom: number,
pixelRatio: number,
overscaling: number,
collisionBoxArray: CollisionBoxArray,
sourceLayerIndex: number,
sourceID: string
index: number;
layers: Array<Layer>;
zoom: number;
pixelRatio: number;
overscaling: number;
collisionBoxArray: CollisionBoxArray;
sourceLayerIndex: number;
sourceID: string;
};

export type PopulateParameters = {
featureIndex: FeatureIndex,
iconDependencies: {},
patternDependencies: {},
glyphDependencies: {},
availableImages: Array<string>
featureIndex: FeatureIndex;
iconDependencies: {};
patternDependencies: {};
glyphDependencies: {};
availableImages: Array<string>;
};

export type IndexedFeature = {
feature: VectorTileFeature,
id: number | string,
index: number,
sourceLayerIndex: number
feature: VectorTileFeature;
id: number | string;
index: number;
sourceLayerIndex: number;
};

export type BucketFeature = {
index: number,
sourceLayerIndex: number,
geometry: Array<Array<Point>>,
properties: any,
type: 1 | 2 | 3,
id?: any,
index: number;
sourceLayerIndex: number;
geometry: Array<Array<Point>>;
properties: any;
type: 1 | 2 | 3;
id?: any;
readonly patterns: {
[_: string]: {
"min": string,
"mid": string,
"max": string
}
},
sortKey?: number
"min": string;
"mid": string;
"max": string;
};
};
sortKey?: number;
};

/**
Expand Down
6 changes: 3 additions & 3 deletions src/data/bucket/fill_bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ class FillBucket implements Bucket {
}

update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {
[_: string]: ImagePosition
[_: string]: ImagePosition;
}) {
if (!this.stateDependentLayers.length) return;
this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions);
}

addFeatures(options: PopulateParameters, canonical: CanonicalTileID, imagePositions: {
[_: string]: ImagePosition
[_: string]: ImagePosition;
}) {
for (const feature of this.patternFeatures) {
this.addFeature(feature, feature.geometry, feature.index, canonical, imagePositions);
Expand Down Expand Up @@ -167,7 +167,7 @@ class FillBucket implements Bucket {
}

addFeature(feature: BucketFeature, geometry: Array<Array<Point>>, index: number, canonical: CanonicalTileID, imagePositions: {
[_: string]: ImagePosition
[_: string]: ImagePosition;
}) {
for (const polygon of classifyRings(geometry, EARCUT_MAX_RINGS)) {
let numVertices = 0;
Expand Down
10 changes: 5 additions & 5 deletions src/data/bucket/line_bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ const LINE_DISTANCE_SCALE = 1 / 2;
const MAX_LINE_DISTANCE = Math.pow(2, LINE_DISTANCE_BUFFER_BITS - 1) / LINE_DISTANCE_SCALE;

type LineClips = {
start: number,
end: number
start: number;
end: number;
};

type GradientTexture = {
texture?: Texture,
gradient?: RGBAImage,
version?: number
texture?: Texture;
gradient?: RGBAImage;
version?: number;
};

/**
Expand Down
56 changes: 28 additions & 28 deletions src/data/bucket/symbol_bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,41 +58,41 @@ import type {FeatureStates} from '../../source/source_state';
import type {ImagePosition} from '../../render/image_atlas';

export type SingleCollisionBox = {
x1: number,
y1: number,
x2: number,
y2: number,
anchorPointX: number,
anchorPointY: number
x1: number;
y1: number;
x2: number;
y2: number;
anchorPointX: number;
anchorPointY: number;
};

export type CollisionArrays = {
textBox?: SingleCollisionBox,
verticalTextBox?: SingleCollisionBox,
iconBox?: SingleCollisionBox,
verticalIconBox?: SingleCollisionBox,
textFeatureIndex?: number,
verticalTextFeatureIndex?: number,
iconFeatureIndex?: number,
verticalIconFeatureIndex?: number
textBox?: SingleCollisionBox;
verticalTextBox?: SingleCollisionBox;
iconBox?: SingleCollisionBox;
verticalIconBox?: SingleCollisionBox;
textFeatureIndex?: number;
verticalTextFeatureIndex?: number;
iconFeatureIndex?: number;
verticalIconFeatureIndex?: number;
};

export type SymbolFeature = {
sortKey: number | void,
text: Formatted | void,
icon: ResolvedImage | undefined | null,
index: number,
sourceLayerIndex: number,
geometry: Array<Array<Point>>,
properties: any,
type: 'Point' | 'LineString' | 'Polygon',
id?: any
sortKey: number | void;
text: Formatted | void;
icon: ResolvedImage | undefined | null;
index: number;
sourceLayerIndex: number;
geometry: Array<Array<Point>>;
properties: any;
type: 'Point' | 'LineString' | 'Polygon';
id?: any;
};

export type SortKeyRange = {
sortKey: number,
symbolInstanceStart: number,
symbolInstanceEnd: number
sortKey: number;
symbolInstanceStart: number;
symbolInstanceEnd: number;
};

// Opacity arrays are frequently updated but don't contain a lot of information, so we pack them
Expand Down Expand Up @@ -243,11 +243,11 @@ class CollisionBuffers {
collisionVertexBuffer: VertexBuffer;

constructor(LayoutArray: {
new (...args: any): StructArray
new (...args: any): StructArray;
},
layoutAttributes: Array<StructArrayMember>,
IndexArray: {
new (...args: any): TriangleIndexArray | LineIndexArray
new (...args: any): TriangleIndexArray | LineIndexArray;
}) {
this.layoutVertexArray = new LayoutArray();
this.layoutAttributes = layoutAttributes;
Expand Down
18 changes: 9 additions & 9 deletions src/data/evaluation_feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import loadGeometry from './load_geometry';
import type Point from '../symbol/point';

type EvaluationFeature = {
readonly type: 1 | 2 | 3 | "Unknown" | "Point" | "MultiPoint" | "LineString" | "MultiLineString" | "Polygon" | "MultiPolygon",
readonly id?: any,
readonly properties: {[_: string]: any},
readonly type: 1 | 2 | 3 | "Unknown" | "Point" | "MultiPoint" | "LineString" | "MultiLineString" | "Polygon" | "MultiPolygon";
readonly id?: any;
readonly properties: {[_: string]: any};
readonly patterns?: {
[_: string]: {
"min": string,
"mid": string,
"max": string
}
},
geometry: Array<Array<Point>>
"min": string;
"mid": string;
"max": string;
};
};
geometry: Array<Array<Point>>;
};

/**
Expand Down
34 changes: 17 additions & 17 deletions src/data/feature_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ import type {FilterSpecification, PromoteIdSpecification} from '../style-spec/ty
import type {FeatureState} from '../style-spec/expression';

type QueryParameters = {
scale: number,
pixelPosMatrix: mat4,
transform: Transform,
tileSize: number,
queryGeometry: Array<Point>,
cameraQueryGeometry: Array<Point>,
queryPadding: number,
scale: number;
pixelPosMatrix: mat4;
transform: Transform;
tileSize: number;
queryGeometry: Array<Point>;
cameraQueryGeometry: Array<Point>;
queryPadding: number;
params: {
filter: FilterSpecification,
layers: Array<string>,
availableImages: Array<string>
}
filter: FilterSpecification;
layers: Array<string>;
availableImages: Array<string>;
};
};

class FeatureIndex {
Expand Down Expand Up @@ -107,10 +107,10 @@ class FeatureIndex {
styleLayers: {[_: string]: StyleLayer},
serializedLayers: {[_: string]: any},
sourceFeatureState: SourceFeatureState
): {[_: string]: Array<{featureIndex: number, feature: GeoJSONFeature}>} {
): {[_: string]: Array<{featureIndex: number; feature: GeoJSONFeature}>} {
this.loadVTLayers();

const params = args.params || {} as { filter: any, layers: string[], availableImages: string[] },
const params = args.params || {} as { filter: any; layers: string[]; availableImages: string[] },
pixelsToTileUnits = EXTENT / args.tileSize / args.scale,
filter = featureFilter(params.filter);

Expand Down Expand Up @@ -171,10 +171,10 @@ class FeatureIndex {
loadMatchingFeature(
result: {
[_: string]: Array<{
featureIndex: number,
feature: GeoJSONFeature,
intersectionZ?: boolean | number
}>
featureIndex: number;
feature: GeoJSONFeature;
intersectionZ?: boolean | number;
}>;
},
bucketIndex: number,
sourceLayerIndex: number,
Expand Down
10 changes: 5 additions & 5 deletions src/data/feature_position_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import {register} from '../util/web_worker_transfer';
import assert from 'assert';

type SerializedFeaturePositionMap = {
ids: Float64Array,
positions: Uint32Array
ids: Float64Array;
positions: Uint32Array;
};

type FeaturePosition = {
index: number,
start: number,
end: number
index: number;
start: number;
end: number;
};

// A transferable data structure that maps feature ids to their indices and buffer offsets
Expand Down
12 changes: 6 additions & 6 deletions src/data/program_configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import type {FeatureStates} from '../source/source_state';
import type {FormattedSection} from '../style-spec/expression/types/formatted';

export type BinderUniform = {
name: string,
property: string,
binding: Uniform<any>
name: string;
property: string;
binding: Uniform<any>;
};

function packColor(color: Color): [number, number] {
Expand Down Expand Up @@ -174,7 +174,7 @@ class SourceExpressionBinder implements AttributeBinder {
paintVertexBuffer: VertexBuffer | undefined | null;

constructor(expression: SourceExpression, names: Array<string>, type: string, PaintVertexArray: {
new (...args: any): StructArray
new (...args: any): StructArray;
}) {
this.expression = expression;
this.type = type;
Expand Down Expand Up @@ -244,7 +244,7 @@ class CompositeExpressionBinder implements AttributeBinder, UniformBinder {
paintVertexBuffer: VertexBuffer | undefined | null;

constructor(expression: CompositeExpression, names: Array<string>, type: string, useIntegerZoom: boolean, zoom: number, PaintVertexArray: {
new (...args: any): StructArray
new (...args: any): StructArray;
}) {
this.expression = expression;
this.uniformNames = names.map(name => `u_${name}_t`);
Expand Down Expand Up @@ -331,7 +331,7 @@ class CrossFadedCompositeBinder implements AttributeBinder {
paintVertexAttributes: Array<StructArrayMember>;

constructor(expression: CompositeExpression, type: string, useIntegerZoom: boolean, zoom: number, PaintVertexArray: {
new (...args: any): StructArray
new (...args: any): StructArray;
}, layerId: string) {
this.expression = expression;
this.type = type;
Expand Down
12 changes: 6 additions & 6 deletions src/data/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import type VertexArrayObject from '../render/vertex_array_object';
import type {StructArray} from '../util/struct_array';

export type Segment = {
sortKey?: number,
vertexOffset: number,
primitiveOffset: number,
vertexLength: number,
primitiveLength: number,
vaos: {[_: string]: VertexArrayObject}
sortKey?: number;
vertexOffset: number;
primitiveOffset: number;
vertexLength: number;
primitiveLength: number;
vaos: {[_: string]: VertexArrayObject};
};

class SegmentVector {
Expand Down
8 changes: 4 additions & 4 deletions src/geo/edge_insets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ class EdgeInsets {
}

export type PaddingOptions = {
top: number | undefined | null,
bottom: number | undefined | null,
right: number | undefined | null,
left: number | undefined | null
top: number | undefined | null;
bottom: number | undefined | null;
right: number | undefined | null;
left: number | undefined | null;
};

export default EdgeInsets;
Loading