@mapbox/mapbox-gl-style-spec 14.14.0-beta.2 → 14.14.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/composite.ts +5 -8
- package/dist/index.cjs +31 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +37 -15
- package/dist/index.es.js +31 -9
- package/dist/index.es.js.map +1 -1
- package/expression/definitions/distance.ts +2 -3
- package/expression/definitions/index.ts +4 -20
- package/expression/definitions/interpolate.ts +6 -9
- package/expression/definitions/within.ts +14 -15
- package/expression/index.ts +2 -4
- package/group_by_layout.ts +3 -6
- package/migrate.ts +6 -8
- package/package.json +1 -1
- package/read_style.ts +1 -2
- package/reference/v8.json +25 -0
- package/types.ts +34 -13
- package/util/geometry_util.ts +1 -2
- package/validate/validate.ts +5 -6
- package/validate/validate_array.ts +2 -2
- package/validate/validate_enum.ts +2 -2
- package/validate/validate_expression.ts +1 -2
- package/validate/validate_filter.ts +3 -4
- package/validate/validate_fog.ts +2 -5
- package/validate/validate_function.ts +6 -10
- package/validate/validate_iconset.ts +1 -2
- package/validate/validate_layer.ts +1 -2
- package/validate/validate_light.ts +1 -4
- package/validate/validate_lights.ts +1 -7
- package/validate/validate_model.ts +1 -4
- package/validate/validate_projection.ts +1 -2
- package/validate/validate_property.ts +2 -6
- package/validate/validate_rain.ts +1 -4
- package/validate/validate_snow.ts +1 -4
- package/validate/validate_source.ts +2 -3
- package/validate/validate_terrain.ts +1 -5
- package/validate_mapbox_api_supported.ts +2 -4
- package/validate_style.ts +1 -2
- package/visit.ts +2 -4
|
@@ -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
|
-
|
|
122
|
+
|
|
124
123
|
return errors;
|
|
125
124
|
}
|
package/validate/validate_fog.ts
CHANGED
|
@@ -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):
|
|
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
|
-
|
|
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
|
}
|
|
@@ -30,8 +30,7 @@ export default function validateProperty(options: PropertyValidationOptions, pro
|
|
|
30
30
|
const useThemeMatch = propertyKey.match(/^(.*)-use-theme$/);
|
|
31
31
|
if (propertyType === 'paint' && 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({
|
|
@@ -11,18 +11,15 @@ export default function validateTerrain(options: ValidationOptions): Array<Valid
|
|
|
11
11
|
const style = options.style;
|
|
12
12
|
const styleSpec = options.styleSpec;
|
|
13
13
|
const terrainSpec = styleSpec.terrain;
|
|
14
|
-
let errors = [];
|
|
14
|
+
let errors: ValidationError[] = [];
|
|
15
15
|
|
|
16
16
|
const rootType = getType(terrain);
|
|
17
17
|
if (terrain === undefined) {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
19
18
|
return errors;
|
|
20
19
|
} else if (rootType === 'null') {
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
22
20
|
return errors;
|
|
23
21
|
} else if (rootType !== 'object') {
|
|
24
22
|
errors = errors.concat([new ValidationError('terrain', terrain, `object expected, ${rootType} found`)]);
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
26
23
|
return errors;
|
|
27
24
|
}
|
|
28
25
|
|
|
@@ -71,6 +68,5 @@ export default function validateTerrain(options: ValidationOptions): Array<Valid
|
|
|
71
68
|
}
|
|
72
69
|
}
|
|
73
70
|
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
75
71
|
return errors;
|
|
76
72
|
}
|
|
@@ -139,7 +139,7 @@ function getImportErrors(imports: ImportSpecification[] = []): {errors: Array<Va
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
function getRootErrors(style: MapboxStyleSpecification, specKeys: string[]): Array<ValidationError> {
|
|
142
|
-
const errors = [];
|
|
142
|
+
const errors: ValidationError[] = [];
|
|
143
143
|
|
|
144
144
|
/*
|
|
145
145
|
* The following keys are optional but fully managed by the Mapbox Styles
|
|
@@ -204,7 +204,6 @@ function getRootErrors(style: MapboxStyleSpecification, specKeys: string[]): Arr
|
|
|
204
204
|
errors.push(new ValidationError('protected', style.protected, 'Style protection must be true or false'));
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
208
207
|
return errors;
|
|
209
208
|
}
|
|
210
209
|
|
|
@@ -223,8 +222,7 @@ export default function validateMapboxApiSupported(style: MapboxStyleSpecificati
|
|
|
223
222
|
try {
|
|
224
223
|
s = readStyle(s);
|
|
225
224
|
} catch (e) {
|
|
226
|
-
|
|
227
|
-
return [e];
|
|
225
|
+
return [e] as ValidationErrors;
|
|
228
226
|
}
|
|
229
227
|
|
|
230
228
|
let errors = validateStyle(s, styleSpec)
|
package/validate_style.ts
CHANGED
|
@@ -28,8 +28,7 @@ export default function validateStyle(style: StyleSpecification | string | Buffe
|
|
|
28
28
|
try {
|
|
29
29
|
s = readStyle(s);
|
|
30
30
|
} catch (e) {
|
|
31
|
-
|
|
32
|
-
return [e];
|
|
31
|
+
return [e] as ValidationErrors;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
return validateStyleMin(s, styleSpec);
|
package/visit.ts
CHANGED
|
@@ -11,14 +11,12 @@ import type {
|
|
|
11
11
|
function getPropertyReference(propertyName: string): StylePropertySpecification {
|
|
12
12
|
for (let i = 0; i < Reference.layout.length; i++) {
|
|
13
13
|
for (const key in Reference[Reference.layout[i]]) {
|
|
14
|
-
|
|
15
|
-
if (key === propertyName) return Reference[Reference.layout[i]][key];
|
|
14
|
+
if (key === propertyName) return Reference[Reference.layout[i]][key] as StylePropertySpecification;
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
for (let i = 0; i < Reference.paint.length; i++) {
|
|
19
18
|
for (const key in Reference[Reference.paint[i]]) {
|
|
20
|
-
|
|
21
|
-
if (key === propertyName) return Reference[Reference.paint[i]][key];
|
|
19
|
+
if (key === propertyName) return Reference[Reference.paint[i]][key] as StylePropertySpecification;
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
|