@mapbox/mapbox-gl-style-spec 14.14.0-beta.2 → 14.15.0-alpha.ffa987fef46

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.
Files changed (44) hide show
  1. package/composite.ts +5 -8
  2. package/dist/index.cjs +53 -27
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts +48 -24
  5. package/dist/index.es.js +53 -27
  6. package/dist/index.es.js.map +1 -1
  7. package/expression/compound_expression.ts +1 -1
  8. package/expression/definitions/config.ts +1 -1
  9. package/expression/definitions/distance.ts +2 -3
  10. package/expression/definitions/image.ts +1 -1
  11. package/expression/definitions/index.ts +4 -20
  12. package/expression/definitions/interpolate.ts +6 -9
  13. package/expression/definitions/within.ts +14 -15
  14. package/expression/evaluation_context.ts +3 -1
  15. package/expression/index.ts +18 -11
  16. package/expression/parsing_context.ts +7 -3
  17. package/group_by_layout.ts +3 -6
  18. package/migrate.ts +6 -8
  19. package/package.json +1 -1
  20. package/read_style.ts +1 -2
  21. package/reference/v8.json +26 -0
  22. package/types.ts +35 -13
  23. package/util/geometry_util.ts +1 -2
  24. package/validate/validate.ts +5 -6
  25. package/validate/validate_array.ts +2 -2
  26. package/validate/validate_enum.ts +2 -2
  27. package/validate/validate_expression.ts +1 -2
  28. package/validate/validate_filter.ts +3 -4
  29. package/validate/validate_fog.ts +2 -5
  30. package/validate/validate_function.ts +6 -10
  31. package/validate/validate_iconset.ts +1 -2
  32. package/validate/validate_layer.ts +1 -2
  33. package/validate/validate_light.ts +1 -4
  34. package/validate/validate_lights.ts +1 -7
  35. package/validate/validate_model.ts +1 -4
  36. package/validate/validate_projection.ts +1 -2
  37. package/validate/validate_property.ts +3 -7
  38. package/validate/validate_rain.ts +1 -4
  39. package/validate/validate_snow.ts +1 -4
  40. package/validate/validate_source.ts +2 -3
  41. package/validate/validate_terrain.ts +1 -5
  42. package/validate_mapbox_api_supported.ts +2 -4
  43. package/validate_style.ts +1 -2
  44. package/visit.ts +2 -4
package/types.ts CHANGED
@@ -382,6 +382,12 @@ export type SelectorPropertySpecification = {
382
382
  [_: string]: unknown
383
383
  };
384
384
 
385
+ export type AppearanceSpecification = {
386
+ "condition"?: ExpressionSpecification,
387
+ "name"?: string,
388
+ "properties"?: unknown
389
+ };
390
+
385
391
  export type VectorSourceSpecification = {
386
392
  "type": "vector",
387
393
  "url"?: string,
@@ -627,7 +633,8 @@ export type FillLayerSpecification = {
627
633
  "fill-tunnel-structure-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>,
628
634
  "fill-tunnel-structure-color-transition"?: TransitionSpecification,
629
635
  "fill-tunnel-structure-color-use-theme"?: PropertyValueSpecification<string>
630
- }
636
+ },
637
+ "appearances"?: Array<AppearanceSpecification>
631
638
  };
632
639
 
633
640
  /**
@@ -716,7 +723,8 @@ export type LineLayerSpecification = {
716
723
  "line-border-color-use-theme"?: PropertyValueSpecification<string>,
717
724
  "line-occlusion-opacity"?: PropertyValueSpecification<number>,
718
725
  "line-occlusion-opacity-transition"?: TransitionSpecification
719
- }
726
+ },
727
+ "appearances"?: Array<AppearanceSpecification>
720
728
  };
721
729
 
722
730
  /**
@@ -762,6 +770,7 @@ export type SymbolLayerSpecification = {
762
770
  "icon-text-fit"?: DataDrivenPropertyValueSpecification<"none" | "width" | "height" | "both">,
763
771
  "icon-text-fit-padding"?: DataDrivenPropertyValueSpecification<[number, number, number, number]>,
764
772
  "icon-image"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>,
773
+ "icon-image-use-theme"?: PropertyValueSpecification<string>,
765
774
  "icon-rotate"?: DataDrivenPropertyValueSpecification<number>,
766
775
  "icon-padding"?: PropertyValueSpecification<number>,
767
776
  "icon-keep-upright"?: PropertyValueSpecification<boolean>,
@@ -845,7 +854,8 @@ export type SymbolLayerSpecification = {
845
854
  */
846
855
  "symbol-z-offset"?: DataDrivenPropertyValueSpecification<number>,
847
856
  "symbol-z-offset-transition"?: TransitionSpecification
848
- }
857
+ },
858
+ "appearances"?: Array<AppearanceSpecification>
849
859
  };
850
860
 
851
861
  /**
@@ -900,7 +910,8 @@ export type CircleLayerSpecification = {
900
910
  "circle-stroke-opacity-transition"?: TransitionSpecification,
901
911
  "circle-emissive-strength"?: PropertyValueSpecification<number>,
902
912
  "circle-emissive-strength-transition"?: TransitionSpecification
903
- }
913
+ },
914
+ "appearances"?: Array<AppearanceSpecification>
904
915
  };
905
916
 
906
917
  /**
@@ -936,7 +947,8 @@ export type HeatmapLayerSpecification = {
936
947
  "heatmap-color-use-theme"?: PropertyValueSpecification<string>,
937
948
  "heatmap-opacity"?: PropertyValueSpecification<number>,
938
949
  "heatmap-opacity-transition"?: TransitionSpecification
939
- }
950
+ },
951
+ "appearances"?: Array<AppearanceSpecification>
940
952
  };
941
953
 
942
954
  /**
@@ -1053,7 +1065,8 @@ export type FillExtrusionLayerSpecification = {
1053
1065
  "fill-extrusion-line-width"?: DataDrivenPropertyValueSpecification<number>,
1054
1066
  "fill-extrusion-line-width-transition"?: TransitionSpecification,
1055
1067
  "fill-extrusion-cast-shadows"?: boolean
1056
- }
1068
+ },
1069
+ "appearances"?: Array<AppearanceSpecification>
1057
1070
  };
1058
1071
 
1059
1072
  /**
@@ -1154,7 +1167,8 @@ export type BuildingLayerSpecification = {
1154
1167
  */
1155
1168
  "building-facade-emissive-chance"?: PropertyValueSpecification<number>,
1156
1169
  "building-cutoff-fade-range"?: ExpressionSpecification
1157
- }
1170
+ },
1171
+ "appearances"?: Array<AppearanceSpecification>
1158
1172
  };
1159
1173
 
1160
1174
  /**
@@ -1212,7 +1226,8 @@ export type RasterLayerSpecification = {
1212
1226
  */
1213
1227
  "raster-elevation"?: PropertyValueSpecification<number>,
1214
1228
  "raster-elevation-transition"?: TransitionSpecification
1215
- }
1229
+ },
1230
+ "appearances"?: Array<AppearanceSpecification>
1216
1231
  };
1217
1232
 
1218
1233
  /**
@@ -1251,7 +1266,8 @@ export type RasterParticleLayerSpecification = {
1251
1266
  "raster-particle-reset-rate-factor"?: number,
1252
1267
  "raster-particle-elevation"?: PropertyValueSpecification<number>,
1253
1268
  "raster-particle-elevation-transition"?: TransitionSpecification
1254
- }
1269
+ },
1270
+ "appearances"?: Array<AppearanceSpecification>
1255
1271
  };
1256
1272
 
1257
1273
  /**
@@ -1293,7 +1309,8 @@ export type HillshadeLayerSpecification = {
1293
1309
  "hillshade-accent-color-use-theme"?: PropertyValueSpecification<string>,
1294
1310
  "hillshade-emissive-strength"?: PropertyValueSpecification<number>,
1295
1311
  "hillshade-emissive-strength-transition"?: TransitionSpecification
1296
- }
1312
+ },
1313
+ "appearances"?: Array<AppearanceSpecification>
1297
1314
  };
1298
1315
 
1299
1316
  /**
@@ -1347,7 +1364,8 @@ export type ModelLayerSpecification = {
1347
1364
  "model-height-based-emissive-strength-multiplier-transition"?: TransitionSpecification,
1348
1365
  "model-cutoff-fade-range"?: ExpressionSpecification,
1349
1366
  "model-front-cutoff"?: PropertyValueSpecification<[number, number, number]>
1350
- }
1367
+ },
1368
+ "appearances"?: Array<AppearanceSpecification>
1351
1369
  };
1352
1370
 
1353
1371
  /**
@@ -1386,7 +1404,8 @@ export type BackgroundLayerSpecification = {
1386
1404
  "background-opacity-transition"?: TransitionSpecification,
1387
1405
  "background-emissive-strength"?: PropertyValueSpecification<number>,
1388
1406
  "background-emissive-strength-transition"?: TransitionSpecification
1389
- }
1407
+ },
1408
+ "appearances"?: Array<AppearanceSpecification>
1390
1409
  };
1391
1410
 
1392
1411
  /**
@@ -1426,7 +1445,8 @@ export type SkyLayerSpecification = {
1426
1445
  "sky-atmosphere-color-use-theme"?: PropertyValueSpecification<string>,
1427
1446
  "sky-opacity"?: PropertyValueSpecification<number>,
1428
1447
  "sky-opacity-transition"?: TransitionSpecification
1429
- }
1448
+ },
1449
+ "appearances"?: Array<AppearanceSpecification>
1430
1450
  };
1431
1451
 
1432
1452
  /**
@@ -1449,6 +1469,7 @@ export type SlotLayerSpecification = {
1449
1469
  "minzoom"?: never,
1450
1470
  "maxzoom"?: never,
1451
1471
  "filter"?: never,
1472
+ "appearances"?: Array<AppearanceSpecification>,
1452
1473
  "layout"?: never,
1453
1474
  "paint"?: never
1454
1475
  };
@@ -1467,6 +1488,7 @@ export type ClipLayerSpecification = {
1467
1488
  "clip-layer-types"?: ExpressionSpecification,
1468
1489
  "clip-layer-scope"?: ExpressionSpecification
1469
1490
  },
1491
+ "appearances"?: Array<AppearanceSpecification>,
1470
1492
  "paint"?: never
1471
1493
  };
1472
1494
 
@@ -31,7 +31,7 @@ export function classifyRings(rings: Array<Ring>, maxRings: number): Array<Array
31
31
 
32
32
  if (len <= 1) return [rings];
33
33
 
34
- const polygons = [];
34
+ const polygons: Array<Array<Ring>> = [];
35
35
  let polygon,
36
36
  ccw;
37
37
 
@@ -63,7 +63,6 @@ export function classifyRings(rings: Array<Ring>, maxRings: number): Array<Array
63
63
  }
64
64
  }
65
65
 
66
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
67
66
  return polygons;
68
67
  }
69
68
 
@@ -30,10 +30,8 @@ import type {StyleReference} from '../reference/latest';
30
30
  import type {StyleSpecification} from '../types';
31
31
  import type ValidationError from '../error/validation_error';
32
32
 
33
- const VALIDATORS = {
34
- '*'() {
35
- return [];
36
- },
33
+ const VALIDATORS: Record<string, (unknown) => ValidationError[]> = {
34
+ '*': () => [],
37
35
  'array': validateArray,
38
36
  'boolean': validateBoolean,
39
37
  'number': validateNumber,
@@ -79,6 +77,9 @@ export type ValidationOptions = {
79
77
  objectKey?: string;
80
78
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
81
79
  objectElementValidators?: Record<string, (...args: any[]) => Array<ValidationError>>;
80
+ propertyKey?: string
81
+ propertyType?: string
82
+ expressionContext?: 'property';
82
83
  };
83
84
 
84
85
  export default function validate(options: ValidationOptions, arrayAsExpression: boolean = false): Array<ValidationError> {
@@ -87,7 +88,6 @@ export default function validate(options: ValidationOptions, arrayAsExpression:
87
88
  const styleSpec = options.styleSpec;
88
89
 
89
90
  if (valueSpec.expression && isFunction(unbundle(value))) {
90
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
91
91
  return validateFunction(options);
92
92
  } else if (valueSpec.expression && isExpression(deepUnbundle(value))) {
93
93
  return validateExpression(options);
@@ -97,7 +97,6 @@ export default function validate(options: ValidationOptions, arrayAsExpression:
97
97
  // Try to validate as an expression
98
98
  return validateExpression(options);
99
99
  } else {
100
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
101
100
  return valid;
102
101
  }
103
102
  } else {
@@ -45,7 +45,7 @@ export default function validateArray(options: Options): Array<ValidationError>
45
45
  arrayElementSpec = arraySpec.value;
46
46
  }
47
47
 
48
- let errors = [];
48
+ let errors: ValidationError[] = [];
49
49
  for (let i = 0; i < array.length; i++) {
50
50
  errors = errors.concat(validateArrayElement({
51
51
  array,
@@ -57,6 +57,6 @@ export default function validateArray(options: Options): Array<ValidationError>
57
57
  key: `${key}[${i}]`
58
58
  }, true));
59
59
  }
60
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
60
+
61
61
  return errors;
62
62
  }
@@ -7,7 +7,7 @@ export default function validateEnum(options: ValidationOptions): Array<Validati
7
7
  const key = options.key;
8
8
  const value = options.value;
9
9
  const valueSpec = options.valueSpec;
10
- const errors = [];
10
+ const errors: ValidationError[] = [];
11
11
 
12
12
  if (Array.isArray(valueSpec.values)) { // <=v7
13
13
  if (valueSpec.values.indexOf(unbundle(value)) === -1) {
@@ -18,6 +18,6 @@ export default function validateEnum(options: ValidationOptions): Array<Validati
18
18
  errors.push(new ValidationError(key, value, `expected one of [${Object.keys(valueSpec.values).join(', ')}], ${JSON.stringify(value)} found`));
19
19
  }
20
20
  }
21
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
21
+
22
22
  return errors;
23
23
  }
@@ -62,7 +62,7 @@ export function disallowedFilterParameters(e: Expression, options: any): Array<V
62
62
  if (disallowedParameters.size === 0) {
63
63
  return [];
64
64
  }
65
- const errors = [];
65
+ const errors: ValidationError[] = [];
66
66
 
67
67
  if (e instanceof CompoundExpression) {
68
68
  if (disallowedParameters.has(e.name)) {
@@ -73,6 +73,5 @@ export function disallowedFilterParameters(e: Expression, options: any): Array<V
73
73
  errors.push(...disallowedFilterParameters(arg, options));
74
74
  });
75
75
 
76
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
77
76
  return errors;
78
77
  }
@@ -26,12 +26,11 @@ export default function validateFilter(options: Options): Array<ValidationError>
26
26
  valueSpec: options.styleSpec[`filter_${layerType}`]
27
27
  }));
28
28
  } else {
29
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
30
29
  return validateNonExpressionFilter(options);
31
30
  }
32
31
  }
33
32
 
34
- function validateNonExpressionFilter(options: Options) {
33
+ function validateNonExpressionFilter(options: Options): ValidationError[] {
35
34
  const value = options.value;
36
35
  const key = options.key;
37
36
 
@@ -42,7 +41,7 @@ function validateNonExpressionFilter(options: Options) {
42
41
  const styleSpec = options.styleSpec;
43
42
  let type;
44
43
 
45
- let errors = [];
44
+ let errors: ValidationError[] = [];
46
45
 
47
46
  if (value.length < 1) {
48
47
  return [new ValidationError(key, value, 'filter array must have at least 1 element')];
@@ -120,6 +119,6 @@ function validateNonExpressionFilter(options: Options) {
120
119
  }
121
120
  break;
122
121
  }
123
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
122
+
124
123
  return errors;
125
124
  }
@@ -4,20 +4,18 @@ import getType from '../util/get_type';
4
4
 
5
5
  import type {ValidationOptions} from './validate';
6
6
 
7
- export default function validateFog(options: ValidationOptions): Array<ValidationError> {
7
+ export default function validateFog(options: ValidationOptions): ValidationError[] {
8
8
  const fog = options.value;
9
9
  const style = options.style;
10
10
  const styleSpec = options.styleSpec;
11
11
  const fogSpec = styleSpec.fog;
12
- let errors = [];
12
+ let errors: ValidationError[] = [];
13
13
 
14
14
  const rootType = getType(fog);
15
15
  if (fog === undefined) {
16
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
17
16
  return errors;
18
17
  } else if (rootType !== 'object') {
19
18
  errors = errors.concat([new ValidationError('fog', fog, `object expected, ${rootType} found`)]);
20
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
21
19
  return errors;
22
20
  }
23
21
 
@@ -54,6 +52,5 @@ export default function validateFog(options: ValidationOptions): Array<Validatio
54
52
  }
55
53
  }
56
54
 
57
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
58
55
  return errors;
59
56
  }
@@ -14,8 +14,7 @@ import {
14
14
 
15
15
  import type {ValidationOptions} from './validate';
16
16
 
17
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
- export default function validateFunction(options: ValidationOptions): any {
17
+ export default function validateFunction(options: ValidationOptions): ValidationError[] {
19
18
  const functionValueSpec = options.valueSpec;
20
19
  const functionType = unbundle(options.value.type);
21
20
  let stopKeyType;
@@ -68,12 +67,12 @@ export default function validateFunction(options: ValidationOptions): any {
68
67
 
69
68
  return errors;
70
69
 
71
- function validateFunctionStops(options: ValidationOptions) {
70
+ function validateFunctionStops(options: ValidationOptions): ValidationError[] {
72
71
  if (functionType === 'identity') {
73
72
  return [new ValidationError(options.key, options.value, 'identity function may not have a "stops" property')];
74
73
  }
75
74
 
76
- let errors = [];
75
+ let errors: ValidationError[] = [];
77
76
  const value = options.value;
78
77
 
79
78
  errors = errors.concat(validateArray({
@@ -89,12 +88,11 @@ export default function validateFunction(options: ValidationOptions): any {
89
88
  errors.push(new ValidationError(options.key, value, 'array must have at least one stop'));
90
89
  }
91
90
 
92
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
93
91
  return errors;
94
92
  }
95
93
 
96
- function validateFunctionStop(options: ValidationOptions) {
97
- let errors = [];
94
+ function validateFunctionStop(options: ValidationOptions): ValidationError[] {
95
+ let errors: ValidationError[] = [];
98
96
  const value = options.value;
99
97
  const key = options.key;
100
98
 
@@ -149,11 +147,9 @@ export default function validateFunction(options: ValidationOptions): any {
149
147
  }
150
148
 
151
149
  if (isExpression(deepUnbundle(value[1]))) {
152
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
153
150
  return errors.concat([new ValidationError(`${key}[1]`, value[1], 'expressions are not allowed in function stops.')]);
154
151
  }
155
152
 
156
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
157
153
  return errors.concat(validate({
158
154
  key: `${key}[1]`,
159
155
  value: value[1],
@@ -164,7 +160,7 @@ export default function validateFunction(options: ValidationOptions): any {
164
160
  }
165
161
 
166
162
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
167
- function validateStopDomainValue(options: ValidationOptions, stop: any) {
163
+ function validateStopDomainValue(options: ValidationOptions, stop: any): ValidationError[] {
168
164
  const type = getType(options.value);
169
165
  const value = unbundle(options.value);
170
166
 
@@ -16,7 +16,7 @@ export default function validateIconset(options: ValidationOptions): Array<Valid
16
16
 
17
17
  const type = unbundle(iconset.type) as string;
18
18
 
19
- let errors = [];
19
+ let errors: ValidationError[] = [];
20
20
 
21
21
  errors = errors.concat(validateObject({
22
22
  key,
@@ -36,6 +36,5 @@ export default function validateIconset(options: ValidationOptions): Array<Valid
36
36
  }
37
37
  }
38
38
 
39
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
40
39
  return errors;
41
40
  }
@@ -16,7 +16,7 @@ type Options = ValidationOptions & {
16
16
  };
17
17
 
18
18
  export default function validateLayer(options: Options): Array<ValidationError> {
19
- let errors = [];
19
+ let errors: ValidationError[] = [];
20
20
 
21
21
  const layer = options.value;
22
22
  const key = options.key;
@@ -146,6 +146,5 @@ export default function validateLayer(options: Options): Array<ValidationError>
146
146
  }
147
147
  }));
148
148
 
149
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
150
149
  return errors;
151
150
  }
@@ -10,15 +10,13 @@ export default function validateLight(options: ValidationOptions): Array<Validat
10
10
  const lightSpec = styleSpec.light;
11
11
  const style = options.style;
12
12
 
13
- let errors = [];
13
+ let errors: ValidationError[] = [];
14
14
 
15
15
  const rootType = getType(light);
16
16
  if (light === undefined) {
17
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
18
17
  return errors;
19
18
  } else if (rootType !== 'object') {
20
19
  errors = errors.concat([new ValidationError('light', light, `object expected, ${rootType} found`)]);
21
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
22
20
  return errors;
23
21
  }
24
22
 
@@ -55,6 +53,5 @@ export default function validateLight(options: ValidationOptions): Array<Validat
55
53
  }
56
54
  }
57
55
 
58
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
59
56
  return errors;
60
57
  }
@@ -12,17 +12,15 @@ type Options = ValidationOptions & {
12
12
 
13
13
  export default function validateLights(options: Options): Array<ValidationError> {
14
14
  const light = options.value;
15
- let errors = [];
15
+ let errors: ValidationError[] = [];
16
16
 
17
17
  if (!light) {
18
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
19
18
  return errors;
20
19
  }
21
20
 
22
21
  const type = getType(light);
23
22
  if (type !== 'object') {
24
23
  errors = errors.concat([new ValidationError('light-3d', light, `object expected, ${type} found`)]);
25
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
26
24
  return errors;
27
25
  }
28
26
 
@@ -35,7 +33,6 @@ export default function validateLights(options: Options): Array<ValidationError>
35
33
  for (const key of ['type', 'id']) {
36
34
  if (!(key in light)) {
37
35
  errors = errors.concat([new ValidationError('light-3d', light, `missing property ${key} on light`)]);
38
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
39
36
  return errors;
40
37
  }
41
38
  }
@@ -54,7 +51,6 @@ export default function validateLights(options: Options): Array<ValidationError>
54
51
  const lightType = `properties_light_${light['type']}`;
55
52
  if (!(lightType in styleSpec)) {
56
53
  errors = errors.concat([new ValidationError('light-3d', light, `Invalid light type ${light['type']}`)]);
57
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
58
54
  return errors;
59
55
  }
60
56
 
@@ -66,7 +62,6 @@ export default function validateLights(options: Options): Array<ValidationError>
66
62
  const propertiesType = getType(properties);
67
63
  if (propertiesType !== 'object') {
68
64
  errors = errors.concat([new ValidationError('properties', properties, `object expected, ${propertiesType} found`)]);
69
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
70
65
  return errors;
71
66
  }
72
67
  for (const propertyKey in properties) {
@@ -116,6 +111,5 @@ export default function validateLights(options: Options): Array<ValidationError>
116
111
  }
117
112
  }
118
113
 
119
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
120
114
  return errors;
121
115
  }
@@ -17,17 +17,15 @@ export function isValidUrl(str: string, allowRelativeUrls: boolean): boolean {
17
17
 
18
18
  export default function validateModel(options: ValidationOptions): Array<ValidationError> {
19
19
  const url = options.value;
20
- let errors = [];
20
+ let errors: ValidationError[] = [];
21
21
 
22
22
  if (!url) {
23
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
24
23
  return errors;
25
24
  }
26
25
 
27
26
  const type = getType(url);
28
27
  if (type !== 'string') {
29
28
  errors = errors.concat([new ValidationError(options.key, url, `string expected, "${type}" found`)]);
30
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
31
29
  return errors;
32
30
  }
33
31
 
@@ -35,6 +33,5 @@ export default function validateModel(options: ValidationOptions): Array<Validat
35
33
  errors = errors.concat([new ValidationError(options.key, url, `invalid url "${url}"`)]);
36
34
  }
37
35
 
38
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
39
36
  return errors;
40
37
  }
@@ -10,7 +10,7 @@ export default function validateProjection(options: ValidationOptions): Array<Va
10
10
  const projectionSpec = styleSpec.projection;
11
11
  const style = options.style;
12
12
 
13
- let errors = [];
13
+ let errors: ValidationError[] = [];
14
14
 
15
15
  const rootType = getType(projection);
16
16
 
@@ -28,6 +28,5 @@ export default function validateProjection(options: ValidationOptions): Array<Va
28
28
  errors = errors.concat([new ValidationError('projection', projection, `object or string expected, ${rootType} found`)]);
29
29
  }
30
30
 
31
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
32
31
  return errors;
33
32
  }
@@ -28,10 +28,9 @@ export default function validateProperty(options: PropertyValidationOptions, pro
28
28
  if (!layerSpec) return [];
29
29
 
30
30
  const useThemeMatch = propertyKey.match(/^(.*)-use-theme$/);
31
- if (propertyType === 'paint' && useThemeMatch && layerSpec[useThemeMatch[1]]) {
31
+ if (useThemeMatch && layerSpec[useThemeMatch[1]]) {
32
32
  if (isExpression(value)) {
33
- const errors = [];
34
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
33
+ const errors: ValidationError[] = [];
35
34
  return errors.concat(validate({
36
35
  key: options.key,
37
36
  value,
@@ -48,7 +47,6 @@ export default function validateProperty(options: PropertyValidationOptions, pro
48
47
  },
49
48
  style,
50
49
  styleSpec,
51
- // @ts-expect-error - TS2353 - Object literal may only specify known properties, and 'expressionContext' does not exist in type 'ValidationOptions'.
52
50
  expressionContext: 'property',
53
51
  propertyType,
54
52
  propertyKey
@@ -88,7 +86,7 @@ export default function validateProperty(options: PropertyValidationOptions, pro
88
86
  `Use an identity property function instead: ${example}.`)];
89
87
  }
90
88
 
91
- const errors = [];
89
+ const errors: ValidationError[] = [];
92
90
 
93
91
  if (options.layerType === 'symbol') {
94
92
  if (propertyKey === 'text-field' && style && !style.glyphs && !style.imports) {
@@ -112,14 +110,12 @@ export default function validateProperty(options: PropertyValidationOptions, pro
112
110
  }
113
111
  }
114
112
 
115
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
116
113
  return errors.concat(validate({
117
114
  key: options.key,
118
115
  value,
119
116
  valueSpec,
120
117
  style,
121
118
  styleSpec,
122
- // @ts-expect-error - TS2353 - Object literal may only specify known properties, and 'expressionContext' does not exist in type 'ValidationOptions'.
123
119
  expressionContext: 'property',
124
120
  propertyType,
125
121
  propertyKey
@@ -9,15 +9,13 @@ export default function validateRain(options: ValidationOptions): Array<Validati
9
9
  const style = options.style;
10
10
  const styleSpec = options.styleSpec;
11
11
  const rainSpec = styleSpec.rain;
12
- let errors = [];
12
+ let errors: ValidationError[] = [];
13
13
 
14
14
  const rootType = getType(rain);
15
15
  if (rain === undefined) {
16
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
17
16
  return errors;
18
17
  } else if (rootType !== 'object') {
19
18
  errors = errors.concat([new ValidationError('rain', rain, `object expected, ${rootType} found`)]);
20
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
21
19
  return errors;
22
20
  }
23
21
 
@@ -45,6 +43,5 @@ export default function validateRain(options: ValidationOptions): Array<Validati
45
43
  }
46
44
  }
47
45
 
48
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
49
46
  return errors;
50
47
  }
@@ -9,15 +9,13 @@ export default function validateSnow(options: ValidationOptions): Array<Validati
9
9
  const style = options.style;
10
10
  const styleSpec = options.styleSpec;
11
11
  const snowSpec = styleSpec.snow;
12
- let errors = [];
12
+ let errors: ValidationError[] = [];
13
13
 
14
14
  const rootType = getType(snow);
15
15
  if (snow === undefined) {
16
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
17
16
  return errors;
18
17
  } else if (rootType !== 'object') {
19
18
  errors = errors.concat([new ValidationError('snow', snow, `object expected, ${rootType} found`)]);
20
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
21
19
  return errors;
22
20
  }
23
21
 
@@ -45,6 +43,5 @@ export default function validateSnow(options: ValidationOptions): Array<Validati
45
43
  }
46
44
  }
47
45
 
48
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
49
46
  return errors;
50
47
  }
@@ -109,15 +109,14 @@ export default function validateSource(options: ValidationOptions): Array<Valida
109
109
  }
110
110
  }
111
111
 
112
- function getSourceTypeValues(styleSpec: StyleReference) {
113
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
112
+ function getSourceTypeValues(styleSpec: StyleReference): string[] {
114
113
  return styleSpec.source.reduce((memo: string[], source: string) => {
115
114
  const sourceType = styleSpec[source];
116
115
  if (sourceType.type.type === 'enum') {
117
116
  memo = memo.concat(Object.keys(sourceType.type.values));
118
117
  }
119
118
  return memo;
120
- }, []);
119
+ }, []) as string[];
121
120
  }
122
121
 
123
122
  function validatePromoteId({