@alexlit/lint-kit 117.3.1 → 117.4.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 (159) hide show
  1. package/package.json +1 -1
  2. package/packages/config-eslint/package.json +5 -9
  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/scripts/.config.sh +1 -1
  6. package/packages/config-eslint/node_modules/@eslint/eslintrc/LICENSE +0 -19
  7. package/packages/config-eslint/node_modules/@eslint/eslintrc/README.md +0 -126
  8. package/packages/config-eslint/node_modules/@eslint/eslintrc/conf/config-schema.js +0 -79
  9. package/packages/config-eslint/node_modules/@eslint/eslintrc/conf/environments.js +0 -215
  10. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +0 -1143
  11. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +0 -1
  12. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +0 -4371
  13. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +0 -1
  14. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +0 -532
  15. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +0 -510
  16. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js +0 -124
  17. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js +0 -145
  18. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js +0 -238
  19. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/index.js +0 -19
  20. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js +0 -225
  21. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js +0 -1155
  22. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/flat-compat.js +0 -318
  23. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/index-universal.js +0 -29
  24. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/index.js +0 -58
  25. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/ajv.js +0 -191
  26. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/config-ops.js +0 -135
  27. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +0 -370
  28. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js +0 -63
  29. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/naming.js +0 -96
  30. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js +0 -42
  31. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/types.js +0 -149
  32. package/packages/config-eslint/node_modules/@eslint/eslintrc/package.json +0 -82
  33. package/packages/config-eslint/node_modules/@eslint/eslintrc/universal.js +0 -9
  34. package/packages/config-eslint/node_modules/ajv/.tonic_example.js +0 -20
  35. package/packages/config-eslint/node_modules/ajv/LICENSE +0 -22
  36. package/packages/config-eslint/node_modules/ajv/README.md +0 -1497
  37. package/packages/config-eslint/node_modules/ajv/dist/ajv.bundle.js +0 -7189
  38. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js +0 -3
  39. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js.map +0 -1
  40. package/packages/config-eslint/node_modules/ajv/lib/ajv.d.ts +0 -397
  41. package/packages/config-eslint/node_modules/ajv/lib/ajv.js +0 -506
  42. package/packages/config-eslint/node_modules/ajv/lib/cache.js +0 -26
  43. package/packages/config-eslint/node_modules/ajv/lib/compile/async.js +0 -90
  44. package/packages/config-eslint/node_modules/ajv/lib/compile/equal.js +0 -5
  45. package/packages/config-eslint/node_modules/ajv/lib/compile/error_classes.js +0 -34
  46. package/packages/config-eslint/node_modules/ajv/lib/compile/formats.js +0 -142
  47. package/packages/config-eslint/node_modules/ajv/lib/compile/index.js +0 -387
  48. package/packages/config-eslint/node_modules/ajv/lib/compile/resolve.js +0 -270
  49. package/packages/config-eslint/node_modules/ajv/lib/compile/rules.js +0 -66
  50. package/packages/config-eslint/node_modules/ajv/lib/compile/schema_obj.js +0 -9
  51. package/packages/config-eslint/node_modules/ajv/lib/compile/ucs2length.js +0 -20
  52. package/packages/config-eslint/node_modules/ajv/lib/compile/util.js +0 -239
  53. package/packages/config-eslint/node_modules/ajv/lib/data.js +0 -49
  54. package/packages/config-eslint/node_modules/ajv/lib/definition_schema.js +0 -37
  55. package/packages/config-eslint/node_modules/ajv/lib/dot/_limit.jst +0 -113
  56. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitItems.jst +0 -12
  57. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitLength.jst +0 -12
  58. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitProperties.jst +0 -12
  59. package/packages/config-eslint/node_modules/ajv/lib/dot/allOf.jst +0 -32
  60. package/packages/config-eslint/node_modules/ajv/lib/dot/anyOf.jst +0 -46
  61. package/packages/config-eslint/node_modules/ajv/lib/dot/coerce.def +0 -51
  62. package/packages/config-eslint/node_modules/ajv/lib/dot/comment.jst +0 -9
  63. package/packages/config-eslint/node_modules/ajv/lib/dot/const.jst +0 -11
  64. package/packages/config-eslint/node_modules/ajv/lib/dot/contains.jst +0 -55
  65. package/packages/config-eslint/node_modules/ajv/lib/dot/custom.jst +0 -191
  66. package/packages/config-eslint/node_modules/ajv/lib/dot/defaults.def +0 -47
  67. package/packages/config-eslint/node_modules/ajv/lib/dot/definitions.def +0 -203
  68. package/packages/config-eslint/node_modules/ajv/lib/dot/dependencies.jst +0 -79
  69. package/packages/config-eslint/node_modules/ajv/lib/dot/enum.jst +0 -30
  70. package/packages/config-eslint/node_modules/ajv/lib/dot/errors.def +0 -194
  71. package/packages/config-eslint/node_modules/ajv/lib/dot/format.jst +0 -106
  72. package/packages/config-eslint/node_modules/ajv/lib/dot/if.jst +0 -73
  73. package/packages/config-eslint/node_modules/ajv/lib/dot/items.jst +0 -98
  74. package/packages/config-eslint/node_modules/ajv/lib/dot/missing.def +0 -39
  75. package/packages/config-eslint/node_modules/ajv/lib/dot/multipleOf.jst +0 -22
  76. package/packages/config-eslint/node_modules/ajv/lib/dot/not.jst +0 -43
  77. package/packages/config-eslint/node_modules/ajv/lib/dot/oneOf.jst +0 -54
  78. package/packages/config-eslint/node_modules/ajv/lib/dot/pattern.jst +0 -14
  79. package/packages/config-eslint/node_modules/ajv/lib/dot/properties.jst +0 -245
  80. package/packages/config-eslint/node_modules/ajv/lib/dot/propertyNames.jst +0 -52
  81. package/packages/config-eslint/node_modules/ajv/lib/dot/ref.jst +0 -85
  82. package/packages/config-eslint/node_modules/ajv/lib/dot/required.jst +0 -108
  83. package/packages/config-eslint/node_modules/ajv/lib/dot/uniqueItems.jst +0 -62
  84. package/packages/config-eslint/node_modules/ajv/lib/dot/validate.jst +0 -276
  85. package/packages/config-eslint/node_modules/ajv/lib/dotjs/README.md +0 -3
  86. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limit.js +0 -163
  87. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitItems.js +0 -80
  88. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitLength.js +0 -85
  89. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitProperties.js +0 -80
  90. package/packages/config-eslint/node_modules/ajv/lib/dotjs/allOf.js +0 -42
  91. package/packages/config-eslint/node_modules/ajv/lib/dotjs/anyOf.js +0 -73
  92. package/packages/config-eslint/node_modules/ajv/lib/dotjs/comment.js +0 -14
  93. package/packages/config-eslint/node_modules/ajv/lib/dotjs/const.js +0 -56
  94. package/packages/config-eslint/node_modules/ajv/lib/dotjs/contains.js +0 -81
  95. package/packages/config-eslint/node_modules/ajv/lib/dotjs/custom.js +0 -228
  96. package/packages/config-eslint/node_modules/ajv/lib/dotjs/dependencies.js +0 -168
  97. package/packages/config-eslint/node_modules/ajv/lib/dotjs/enum.js +0 -66
  98. package/packages/config-eslint/node_modules/ajv/lib/dotjs/format.js +0 -150
  99. package/packages/config-eslint/node_modules/ajv/lib/dotjs/if.js +0 -103
  100. package/packages/config-eslint/node_modules/ajv/lib/dotjs/index.js +0 -33
  101. package/packages/config-eslint/node_modules/ajv/lib/dotjs/items.js +0 -140
  102. package/packages/config-eslint/node_modules/ajv/lib/dotjs/multipleOf.js +0 -80
  103. package/packages/config-eslint/node_modules/ajv/lib/dotjs/not.js +0 -84
  104. package/packages/config-eslint/node_modules/ajv/lib/dotjs/oneOf.js +0 -73
  105. package/packages/config-eslint/node_modules/ajv/lib/dotjs/pattern.js +0 -75
  106. package/packages/config-eslint/node_modules/ajv/lib/dotjs/properties.js +0 -335
  107. package/packages/config-eslint/node_modules/ajv/lib/dotjs/propertyNames.js +0 -81
  108. package/packages/config-eslint/node_modules/ajv/lib/dotjs/ref.js +0 -124
  109. package/packages/config-eslint/node_modules/ajv/lib/dotjs/required.js +0 -270
  110. package/packages/config-eslint/node_modules/ajv/lib/dotjs/uniqueItems.js +0 -86
  111. package/packages/config-eslint/node_modules/ajv/lib/dotjs/validate.js +0 -482
  112. package/packages/config-eslint/node_modules/ajv/lib/keyword.js +0 -146
  113. package/packages/config-eslint/node_modules/ajv/lib/refs/data.json +0 -17
  114. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-04.json +0 -149
  115. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-06.json +0 -154
  116. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-07.json +0 -168
  117. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-secure.json +0 -94
  118. package/packages/config-eslint/node_modules/ajv/package.json +0 -106
  119. package/packages/config-eslint/node_modules/ajv/scripts/.eslintrc.yml +0 -3
  120. package/packages/config-eslint/node_modules/ajv/scripts/bundle.js +0 -61
  121. package/packages/config-eslint/node_modules/ajv/scripts/compile-dots.js +0 -73
  122. package/packages/config-eslint/node_modules/ajv/scripts/info +0 -10
  123. package/packages/config-eslint/node_modules/ajv/scripts/prepare-tests +0 -12
  124. package/packages/config-eslint/node_modules/ajv/scripts/publish-built-version +0 -32
  125. package/packages/config-eslint/node_modules/ajv/scripts/travis-gh-pages +0 -23
  126. package/packages/config-eslint/node_modules/eslint-visitor-keys/LICENSE +0 -201
  127. package/packages/config-eslint/node_modules/eslint-visitor-keys/README.md +0 -105
  128. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs +0 -384
  129. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +0 -27
  130. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/index.d.ts +0 -16
  131. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts +0 -12
  132. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/index.js +0 -65
  133. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js +0 -315
  134. package/packages/config-eslint/node_modules/eslint-visitor-keys/package.json +0 -74
  135. package/packages/config-eslint/node_modules/espree/LICENSE +0 -25
  136. package/packages/config-eslint/node_modules/espree/README.md +0 -244
  137. package/packages/config-eslint/node_modules/espree/dist/espree.cjs +0 -883
  138. package/packages/config-eslint/node_modules/espree/espree.js +0 -177
  139. package/packages/config-eslint/node_modules/espree/lib/espree.js +0 -349
  140. package/packages/config-eslint/node_modules/espree/lib/features.js +0 -27
  141. package/packages/config-eslint/node_modules/espree/lib/options.js +0 -123
  142. package/packages/config-eslint/node_modules/espree/lib/token-translator.js +0 -263
  143. package/packages/config-eslint/node_modules/espree/lib/version.js +0 -3
  144. package/packages/config-eslint/node_modules/espree/package.json +0 -86
  145. package/packages/config-eslint/node_modules/globals/globals.json +0 -1998
  146. package/packages/config-eslint/node_modules/globals/index.d.ts +0 -2077
  147. package/packages/config-eslint/node_modules/globals/index.js +0 -2
  148. package/packages/config-eslint/node_modules/globals/license +0 -9
  149. package/packages/config-eslint/node_modules/globals/package.json +0 -58
  150. package/packages/config-eslint/node_modules/globals/readme.md +0 -44
  151. package/packages/config-eslint/node_modules/json-schema-traverse/.eslintrc.yml +0 -27
  152. package/packages/config-eslint/node_modules/json-schema-traverse/.travis.yml +0 -8
  153. package/packages/config-eslint/node_modules/json-schema-traverse/LICENSE +0 -21
  154. package/packages/config-eslint/node_modules/json-schema-traverse/README.md +0 -83
  155. package/packages/config-eslint/node_modules/json-schema-traverse/index.js +0 -89
  156. package/packages/config-eslint/node_modules/json-schema-traverse/package.json +0 -43
  157. package/packages/config-eslint/node_modules/json-schema-traverse/spec/.eslintrc.yml +0 -6
  158. package/packages/config-eslint/node_modules/json-schema-traverse/spec/fixtures/schema.js +0 -125
  159. package/packages/config-eslint/node_modules/json-schema-traverse/spec/index.spec.js +0 -171
@@ -1,81 +0,0 @@
1
- 'use strict';
2
- module.exports = function generate_propertyNames(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
- out += 'var ' + ($errs) + ' = errors;';
17
- if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
18
- $it.schema = $schema;
19
- $it.schemaPath = $schemaPath;
20
- $it.errSchemaPath = $errSchemaPath;
21
- var $key = 'key' + $lvl,
22
- $idx = 'idx' + $lvl,
23
- $i = 'i' + $lvl,
24
- $invalidName = '\' + ' + $key + ' + \'',
25
- $dataNxt = $it.dataLevel = it.dataLevel + 1,
26
- $nextData = 'data' + $dataNxt,
27
- $dataProperties = 'dataProperties' + $lvl,
28
- $ownProperties = it.opts.ownProperties,
29
- $currentBaseId = it.baseId;
30
- if ($ownProperties) {
31
- out += ' var ' + ($dataProperties) + ' = undefined; ';
32
- }
33
- if ($ownProperties) {
34
- out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';
35
- } else {
36
- out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
37
- }
38
- out += ' var startErrs' + ($lvl) + ' = errors; ';
39
- var $passData = $key;
40
- var $wasComposite = it.compositeRule;
41
- it.compositeRule = $it.compositeRule = true;
42
- var $code = it.validate($it);
43
- $it.baseId = $currentBaseId;
44
- if (it.util.varOccurences($code, $nextData) < 2) {
45
- out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
46
- } else {
47
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
48
- }
49
- it.compositeRule = $it.compositeRule = $wasComposite;
50
- out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + '<errors; ' + ($i) + '++) { vErrors[' + ($i) + '].propertyName = ' + ($key) + '; } var err = '; /* istanbul ignore else */
51
- if (it.createErrors !== false) {
52
- out += ' { keyword: \'' + ('propertyNames') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { propertyName: \'' + ($invalidName) + '\' } ';
53
- if (it.opts.messages !== false) {
54
- out += ' , message: \'property name \\\'' + ($invalidName) + '\\\' is invalid\' ';
55
- }
56
- if (it.opts.verbose) {
57
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
58
- }
59
- out += ' } ';
60
- } else {
61
- out += ' {} ';
62
- }
63
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
64
- if (!it.compositeRule && $breakOnError) {
65
- /* istanbul ignore if */
66
- if (it.async) {
67
- out += ' throw new ValidationError(vErrors); ';
68
- } else {
69
- out += ' validate.errors = vErrors; return false; ';
70
- }
71
- }
72
- if ($breakOnError) {
73
- out += ' break; ';
74
- }
75
- out += ' } }';
76
- }
77
- if ($breakOnError) {
78
- out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
79
- }
80
- return out;
81
- }
@@ -1,124 +0,0 @@
1
- 'use strict';
2
- module.exports = function generate_ref(it, $keyword, $ruleType) {
3
- var out = ' ';
4
- var $lvl = it.level;
5
- var $dataLvl = it.dataLevel;
6
- var $schema = it.schema[$keyword];
7
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
8
- var $breakOnError = !it.opts.allErrors;
9
- var $data = 'data' + ($dataLvl || '');
10
- var $valid = 'valid' + $lvl;
11
- var $async, $refCode;
12
- if ($schema == '#' || $schema == '#/') {
13
- if (it.isRoot) {
14
- $async = it.async;
15
- $refCode = 'validate';
16
- } else {
17
- $async = it.root.schema.$async === true;
18
- $refCode = 'root.refVal[0]';
19
- }
20
- } else {
21
- var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot);
22
- if ($refVal === undefined) {
23
- var $message = it.MissingRefError.message(it.baseId, $schema);
24
- if (it.opts.missingRefs == 'fail') {
25
- it.logger.error($message);
26
- var $$outStack = $$outStack || [];
27
- $$outStack.push(out);
28
- out = ''; /* istanbul ignore else */
29
- if (it.createErrors !== false) {
30
- out += ' { keyword: \'' + ('$ref') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \'' + (it.util.escapeQuotes($schema)) + '\' } ';
31
- if (it.opts.messages !== false) {
32
- out += ' , message: \'can\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\' ';
33
- }
34
- if (it.opts.verbose) {
35
- out += ' , schema: ' + (it.util.toQuotedString($schema)) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
36
- }
37
- out += ' } ';
38
- } else {
39
- out += ' {} ';
40
- }
41
- var __err = out;
42
- out = $$outStack.pop();
43
- if (!it.compositeRule && $breakOnError) {
44
- /* istanbul ignore if */
45
- if (it.async) {
46
- out += ' throw new ValidationError([' + (__err) + ']); ';
47
- } else {
48
- out += ' validate.errors = [' + (__err) + ']; return false; ';
49
- }
50
- } else {
51
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
52
- }
53
- if ($breakOnError) {
54
- out += ' if (false) { ';
55
- }
56
- } else if (it.opts.missingRefs == 'ignore') {
57
- it.logger.warn($message);
58
- if ($breakOnError) {
59
- out += ' if (true) { ';
60
- }
61
- } else {
62
- throw new it.MissingRefError(it.baseId, $schema, $message);
63
- }
64
- } else if ($refVal.inline) {
65
- var $it = it.util.copy(it);
66
- $it.level++;
67
- var $nextValid = 'valid' + $it.level;
68
- $it.schema = $refVal.schema;
69
- $it.schemaPath = '';
70
- $it.errSchemaPath = $schema;
71
- var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code);
72
- out += ' ' + ($code) + ' ';
73
- if ($breakOnError) {
74
- out += ' if (' + ($nextValid) + ') { ';
75
- }
76
- } else {
77
- $async = $refVal.$async === true || (it.async && $refVal.$async !== false);
78
- $refCode = $refVal.code;
79
- }
80
- }
81
- if ($refCode) {
82
- var $$outStack = $$outStack || [];
83
- $$outStack.push(out);
84
- out = '';
85
- if (it.opts.passContext) {
86
- out += ' ' + ($refCode) + '.call(this, ';
87
- } else {
88
- out += ' ' + ($refCode) + '( ';
89
- }
90
- out += ' ' + ($data) + ', (dataPath || \'\')';
91
- if (it.errorPath != '""') {
92
- out += ' + ' + (it.errorPath);
93
- }
94
- var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
95
- $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
96
- out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ', rootData) ';
97
- var __callValidate = out;
98
- out = $$outStack.pop();
99
- if ($async) {
100
- if (!it.async) throw new Error('async schema referenced by sync schema');
101
- if ($breakOnError) {
102
- out += ' var ' + ($valid) + '; ';
103
- }
104
- out += ' try { await ' + (__callValidate) + '; ';
105
- if ($breakOnError) {
106
- out += ' ' + ($valid) + ' = true; ';
107
- }
108
- out += ' } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ';
109
- if ($breakOnError) {
110
- out += ' ' + ($valid) + ' = false; ';
111
- }
112
- out += ' } ';
113
- if ($breakOnError) {
114
- out += ' if (' + ($valid) + ') { ';
115
- }
116
- } else {
117
- out += ' if (!' + (__callValidate) + ') { if (vErrors === null) vErrors = ' + ($refCode) + '.errors; else vErrors = vErrors.concat(' + ($refCode) + '.errors); errors = vErrors.length; } ';
118
- if ($breakOnError) {
119
- out += ' else { ';
120
- }
121
- }
122
- }
123
- return out;
124
- }
@@ -1,270 +0,0 @@
1
- 'use strict';
2
- module.exports = function generate_required(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 $isData = it.opts.$data && $schema && $schema.$data,
13
- $schemaValue;
14
- if ($isData) {
15
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
16
- $schemaValue = 'schema' + $lvl;
17
- } else {
18
- $schemaValue = $schema;
19
- }
20
- var $vSchema = 'schema' + $lvl;
21
- if (!$isData) {
22
- if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) {
23
- var $required = [];
24
- var arr1 = $schema;
25
- if (arr1) {
26
- var $property, i1 = -1,
27
- l1 = arr1.length - 1;
28
- while (i1 < l1) {
29
- $property = arr1[i1 += 1];
30
- var $propertySch = it.schema.properties[$property];
31
- if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
32
- $required[$required.length] = $property;
33
- }
34
- }
35
- }
36
- } else {
37
- var $required = $schema;
38
- }
39
- }
40
- if ($isData || $required.length) {
41
- var $currentErrorPath = it.errorPath,
42
- $loopRequired = $isData || $required.length >= it.opts.loopRequired,
43
- $ownProperties = it.opts.ownProperties;
44
- if ($breakOnError) {
45
- out += ' var missing' + ($lvl) + '; ';
46
- if ($loopRequired) {
47
- if (!$isData) {
48
- out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';
49
- }
50
- var $i = 'i' + $lvl,
51
- $propertyPath = 'schema' + $lvl + '[' + $i + ']',
52
- $missingProperty = '\' + ' + $propertyPath + ' + \'';
53
- if (it.opts._errorDataPathProperty) {
54
- it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
55
- }
56
- out += ' var ' + ($valid) + ' = true; ';
57
- if ($isData) {
58
- out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';
59
- }
60
- out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined ';
61
- if ($ownProperties) {
62
- out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';
63
- }
64
- out += '; if (!' + ($valid) + ') break; } ';
65
- if ($isData) {
66
- out += ' } ';
67
- }
68
- out += ' if (!' + ($valid) + ') { ';
69
- var $$outStack = $$outStack || [];
70
- $$outStack.push(out);
71
- out = ''; /* istanbul ignore else */
72
- if (it.createErrors !== false) {
73
- out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
74
- if (it.opts.messages !== false) {
75
- out += ' , message: \'';
76
- if (it.opts._errorDataPathProperty) {
77
- out += 'is a required property';
78
- } else {
79
- out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
80
- }
81
- out += '\' ';
82
- }
83
- if (it.opts.verbose) {
84
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
85
- }
86
- out += ' } ';
87
- } else {
88
- out += ' {} ';
89
- }
90
- var __err = out;
91
- out = $$outStack.pop();
92
- if (!it.compositeRule && $breakOnError) {
93
- /* istanbul ignore if */
94
- if (it.async) {
95
- out += ' throw new ValidationError([' + (__err) + ']); ';
96
- } else {
97
- out += ' validate.errors = [' + (__err) + ']; return false; ';
98
- }
99
- } else {
100
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
101
- }
102
- out += ' } else { ';
103
- } else {
104
- out += ' if ( ';
105
- var arr2 = $required;
106
- if (arr2) {
107
- var $propertyKey, $i = -1,
108
- l2 = arr2.length - 1;
109
- while ($i < l2) {
110
- $propertyKey = arr2[$i += 1];
111
- if ($i) {
112
- out += ' || ';
113
- }
114
- var $prop = it.util.getProperty($propertyKey),
115
- $useData = $data + $prop;
116
- out += ' ( ( ' + ($useData) + ' === undefined ';
117
- if ($ownProperties) {
118
- out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
119
- }
120
- out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';
121
- }
122
- }
123
- out += ') { ';
124
- var $propertyPath = 'missing' + $lvl,
125
- $missingProperty = '\' + ' + $propertyPath + ' + \'';
126
- if (it.opts._errorDataPathProperty) {
127
- it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;
128
- }
129
- var $$outStack = $$outStack || [];
130
- $$outStack.push(out);
131
- out = ''; /* istanbul ignore else */
132
- if (it.createErrors !== false) {
133
- out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
134
- if (it.opts.messages !== false) {
135
- out += ' , message: \'';
136
- if (it.opts._errorDataPathProperty) {
137
- out += 'is a required property';
138
- } else {
139
- out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
140
- }
141
- out += '\' ';
142
- }
143
- if (it.opts.verbose) {
144
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
145
- }
146
- out += ' } ';
147
- } else {
148
- out += ' {} ';
149
- }
150
- var __err = out;
151
- out = $$outStack.pop();
152
- if (!it.compositeRule && $breakOnError) {
153
- /* istanbul ignore if */
154
- if (it.async) {
155
- out += ' throw new ValidationError([' + (__err) + ']); ';
156
- } else {
157
- out += ' validate.errors = [' + (__err) + ']; return false; ';
158
- }
159
- } else {
160
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
161
- }
162
- out += ' } else { ';
163
- }
164
- } else {
165
- if ($loopRequired) {
166
- if (!$isData) {
167
- out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';
168
- }
169
- var $i = 'i' + $lvl,
170
- $propertyPath = 'schema' + $lvl + '[' + $i + ']',
171
- $missingProperty = '\' + ' + $propertyPath + ' + \'';
172
- if (it.opts._errorDataPathProperty) {
173
- it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
174
- }
175
- if ($isData) {
176
- out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */
177
- if (it.createErrors !== false) {
178
- out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
179
- if (it.opts.messages !== false) {
180
- out += ' , message: \'';
181
- if (it.opts._errorDataPathProperty) {
182
- out += 'is a required property';
183
- } else {
184
- out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
185
- }
186
- out += '\' ';
187
- }
188
- if (it.opts.verbose) {
189
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
190
- }
191
- out += ' } ';
192
- } else {
193
- out += ' {} ';
194
- }
195
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { ';
196
- }
197
- out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined ';
198
- if ($ownProperties) {
199
- out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';
200
- }
201
- out += ') { var err = '; /* istanbul ignore else */
202
- if (it.createErrors !== false) {
203
- out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
204
- if (it.opts.messages !== false) {
205
- out += ' , message: \'';
206
- if (it.opts._errorDataPathProperty) {
207
- out += 'is a required property';
208
- } else {
209
- out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
210
- }
211
- out += '\' ';
212
- }
213
- if (it.opts.verbose) {
214
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
215
- }
216
- out += ' } ';
217
- } else {
218
- out += ' {} ';
219
- }
220
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ';
221
- if ($isData) {
222
- out += ' } ';
223
- }
224
- } else {
225
- var arr3 = $required;
226
- if (arr3) {
227
- var $propertyKey, i3 = -1,
228
- l3 = arr3.length - 1;
229
- while (i3 < l3) {
230
- $propertyKey = arr3[i3 += 1];
231
- var $prop = it.util.getProperty($propertyKey),
232
- $missingProperty = it.util.escapeQuotes($propertyKey),
233
- $useData = $data + $prop;
234
- if (it.opts._errorDataPathProperty) {
235
- it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
236
- }
237
- out += ' if ( ' + ($useData) + ' === undefined ';
238
- if ($ownProperties) {
239
- out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
240
- }
241
- out += ') { var err = '; /* istanbul ignore else */
242
- if (it.createErrors !== false) {
243
- out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
244
- if (it.opts.messages !== false) {
245
- out += ' , message: \'';
246
- if (it.opts._errorDataPathProperty) {
247
- out += 'is a required property';
248
- } else {
249
- out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
250
- }
251
- out += '\' ';
252
- }
253
- if (it.opts.verbose) {
254
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
255
- }
256
- out += ' } ';
257
- } else {
258
- out += ' {} ';
259
- }
260
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
261
- }
262
- }
263
- }
264
- }
265
- it.errorPath = $currentErrorPath;
266
- } else if ($breakOnError) {
267
- out += ' if (true) {';
268
- }
269
- return out;
270
- }
@@ -1,86 +0,0 @@
1
- 'use strict';
2
- module.exports = function generate_uniqueItems(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 $isData = it.opts.$data && $schema && $schema.$data,
13
- $schemaValue;
14
- if ($isData) {
15
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
16
- $schemaValue = 'schema' + $lvl;
17
- } else {
18
- $schemaValue = $schema;
19
- }
20
- if (($schema || $isData) && it.opts.uniqueItems !== false) {
21
- if ($isData) {
22
- out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { ';
23
- }
24
- out += ' var i = ' + ($data) + '.length , ' + ($valid) + ' = true , j; if (i > 1) { ';
25
- var $itemType = it.schema.items && it.schema.items.type,
26
- $typeIsArray = Array.isArray($itemType);
27
- if (!$itemType || $itemType == 'object' || $itemType == 'array' || ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0))) {
28
- out += ' outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } ';
29
- } else {
30
- out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';
31
- var $method = 'checkDataType' + ($typeIsArray ? 's' : '');
32
- out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';
33
- if ($typeIsArray) {
34
- out += ' if (typeof item == \'string\') item = \'"\' + item; ';
35
- }
36
- out += ' if (typeof itemIndices[item] == \'number\') { ' + ($valid) + ' = false; j = itemIndices[item]; break; } itemIndices[item] = i; } ';
37
- }
38
- out += ' } ';
39
- if ($isData) {
40
- out += ' } ';
41
- }
42
- out += ' if (!' + ($valid) + ') { ';
43
- var $$outStack = $$outStack || [];
44
- $$outStack.push(out);
45
- out = ''; /* istanbul ignore else */
46
- if (it.createErrors !== false) {
47
- out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } ';
48
- if (it.opts.messages !== false) {
49
- out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' ';
50
- }
51
- if (it.opts.verbose) {
52
- out += ' , schema: ';
53
- if ($isData) {
54
- out += 'validate.schema' + ($schemaPath);
55
- } else {
56
- out += '' + ($schema);
57
- }
58
- out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
59
- }
60
- out += ' } ';
61
- } else {
62
- out += ' {} ';
63
- }
64
- var __err = out;
65
- out = $$outStack.pop();
66
- if (!it.compositeRule && $breakOnError) {
67
- /* istanbul ignore if */
68
- if (it.async) {
69
- out += ' throw new ValidationError([' + (__err) + ']); ';
70
- } else {
71
- out += ' validate.errors = [' + (__err) + ']; return false; ';
72
- }
73
- } else {
74
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
75
- }
76
- out += ' } ';
77
- if ($breakOnError) {
78
- out += ' else { ';
79
- }
80
- } else {
81
- if ($breakOnError) {
82
- out += ' if (true) { ';
83
- }
84
- }
85
- return out;
86
- }