Skip to content

Commit

Permalink
Remove constants validating code from style-spec
Browse files Browse the repository at this point in the history
Validation is no longer supported for legacy spec versions that
support constants.
  • Loading branch information
David Clark committed Dec 18, 2017
1 parent bbb14d0 commit 9cfd590
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/style-spec/validate/validate.js
@@ -1,6 +1,4 @@

const ValidationError = require('../error/validation_error');
const getType = require('../util/get_type');
const extend = require('../util/extend');
const unbundle = require('../util/unbundle_jsonlint');
const {isExpression} = require('../expression');
Expand All @@ -14,6 +12,7 @@ const {isFunction} = require('../function');
// high level object that needs to be descended into deeper or a simple
// scalar value.
// - valueSpec: current spec being evaluated. Tracks value.
// - styleSpec: current full spec being evaluated.

module.exports = function validate(options) {

Expand Down Expand Up @@ -41,19 +40,7 @@ module.exports = function validate(options) {

const value = options.value;
const valueSpec = options.valueSpec;
const key = options.key;
const styleSpec = options.styleSpec;
const style = options.style;

if (getType(value) === 'string' && value[0] === '@') {
if (styleSpec.$version > 7) {
return [new ValidationError(key, value, 'constants have been deprecated as of v8')];
}
if (!(value in style.constants)) {
return [new ValidationError(key, value, 'constant "%s" not found', value)];
}
options = extend({}, options, { value: style.constants[value] });
}

if (valueSpec.function && isFunction(unbundle(value))) {
return validateFunction(options);
Expand Down

0 comments on commit 9cfd590

Please sign in to comment.