@alexlit/lint-kit 117.3.1 → 117.5.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.
Files changed (160) hide show
  1. package/package.json +1 -1
  2. package/packages/config-eslint/package.json +7 -11
  3. package/packages/config-eslint/plugins/no-await-in-promise.js +1 -1
  4. package/packages/config-eslint/utils/create-config.js +3 -3
  5. package/packages/config-hooks/package.json +2 -2
  6. package/scripts/.config.sh +1 -1
  7. package/packages/config-eslint/node_modules/@eslint/eslintrc/LICENSE +0 -19
  8. package/packages/config-eslint/node_modules/@eslint/eslintrc/README.md +0 -126
  9. package/packages/config-eslint/node_modules/@eslint/eslintrc/conf/config-schema.js +0 -79
  10. package/packages/config-eslint/node_modules/@eslint/eslintrc/conf/environments.js +0 -215
  11. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +0 -1143
  12. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +0 -1
  13. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +0 -4371
  14. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +0 -1
  15. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +0 -532
  16. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +0 -510
  17. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js +0 -124
  18. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js +0 -145
  19. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js +0 -238
  20. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/index.js +0 -19
  21. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js +0 -225
  22. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js +0 -1155
  23. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/flat-compat.js +0 -318
  24. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/index-universal.js +0 -29
  25. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/index.js +0 -58
  26. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/ajv.js +0 -191
  27. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/config-ops.js +0 -135
  28. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +0 -370
  29. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js +0 -63
  30. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/naming.js +0 -96
  31. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js +0 -42
  32. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/types.js +0 -149
  33. package/packages/config-eslint/node_modules/@eslint/eslintrc/package.json +0 -82
  34. package/packages/config-eslint/node_modules/@eslint/eslintrc/universal.js +0 -9
  35. package/packages/config-eslint/node_modules/ajv/.tonic_example.js +0 -20
  36. package/packages/config-eslint/node_modules/ajv/LICENSE +0 -22
  37. package/packages/config-eslint/node_modules/ajv/README.md +0 -1497
  38. package/packages/config-eslint/node_modules/ajv/dist/ajv.bundle.js +0 -7189
  39. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js +0 -3
  40. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js.map +0 -1
  41. package/packages/config-eslint/node_modules/ajv/lib/ajv.d.ts +0 -397
  42. package/packages/config-eslint/node_modules/ajv/lib/ajv.js +0 -506
  43. package/packages/config-eslint/node_modules/ajv/lib/cache.js +0 -26
  44. package/packages/config-eslint/node_modules/ajv/lib/compile/async.js +0 -90
  45. package/packages/config-eslint/node_modules/ajv/lib/compile/equal.js +0 -5
  46. package/packages/config-eslint/node_modules/ajv/lib/compile/error_classes.js +0 -34
  47. package/packages/config-eslint/node_modules/ajv/lib/compile/formats.js +0 -142
  48. package/packages/config-eslint/node_modules/ajv/lib/compile/index.js +0 -387
  49. package/packages/config-eslint/node_modules/ajv/lib/compile/resolve.js +0 -270
  50. package/packages/config-eslint/node_modules/ajv/lib/compile/rules.js +0 -66
  51. package/packages/config-eslint/node_modules/ajv/lib/compile/schema_obj.js +0 -9
  52. package/packages/config-eslint/node_modules/ajv/lib/compile/ucs2length.js +0 -20
  53. package/packages/config-eslint/node_modules/ajv/lib/compile/util.js +0 -239
  54. package/packages/config-eslint/node_modules/ajv/lib/data.js +0 -49
  55. package/packages/config-eslint/node_modules/ajv/lib/definition_schema.js +0 -37
  56. package/packages/config-eslint/node_modules/ajv/lib/dot/_limit.jst +0 -113
  57. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitItems.jst +0 -12
  58. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitLength.jst +0 -12
  59. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitProperties.jst +0 -12
  60. package/packages/config-eslint/node_modules/ajv/lib/dot/allOf.jst +0 -32
  61. package/packages/config-eslint/node_modules/ajv/lib/dot/anyOf.jst +0 -46
  62. package/packages/config-eslint/node_modules/ajv/lib/dot/coerce.def +0 -51
  63. package/packages/config-eslint/node_modules/ajv/lib/dot/comment.jst +0 -9
  64. package/packages/config-eslint/node_modules/ajv/lib/dot/const.jst +0 -11
  65. package/packages/config-eslint/node_modules/ajv/lib/dot/contains.jst +0 -55
  66. package/packages/config-eslint/node_modules/ajv/lib/dot/custom.jst +0 -191
  67. package/packages/config-eslint/node_modules/ajv/lib/dot/defaults.def +0 -47
  68. package/packages/config-eslint/node_modules/ajv/lib/dot/definitions.def +0 -203
  69. package/packages/config-eslint/node_modules/ajv/lib/dot/dependencies.jst +0 -79
  70. package/packages/config-eslint/node_modules/ajv/lib/dot/enum.jst +0 -30
  71. package/packages/config-eslint/node_modules/ajv/lib/dot/errors.def +0 -194
  72. package/packages/config-eslint/node_modules/ajv/lib/dot/format.jst +0 -106
  73. package/packages/config-eslint/node_modules/ajv/lib/dot/if.jst +0 -73
  74. package/packages/config-eslint/node_modules/ajv/lib/dot/items.jst +0 -98
  75. package/packages/config-eslint/node_modules/ajv/lib/dot/missing.def +0 -39
  76. package/packages/config-eslint/node_modules/ajv/lib/dot/multipleOf.jst +0 -22
  77. package/packages/config-eslint/node_modules/ajv/lib/dot/not.jst +0 -43
  78. package/packages/config-eslint/node_modules/ajv/lib/dot/oneOf.jst +0 -54
  79. package/packages/config-eslint/node_modules/ajv/lib/dot/pattern.jst +0 -14
  80. package/packages/config-eslint/node_modules/ajv/lib/dot/properties.jst +0 -245
  81. package/packages/config-eslint/node_modules/ajv/lib/dot/propertyNames.jst +0 -52
  82. package/packages/config-eslint/node_modules/ajv/lib/dot/ref.jst +0 -85
  83. package/packages/config-eslint/node_modules/ajv/lib/dot/required.jst +0 -108
  84. package/packages/config-eslint/node_modules/ajv/lib/dot/uniqueItems.jst +0 -62
  85. package/packages/config-eslint/node_modules/ajv/lib/dot/validate.jst +0 -276
  86. package/packages/config-eslint/node_modules/ajv/lib/dotjs/README.md +0 -3
  87. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limit.js +0 -163
  88. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitItems.js +0 -80
  89. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitLength.js +0 -85
  90. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitProperties.js +0 -80
  91. package/packages/config-eslint/node_modules/ajv/lib/dotjs/allOf.js +0 -42
  92. package/packages/config-eslint/node_modules/ajv/lib/dotjs/anyOf.js +0 -73
  93. package/packages/config-eslint/node_modules/ajv/lib/dotjs/comment.js +0 -14
  94. package/packages/config-eslint/node_modules/ajv/lib/dotjs/const.js +0 -56
  95. package/packages/config-eslint/node_modules/ajv/lib/dotjs/contains.js +0 -81
  96. package/packages/config-eslint/node_modules/ajv/lib/dotjs/custom.js +0 -228
  97. package/packages/config-eslint/node_modules/ajv/lib/dotjs/dependencies.js +0 -168
  98. package/packages/config-eslint/node_modules/ajv/lib/dotjs/enum.js +0 -66
  99. package/packages/config-eslint/node_modules/ajv/lib/dotjs/format.js +0 -150
  100. package/packages/config-eslint/node_modules/ajv/lib/dotjs/if.js +0 -103
  101. package/packages/config-eslint/node_modules/ajv/lib/dotjs/index.js +0 -33
  102. package/packages/config-eslint/node_modules/ajv/lib/dotjs/items.js +0 -140
  103. package/packages/config-eslint/node_modules/ajv/lib/dotjs/multipleOf.js +0 -80
  104. package/packages/config-eslint/node_modules/ajv/lib/dotjs/not.js +0 -84
  105. package/packages/config-eslint/node_modules/ajv/lib/dotjs/oneOf.js +0 -73
  106. package/packages/config-eslint/node_modules/ajv/lib/dotjs/pattern.js +0 -75
  107. package/packages/config-eslint/node_modules/ajv/lib/dotjs/properties.js +0 -335
  108. package/packages/config-eslint/node_modules/ajv/lib/dotjs/propertyNames.js +0 -81
  109. package/packages/config-eslint/node_modules/ajv/lib/dotjs/ref.js +0 -124
  110. package/packages/config-eslint/node_modules/ajv/lib/dotjs/required.js +0 -270
  111. package/packages/config-eslint/node_modules/ajv/lib/dotjs/uniqueItems.js +0 -86
  112. package/packages/config-eslint/node_modules/ajv/lib/dotjs/validate.js +0 -482
  113. package/packages/config-eslint/node_modules/ajv/lib/keyword.js +0 -146
  114. package/packages/config-eslint/node_modules/ajv/lib/refs/data.json +0 -17
  115. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-04.json +0 -149
  116. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-06.json +0 -154
  117. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-07.json +0 -168
  118. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-secure.json +0 -94
  119. package/packages/config-eslint/node_modules/ajv/package.json +0 -106
  120. package/packages/config-eslint/node_modules/ajv/scripts/.eslintrc.yml +0 -3
  121. package/packages/config-eslint/node_modules/ajv/scripts/bundle.js +0 -61
  122. package/packages/config-eslint/node_modules/ajv/scripts/compile-dots.js +0 -73
  123. package/packages/config-eslint/node_modules/ajv/scripts/info +0 -10
  124. package/packages/config-eslint/node_modules/ajv/scripts/prepare-tests +0 -12
  125. package/packages/config-eslint/node_modules/ajv/scripts/publish-built-version +0 -32
  126. package/packages/config-eslint/node_modules/ajv/scripts/travis-gh-pages +0 -23
  127. package/packages/config-eslint/node_modules/eslint-visitor-keys/LICENSE +0 -201
  128. package/packages/config-eslint/node_modules/eslint-visitor-keys/README.md +0 -105
  129. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs +0 -384
  130. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +0 -27
  131. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/index.d.ts +0 -16
  132. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts +0 -12
  133. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/index.js +0 -65
  134. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js +0 -315
  135. package/packages/config-eslint/node_modules/eslint-visitor-keys/package.json +0 -74
  136. package/packages/config-eslint/node_modules/espree/LICENSE +0 -25
  137. package/packages/config-eslint/node_modules/espree/README.md +0 -244
  138. package/packages/config-eslint/node_modules/espree/dist/espree.cjs +0 -883
  139. package/packages/config-eslint/node_modules/espree/espree.js +0 -177
  140. package/packages/config-eslint/node_modules/espree/lib/espree.js +0 -349
  141. package/packages/config-eslint/node_modules/espree/lib/features.js +0 -27
  142. package/packages/config-eslint/node_modules/espree/lib/options.js +0 -123
  143. package/packages/config-eslint/node_modules/espree/lib/token-translator.js +0 -263
  144. package/packages/config-eslint/node_modules/espree/lib/version.js +0 -3
  145. package/packages/config-eslint/node_modules/espree/package.json +0 -86
  146. package/packages/config-eslint/node_modules/globals/globals.json +0 -1998
  147. package/packages/config-eslint/node_modules/globals/index.d.ts +0 -2077
  148. package/packages/config-eslint/node_modules/globals/index.js +0 -2
  149. package/packages/config-eslint/node_modules/globals/license +0 -9
  150. package/packages/config-eslint/node_modules/globals/package.json +0 -58
  151. package/packages/config-eslint/node_modules/globals/readme.md +0 -44
  152. package/packages/config-eslint/node_modules/json-schema-traverse/.eslintrc.yml +0 -27
  153. package/packages/config-eslint/node_modules/json-schema-traverse/.travis.yml +0 -8
  154. package/packages/config-eslint/node_modules/json-schema-traverse/LICENSE +0 -21
  155. package/packages/config-eslint/node_modules/json-schema-traverse/README.md +0 -83
  156. package/packages/config-eslint/node_modules/json-schema-traverse/index.js +0 -89
  157. package/packages/config-eslint/node_modules/json-schema-traverse/package.json +0 -43
  158. package/packages/config-eslint/node_modules/json-schema-traverse/spec/.eslintrc.yml +0 -6
  159. package/packages/config-eslint/node_modules/json-schema-traverse/spec/fixtures/schema.js +0 -125
  160. package/packages/config-eslint/node_modules/json-schema-traverse/spec/index.spec.js +0 -171
@@ -1,80 +0,0 @@
1
- 'use strict';
2
- module.exports = function generate_multipleOf(it, $keyword, $ruleType) {
3
- var out = ' ';
4
- var $lvl = it.level;
5
- var $dataLvl = it.dataLevel;
6
- var $schema = it.schema[$keyword];
7
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
8
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
9
- var $breakOnError = !it.opts.allErrors;
10
- var $data = 'data' + ($dataLvl || '');
11
- var $isData = it.opts.$data && $schema && $schema.$data,
12
- $schemaValue;
13
- if ($isData) {
14
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
15
- $schemaValue = 'schema' + $lvl;
16
- } else {
17
- $schemaValue = $schema;
18
- }
19
- if (!($isData || typeof $schema == 'number')) {
20
- throw new Error($keyword + ' must be number');
21
- }
22
- out += 'var division' + ($lvl) + ';if (';
23
- if ($isData) {
24
- out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
25
- }
26
- out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', ';
27
- if (it.opts.multipleOfPrecision) {
28
- out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' ';
29
- } else {
30
- out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') ';
31
- }
32
- out += ' ) ';
33
- if ($isData) {
34
- out += ' ) ';
35
- }
36
- out += ' ) { ';
37
- var $$outStack = $$outStack || [];
38
- $$outStack.push(out);
39
- out = ''; /* istanbul ignore else */
40
- if (it.createErrors !== false) {
41
- out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } ';
42
- if (it.opts.messages !== false) {
43
- out += ' , message: \'should be multiple of ';
44
- if ($isData) {
45
- out += '\' + ' + ($schemaValue);
46
- } else {
47
- out += '' + ($schemaValue) + '\'';
48
- }
49
- }
50
- if (it.opts.verbose) {
51
- out += ' , schema: ';
52
- if ($isData) {
53
- out += 'validate.schema' + ($schemaPath);
54
- } else {
55
- out += '' + ($schema);
56
- }
57
- out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
58
- }
59
- out += ' } ';
60
- } else {
61
- out += ' {} ';
62
- }
63
- var __err = out;
64
- out = $$outStack.pop();
65
- if (!it.compositeRule && $breakOnError) {
66
- /* istanbul ignore if */
67
- if (it.async) {
68
- out += ' throw new ValidationError([' + (__err) + ']); ';
69
- } else {
70
- out += ' validate.errors = [' + (__err) + ']; return false; ';
71
- }
72
- } else {
73
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
74
- }
75
- out += '} ';
76
- if ($breakOnError) {
77
- out += ' else { ';
78
- }
79
- return out;
80
- }
@@ -1,84 +0,0 @@
1
- 'use strict';
2
- module.exports = function generate_not(it, $keyword, $ruleType) {
3
- var out = ' ';
4
- var $lvl = it.level;
5
- var $dataLvl = it.dataLevel;
6
- var $schema = it.schema[$keyword];
7
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
8
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
9
- var $breakOnError = !it.opts.allErrors;
10
- var $data = 'data' + ($dataLvl || '');
11
- var $errs = 'errs__' + $lvl;
12
- var $it = it.util.copy(it);
13
- $it.level++;
14
- var $nextValid = 'valid' + $it.level;
15
- if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
16
- $it.schema = $schema;
17
- $it.schemaPath = $schemaPath;
18
- $it.errSchemaPath = $errSchemaPath;
19
- out += ' var ' + ($errs) + ' = errors; ';
20
- var $wasComposite = it.compositeRule;
21
- it.compositeRule = $it.compositeRule = true;
22
- $it.createErrors = false;
23
- var $allErrorsOption;
24
- if ($it.opts.allErrors) {
25
- $allErrorsOption = $it.opts.allErrors;
26
- $it.opts.allErrors = false;
27
- }
28
- out += ' ' + (it.validate($it)) + ' ';
29
- $it.createErrors = true;
30
- if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;
31
- it.compositeRule = $it.compositeRule = $wasComposite;
32
- out += ' if (' + ($nextValid) + ') { ';
33
- var $$outStack = $$outStack || [];
34
- $$outStack.push(out);
35
- out = ''; /* istanbul ignore else */
36
- if (it.createErrors !== false) {
37
- out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
38
- if (it.opts.messages !== false) {
39
- out += ' , message: \'should NOT be valid\' ';
40
- }
41
- if (it.opts.verbose) {
42
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
43
- }
44
- out += ' } ';
45
- } else {
46
- out += ' {} ';
47
- }
48
- var __err = out;
49
- out = $$outStack.pop();
50
- if (!it.compositeRule && $breakOnError) {
51
- /* istanbul ignore if */
52
- if (it.async) {
53
- out += ' throw new ValidationError([' + (__err) + ']); ';
54
- } else {
55
- out += ' validate.errors = [' + (__err) + ']; return false; ';
56
- }
57
- } else {
58
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
59
- }
60
- out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
61
- if (it.opts.allErrors) {
62
- out += ' } ';
63
- }
64
- } else {
65
- out += ' var err = '; /* istanbul ignore else */
66
- if (it.createErrors !== false) {
67
- out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
68
- if (it.opts.messages !== false) {
69
- out += ' , message: \'should NOT be valid\' ';
70
- }
71
- if (it.opts.verbose) {
72
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
73
- }
74
- out += ' } ';
75
- } else {
76
- out += ' {} ';
77
- }
78
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
79
- if ($breakOnError) {
80
- out += ' if (false) { ';
81
- }
82
- }
83
- return out;
84
- }
@@ -1,73 +0,0 @@
1
- 'use strict';
2
- module.exports = function generate_oneOf(it, $keyword, $ruleType) {
3
- var out = ' ';
4
- var $lvl = it.level;
5
- var $dataLvl = it.dataLevel;
6
- var $schema = it.schema[$keyword];
7
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
8
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
9
- var $breakOnError = !it.opts.allErrors;
10
- var $data = 'data' + ($dataLvl || '');
11
- var $valid = 'valid' + $lvl;
12
- var $errs = 'errs__' + $lvl;
13
- var $it = it.util.copy(it);
14
- var $closingBraces = '';
15
- $it.level++;
16
- var $nextValid = 'valid' + $it.level;
17
- var $currentBaseId = $it.baseId,
18
- $prevValid = 'prevValid' + $lvl,
19
- $passingSchemas = 'passingSchemas' + $lvl;
20
- out += 'var ' + ($errs) + ' = errors , ' + ($prevValid) + ' = false , ' + ($valid) + ' = false , ' + ($passingSchemas) + ' = null; ';
21
- var $wasComposite = it.compositeRule;
22
- it.compositeRule = $it.compositeRule = true;
23
- var arr1 = $schema;
24
- if (arr1) {
25
- var $sch, $i = -1,
26
- l1 = arr1.length - 1;
27
- while ($i < l1) {
28
- $sch = arr1[$i += 1];
29
- if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
30
- $it.schema = $sch;
31
- $it.schemaPath = $schemaPath + '[' + $i + ']';
32
- $it.errSchemaPath = $errSchemaPath + '/' + $i;
33
- out += ' ' + (it.validate($it)) + ' ';
34
- $it.baseId = $currentBaseId;
35
- } else {
36
- out += ' var ' + ($nextValid) + ' = true; ';
37
- }
38
- if ($i) {
39
- out += ' if (' + ($nextValid) + ' && ' + ($prevValid) + ') { ' + ($valid) + ' = false; ' + ($passingSchemas) + ' = [' + ($passingSchemas) + ', ' + ($i) + ']; } else { ';
40
- $closingBraces += '}';
41
- }
42
- out += ' if (' + ($nextValid) + ') { ' + ($valid) + ' = ' + ($prevValid) + ' = true; ' + ($passingSchemas) + ' = ' + ($i) + '; }';
43
- }
44
- }
45
- it.compositeRule = $it.compositeRule = $wasComposite;
46
- out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
47
- if (it.createErrors !== false) {
48
- out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { passingSchemas: ' + ($passingSchemas) + ' } ';
49
- if (it.opts.messages !== false) {
50
- out += ' , message: \'should match exactly one schema in oneOf\' ';
51
- }
52
- if (it.opts.verbose) {
53
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
54
- }
55
- out += ' } ';
56
- } else {
57
- out += ' {} ';
58
- }
59
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
60
- if (!it.compositeRule && $breakOnError) {
61
- /* istanbul ignore if */
62
- if (it.async) {
63
- out += ' throw new ValidationError(vErrors); ';
64
- } else {
65
- out += ' validate.errors = vErrors; return false; ';
66
- }
67
- }
68
- out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }';
69
- if (it.opts.allErrors) {
70
- out += ' } ';
71
- }
72
- return out;
73
- }
@@ -1,75 +0,0 @@
1
- 'use strict';
2
- module.exports = function generate_pattern(it, $keyword, $ruleType) {
3
- var out = ' ';
4
- var $lvl = it.level;
5
- var $dataLvl = it.dataLevel;
6
- var $schema = it.schema[$keyword];
7
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
8
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
9
- var $breakOnError = !it.opts.allErrors;
10
- var $data = 'data' + ($dataLvl || '');
11
- var $isData = it.opts.$data && $schema && $schema.$data,
12
- $schemaValue;
13
- if ($isData) {
14
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
15
- $schemaValue = 'schema' + $lvl;
16
- } else {
17
- $schemaValue = $schema;
18
- }
19
- var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema);
20
- out += 'if ( ';
21
- if ($isData) {
22
- out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
23
- }
24
- out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { ';
25
- var $$outStack = $$outStack || [];
26
- $$outStack.push(out);
27
- out = ''; /* istanbul ignore else */
28
- if (it.createErrors !== false) {
29
- out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: ';
30
- if ($isData) {
31
- out += '' + ($schemaValue);
32
- } else {
33
- out += '' + (it.util.toQuotedString($schema));
34
- }
35
- out += ' } ';
36
- if (it.opts.messages !== false) {
37
- out += ' , message: \'should match pattern "';
38
- if ($isData) {
39
- out += '\' + ' + ($schemaValue) + ' + \'';
40
- } else {
41
- out += '' + (it.util.escapeQuotes($schema));
42
- }
43
- out += '"\' ';
44
- }
45
- if (it.opts.verbose) {
46
- out += ' , schema: ';
47
- if ($isData) {
48
- out += 'validate.schema' + ($schemaPath);
49
- } else {
50
- out += '' + (it.util.toQuotedString($schema));
51
- }
52
- out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
53
- }
54
- out += ' } ';
55
- } else {
56
- out += ' {} ';
57
- }
58
- var __err = out;
59
- out = $$outStack.pop();
60
- if (!it.compositeRule && $breakOnError) {
61
- /* istanbul ignore if */
62
- if (it.async) {
63
- out += ' throw new ValidationError([' + (__err) + ']); ';
64
- } else {
65
- out += ' validate.errors = [' + (__err) + ']; return false; ';
66
- }
67
- } else {
68
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
69
- }
70
- out += '} ';
71
- if ($breakOnError) {
72
- out += ' else { ';
73
- }
74
- return out;
75
- }
@@ -1,335 +0,0 @@
1
- 'use strict';
2
- module.exports = function generate_properties(it, $keyword, $ruleType) {
3
- var out = ' ';
4
- var $lvl = it.level;
5
- var $dataLvl = it.dataLevel;
6
- var $schema = it.schema[$keyword];
7
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
8
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
9
- var $breakOnError = !it.opts.allErrors;
10
- var $data = 'data' + ($dataLvl || '');
11
- var $errs = 'errs__' + $lvl;
12
- var $it = it.util.copy(it);
13
- var $closingBraces = '';
14
- $it.level++;
15
- var $nextValid = 'valid' + $it.level;
16
- var $key = 'key' + $lvl,
17
- $idx = 'idx' + $lvl,
18
- $dataNxt = $it.dataLevel = it.dataLevel + 1,
19
- $nextData = 'data' + $dataNxt,
20
- $dataProperties = 'dataProperties' + $lvl;
21
- var $schemaKeys = Object.keys($schema || {}).filter(notProto),
22
- $pProperties = it.schema.patternProperties || {},
23
- $pPropertyKeys = Object.keys($pProperties).filter(notProto),
24
- $aProperties = it.schema.additionalProperties,
25
- $someProperties = $schemaKeys.length || $pPropertyKeys.length,
26
- $noAdditional = $aProperties === false,
27
- $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length,
28
- $removeAdditional = it.opts.removeAdditional,
29
- $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional,
30
- $ownProperties = it.opts.ownProperties,
31
- $currentBaseId = it.baseId;
32
- var $required = it.schema.required;
33
- if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
34
- var $requiredHash = it.util.toHash($required);
35
- }
36
-
37
- function notProto(p) {
38
- return p !== '__proto__';
39
- }
40
- out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
41
- if ($ownProperties) {
42
- out += ' var ' + ($dataProperties) + ' = undefined;';
43
- }
44
- if ($checkAdditional) {
45
- if ($ownProperties) {
46
- out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';
47
- } else {
48
- out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
49
- }
50
- if ($someProperties) {
51
- out += ' var isAdditional' + ($lvl) + ' = !(false ';
52
- if ($schemaKeys.length) {
53
- if ($schemaKeys.length > 8) {
54
- out += ' || validate.schema' + ($schemaPath) + '.hasOwnProperty(' + ($key) + ') ';
55
- } else {
56
- var arr1 = $schemaKeys;
57
- if (arr1) {
58
- var $propertyKey, i1 = -1,
59
- l1 = arr1.length - 1;
60
- while (i1 < l1) {
61
- $propertyKey = arr1[i1 += 1];
62
- out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' ';
63
- }
64
- }
65
- }
66
- }
67
- if ($pPropertyKeys.length) {
68
- var arr2 = $pPropertyKeys;
69
- if (arr2) {
70
- var $pProperty, $i = -1,
71
- l2 = arr2.length - 1;
72
- while ($i < l2) {
73
- $pProperty = arr2[$i += 1];
74
- out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') ';
75
- }
76
- }
77
- }
78
- out += ' ); if (isAdditional' + ($lvl) + ') { ';
79
- }
80
- if ($removeAdditional == 'all') {
81
- out += ' delete ' + ($data) + '[' + ($key) + ']; ';
82
- } else {
83
- var $currentErrorPath = it.errorPath;
84
- var $additionalProperty = '\' + ' + $key + ' + \'';
85
- if (it.opts._errorDataPathProperty) {
86
- it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
87
- }
88
- if ($noAdditional) {
89
- if ($removeAdditional) {
90
- out += ' delete ' + ($data) + '[' + ($key) + ']; ';
91
- } else {
92
- out += ' ' + ($nextValid) + ' = false; ';
93
- var $currErrSchemaPath = $errSchemaPath;
94
- $errSchemaPath = it.errSchemaPath + '/additionalProperties';
95
- var $$outStack = $$outStack || [];
96
- $$outStack.push(out);
97
- out = ''; /* istanbul ignore else */
98
- if (it.createErrors !== false) {
99
- out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } ';
100
- if (it.opts.messages !== false) {
101
- out += ' , message: \'';
102
- if (it.opts._errorDataPathProperty) {
103
- out += 'is an invalid additional property';
104
- } else {
105
- out += 'should NOT have additional properties';
106
- }
107
- out += '\' ';
108
- }
109
- if (it.opts.verbose) {
110
- out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
111
- }
112
- out += ' } ';
113
- } else {
114
- out += ' {} ';
115
- }
116
- var __err = out;
117
- out = $$outStack.pop();
118
- if (!it.compositeRule && $breakOnError) {
119
- /* istanbul ignore if */
120
- if (it.async) {
121
- out += ' throw new ValidationError([' + (__err) + ']); ';
122
- } else {
123
- out += ' validate.errors = [' + (__err) + ']; return false; ';
124
- }
125
- } else {
126
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
127
- }
128
- $errSchemaPath = $currErrSchemaPath;
129
- if ($breakOnError) {
130
- out += ' break; ';
131
- }
132
- }
133
- } else if ($additionalIsSchema) {
134
- if ($removeAdditional == 'failing') {
135
- out += ' var ' + ($errs) + ' = errors; ';
136
- var $wasComposite = it.compositeRule;
137
- it.compositeRule = $it.compositeRule = true;
138
- $it.schema = $aProperties;
139
- $it.schemaPath = it.schemaPath + '.additionalProperties';
140
- $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
141
- $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
142
- var $passData = $data + '[' + $key + ']';
143
- $it.dataPathArr[$dataNxt] = $key;
144
- var $code = it.validate($it);
145
- $it.baseId = $currentBaseId;
146
- if (it.util.varOccurences($code, $nextData) < 2) {
147
- out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
148
- } else {
149
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
150
- }
151
- out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } ';
152
- it.compositeRule = $it.compositeRule = $wasComposite;
153
- } else {
154
- $it.schema = $aProperties;
155
- $it.schemaPath = it.schemaPath + '.additionalProperties';
156
- $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
157
- $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
158
- var $passData = $data + '[' + $key + ']';
159
- $it.dataPathArr[$dataNxt] = $key;
160
- var $code = it.validate($it);
161
- $it.baseId = $currentBaseId;
162
- if (it.util.varOccurences($code, $nextData) < 2) {
163
- out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
164
- } else {
165
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
166
- }
167
- if ($breakOnError) {
168
- out += ' if (!' + ($nextValid) + ') break; ';
169
- }
170
- }
171
- }
172
- it.errorPath = $currentErrorPath;
173
- }
174
- if ($someProperties) {
175
- out += ' } ';
176
- }
177
- out += ' } ';
178
- if ($breakOnError) {
179
- out += ' if (' + ($nextValid) + ') { ';
180
- $closingBraces += '}';
181
- }
182
- }
183
- var $useDefaults = it.opts.useDefaults && !it.compositeRule;
184
- if ($schemaKeys.length) {
185
- var arr3 = $schemaKeys;
186
- if (arr3) {
187
- var $propertyKey, i3 = -1,
188
- l3 = arr3.length - 1;
189
- while (i3 < l3) {
190
- $propertyKey = arr3[i3 += 1];
191
- var $sch = $schema[$propertyKey];
192
- if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
193
- var $prop = it.util.getProperty($propertyKey),
194
- $passData = $data + $prop,
195
- $hasDefault = $useDefaults && $sch.default !== undefined;
196
- $it.schema = $sch;
197
- $it.schemaPath = $schemaPath + $prop;
198
- $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);
199
- $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);
200
- $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);
201
- var $code = it.validate($it);
202
- $it.baseId = $currentBaseId;
203
- if (it.util.varOccurences($code, $nextData) < 2) {
204
- $code = it.util.varReplace($code, $nextData, $passData);
205
- var $useData = $passData;
206
- } else {
207
- var $useData = $nextData;
208
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ';
209
- }
210
- if ($hasDefault) {
211
- out += ' ' + ($code) + ' ';
212
- } else {
213
- if ($requiredHash && $requiredHash[$propertyKey]) {
214
- out += ' if ( ' + ($useData) + ' === undefined ';
215
- if ($ownProperties) {
216
- out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
217
- }
218
- out += ') { ' + ($nextValid) + ' = false; ';
219
- var $currentErrorPath = it.errorPath,
220
- $currErrSchemaPath = $errSchemaPath,
221
- $missingProperty = it.util.escapeQuotes($propertyKey);
222
- if (it.opts._errorDataPathProperty) {
223
- it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
224
- }
225
- $errSchemaPath = it.errSchemaPath + '/required';
226
- var $$outStack = $$outStack || [];
227
- $$outStack.push(out);
228
- out = ''; /* istanbul ignore else */
229
- if (it.createErrors !== false) {
230
- out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
231
- if (it.opts.messages !== false) {
232
- out += ' , message: \'';
233
- if (it.opts._errorDataPathProperty) {
234
- out += 'is a required property';
235
- } else {
236
- out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
237
- }
238
- out += '\' ';
239
- }
240
- if (it.opts.verbose) {
241
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
242
- }
243
- out += ' } ';
244
- } else {
245
- out += ' {} ';
246
- }
247
- var __err = out;
248
- out = $$outStack.pop();
249
- if (!it.compositeRule && $breakOnError) {
250
- /* istanbul ignore if */
251
- if (it.async) {
252
- out += ' throw new ValidationError([' + (__err) + ']); ';
253
- } else {
254
- out += ' validate.errors = [' + (__err) + ']; return false; ';
255
- }
256
- } else {
257
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
258
- }
259
- $errSchemaPath = $currErrSchemaPath;
260
- it.errorPath = $currentErrorPath;
261
- out += ' } else { ';
262
- } else {
263
- if ($breakOnError) {
264
- out += ' if ( ' + ($useData) + ' === undefined ';
265
- if ($ownProperties) {
266
- out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
267
- }
268
- out += ') { ' + ($nextValid) + ' = true; } else { ';
269
- } else {
270
- out += ' if (' + ($useData) + ' !== undefined ';
271
- if ($ownProperties) {
272
- out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
273
- }
274
- out += ' ) { ';
275
- }
276
- }
277
- out += ' ' + ($code) + ' } ';
278
- }
279
- }
280
- if ($breakOnError) {
281
- out += ' if (' + ($nextValid) + ') { ';
282
- $closingBraces += '}';
283
- }
284
- }
285
- }
286
- }
287
- if ($pPropertyKeys.length) {
288
- var arr4 = $pPropertyKeys;
289
- if (arr4) {
290
- var $pProperty, i4 = -1,
291
- l4 = arr4.length - 1;
292
- while (i4 < l4) {
293
- $pProperty = arr4[i4 += 1];
294
- var $sch = $pProperties[$pProperty];
295
- if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
296
- $it.schema = $sch;
297
- $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
298
- $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);
299
- if ($ownProperties) {
300
- out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';
301
- } else {
302
- out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
303
- }
304
- out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { ';
305
- $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
306
- var $passData = $data + '[' + $key + ']';
307
- $it.dataPathArr[$dataNxt] = $key;
308
- var $code = it.validate($it);
309
- $it.baseId = $currentBaseId;
310
- if (it.util.varOccurences($code, $nextData) < 2) {
311
- out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
312
- } else {
313
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
314
- }
315
- if ($breakOnError) {
316
- out += ' if (!' + ($nextValid) + ') break; ';
317
- }
318
- out += ' } ';
319
- if ($breakOnError) {
320
- out += ' else ' + ($nextValid) + ' = true; ';
321
- }
322
- out += ' } ';
323
- if ($breakOnError) {
324
- out += ' if (' + ($nextValid) + ') { ';
325
- $closingBraces += '}';
326
- }
327
- }
328
- }
329
- }
330
- }
331
- if ($breakOnError) {
332
- out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
333
- }
334
- return out;
335
- }