@mapbox/mapbox-gl-style-spec 14.31.0 → 14.32.0-rc.1

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.
@@ -103,34 +103,35 @@ export function disallowedFilterParameters(e: Expression, options: any): Validat
103
103
  return errors;
104
104
  }
105
105
 
106
- const FEATURE_OPERATORS = new Set(['get', 'has', 'properties', 'geometry-type', 'id']);
107
- const APPEARANCES_DISALLOWED_PARAMETERS = new Set([
108
- 'zoom', 'pitch', 'distance-from-center',
109
- 'feature', 'feature-state',
110
- 'measure-light',
111
- 'heatmap-density', 'line-progress',
112
- 'raster-value', 'raster-particle-speed', 'sky-radial-progress',
113
- ]);
106
+ const FEATURE_OPERATORS: ReadonlySet<string> = new Set(['get', 'has', 'properties', 'geometry-type', 'id']);
114
107
 
115
108
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
116
109
  function checkDisallowedAppearancesParameters(e: Expression, options: any): ValidationError[] {
110
+ const disallowedParameters = new Set([
111
+ 'zoom', 'pitch', 'distance-from-center',
112
+ 'feature', 'feature-state',
113
+ 'measure-light',
114
+ 'heatmap-density', 'line-progress',
115
+ 'raster-value', 'raster-particle-speed', 'sky-radial-progress',
116
+ ]);
117
+
117
118
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
118
119
  if (options.valueSpec && options.valueSpec.expression) {
119
120
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
120
121
  for (const param of options.valueSpec.expression.parameters) {
121
122
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
122
- APPEARANCES_DISALLOWED_PARAMETERS.delete(param);
123
+ disallowedParameters.delete(param);
123
124
  }
124
125
  }
125
126
 
126
- if (APPEARANCES_DISALLOWED_PARAMETERS.size === 0) {
127
+ if (disallowedParameters.size === 0) {
127
128
  return [];
128
129
  }
129
130
  const errors: ValidationError[] = [];
130
131
 
131
132
  if (e instanceof CompoundExpression) {
132
133
  const param = FEATURE_OPERATORS.has(e.name) ? 'feature' : e.name;
133
- if (APPEARANCES_DISALLOWED_PARAMETERS.has(param)) {
134
+ if (disallowedParameters.has(param)) {
134
135
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
135
136
  return [new ValidationError(options.key, options.value, `["${e.name}"] is not an allowed parameter`)];
136
137
  }
@@ -52,7 +52,7 @@ function getAllowedKeyErrors(obj: Record<string, unknown>, keys: string[], path?
52
52
  return errors;
53
53
  }
54
54
 
55
- const acceptedSourceTypes = new Set<SourceSpecification['type']>(['vector', 'raster', 'raster-dem', 'raster-array', 'model', 'batched-model']);
55
+ const acceptedSourceTypes: ReadonlySet<SourceSpecification['type']> = new Set<SourceSpecification['type']>(['vector', 'raster', 'raster-dem', 'raster-array', 'model', 'batched-model']);
56
56
  function getSourceErrors(source: SourceSpecification, i: number): Array<ValidationError> {
57
57
  const errors: ValidationError[] = [];
58
58