diff options
Diffstat (limited to 'tools/eslint/node_modules/ajv/lib/compile/rules.js')
-rw-r--r-- | tools/eslint/node_modules/ajv/lib/compile/rules.js | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/tools/eslint/node_modules/ajv/lib/compile/rules.js b/tools/eslint/node_modules/ajv/lib/compile/rules.js index 39b1708d96..eaeab77faf 100644 --- a/tools/eslint/node_modules/ajv/lib/compile/rules.js +++ b/tools/eslint/node_modules/ajv/lib/compile/rules.js @@ -6,34 +6,52 @@ var ruleModules = require('./_rules') module.exports = function rules() { var RULES = [ { type: 'number', - rules: [ 'maximum', 'minimum', 'multipleOf'] }, + rules: [ { 'maximum': ['exclusiveMaximum'] }, + { 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] }, { type: 'string', rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] }, { type: 'array', - rules: [ 'maxItems', 'minItems', 'uniqueItems', 'items' ] }, + rules: [ 'maxItems', 'minItems', 'uniqueItems', 'contains', 'items' ] }, { type: 'object', - rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'properties' ] }, - { rules: [ '$ref', 'enum', 'not', 'anyOf', 'oneOf', 'allOf' ] } + rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames', + { 'properties': ['additionalProperties', 'patternProperties'] } ] }, + { rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf' ] } ]; - var ALL = [ 'type', 'additionalProperties', 'patternProperties' ]; - var KEYWORDS = [ 'additionalItems', '$schema', 'id', 'title', 'description', 'default' ]; + var ALL = [ 'type' ]; + var KEYWORDS = [ + 'additionalItems', '$schema', 'id', 'title', + 'description', 'default', 'definitions' + ]; var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ]; RULES.all = toHash(ALL); + RULES.types = toHash(TYPES); RULES.forEach(function (group) { group.rules = group.rules.map(function (keyword) { + var implKeywords; + if (typeof keyword == 'object') { + var key = Object.keys(keyword)[0]; + implKeywords = keyword[key]; + keyword = key; + implKeywords.forEach(function (k) { + ALL.push(k); + RULES.all[k] = true; + }); + } ALL.push(keyword); var rule = RULES.all[keyword] = { keyword: keyword, - code: ruleModules[keyword] + code: ruleModules[keyword], + implements: implKeywords }; return rule; }); + + if (group.type) RULES.types[group.type] = group; }); RULES.keywords = toHash(ALL.concat(KEYWORDS)); - RULES.types = toHash(TYPES); RULES.custom = {}; return RULES; |