@alexlit/lint-kit 117.2.0 → 117.3.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 (169) hide show
  1. package/package.json +2 -2
  2. package/packages/config-commitlint/package.json +2 -2
  3. package/packages/config-eslint/index.js +7 -374
  4. package/packages/config-eslint/legacy.js +3 -0
  5. package/packages/config-eslint/node_modules/@eslint/eslintrc/LICENSE +19 -0
  6. package/packages/config-eslint/node_modules/@eslint/eslintrc/README.md +126 -0
  7. package/packages/config-eslint/node_modules/@eslint/eslintrc/conf/config-schema.js +79 -0
  8. package/packages/config-eslint/node_modules/@eslint/eslintrc/conf/environments.js +215 -0
  9. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +1143 -0
  10. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +1 -0
  11. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +4371 -0
  12. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +1 -0
  13. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +532 -0
  14. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +510 -0
  15. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js +124 -0
  16. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js +145 -0
  17. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js +238 -0
  18. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/index.js +19 -0
  19. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js +225 -0
  20. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js +1155 -0
  21. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/flat-compat.js +318 -0
  22. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/index-universal.js +29 -0
  23. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/index.js +58 -0
  24. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/ajv.js +191 -0
  25. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/config-ops.js +135 -0
  26. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +370 -0
  27. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js +63 -0
  28. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/naming.js +96 -0
  29. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js +42 -0
  30. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/types.js +149 -0
  31. package/packages/config-eslint/node_modules/@eslint/eslintrc/package.json +82 -0
  32. package/packages/config-eslint/node_modules/@eslint/eslintrc/universal.js +9 -0
  33. package/packages/config-eslint/node_modules/ajv/.tonic_example.js +20 -0
  34. package/packages/config-eslint/node_modules/ajv/LICENSE +22 -0
  35. package/packages/config-eslint/node_modules/ajv/README.md +1497 -0
  36. package/packages/config-eslint/node_modules/ajv/dist/ajv.bundle.js +7189 -0
  37. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js +3 -0
  38. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js.map +1 -0
  39. package/packages/config-eslint/node_modules/ajv/lib/ajv.d.ts +397 -0
  40. package/packages/config-eslint/node_modules/ajv/lib/ajv.js +506 -0
  41. package/packages/config-eslint/node_modules/ajv/lib/cache.js +26 -0
  42. package/packages/config-eslint/node_modules/ajv/lib/compile/async.js +90 -0
  43. package/packages/config-eslint/node_modules/ajv/lib/compile/equal.js +5 -0
  44. package/packages/config-eslint/node_modules/ajv/lib/compile/error_classes.js +34 -0
  45. package/packages/config-eslint/node_modules/ajv/lib/compile/formats.js +142 -0
  46. package/packages/config-eslint/node_modules/ajv/lib/compile/index.js +387 -0
  47. package/packages/config-eslint/node_modules/ajv/lib/compile/resolve.js +270 -0
  48. package/packages/config-eslint/node_modules/ajv/lib/compile/rules.js +66 -0
  49. package/packages/config-eslint/node_modules/ajv/lib/compile/schema_obj.js +9 -0
  50. package/packages/config-eslint/node_modules/ajv/lib/compile/ucs2length.js +20 -0
  51. package/packages/config-eslint/node_modules/ajv/lib/compile/util.js +239 -0
  52. package/packages/config-eslint/node_modules/ajv/lib/data.js +49 -0
  53. package/packages/config-eslint/node_modules/ajv/lib/definition_schema.js +37 -0
  54. package/packages/config-eslint/node_modules/ajv/lib/dot/_limit.jst +113 -0
  55. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitItems.jst +12 -0
  56. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitLength.jst +12 -0
  57. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitProperties.jst +12 -0
  58. package/packages/config-eslint/node_modules/ajv/lib/dot/allOf.jst +32 -0
  59. package/packages/config-eslint/node_modules/ajv/lib/dot/anyOf.jst +46 -0
  60. package/packages/config-eslint/node_modules/ajv/lib/dot/coerce.def +51 -0
  61. package/packages/config-eslint/node_modules/ajv/lib/dot/comment.jst +9 -0
  62. package/packages/config-eslint/node_modules/ajv/lib/dot/const.jst +11 -0
  63. package/packages/config-eslint/node_modules/ajv/lib/dot/contains.jst +55 -0
  64. package/packages/config-eslint/node_modules/ajv/lib/dot/custom.jst +191 -0
  65. package/packages/config-eslint/node_modules/ajv/lib/dot/defaults.def +47 -0
  66. package/packages/config-eslint/node_modules/ajv/lib/dot/definitions.def +203 -0
  67. package/packages/config-eslint/node_modules/ajv/lib/dot/dependencies.jst +79 -0
  68. package/packages/config-eslint/node_modules/ajv/lib/dot/enum.jst +30 -0
  69. package/packages/config-eslint/node_modules/ajv/lib/dot/errors.def +194 -0
  70. package/packages/config-eslint/node_modules/ajv/lib/dot/format.jst +106 -0
  71. package/packages/config-eslint/node_modules/ajv/lib/dot/if.jst +73 -0
  72. package/packages/config-eslint/node_modules/ajv/lib/dot/items.jst +98 -0
  73. package/packages/config-eslint/node_modules/ajv/lib/dot/missing.def +39 -0
  74. package/packages/config-eslint/node_modules/ajv/lib/dot/multipleOf.jst +22 -0
  75. package/packages/config-eslint/node_modules/ajv/lib/dot/not.jst +43 -0
  76. package/packages/config-eslint/node_modules/ajv/lib/dot/oneOf.jst +54 -0
  77. package/packages/config-eslint/node_modules/ajv/lib/dot/pattern.jst +14 -0
  78. package/packages/config-eslint/node_modules/ajv/lib/dot/properties.jst +245 -0
  79. package/packages/config-eslint/node_modules/ajv/lib/dot/propertyNames.jst +52 -0
  80. package/packages/config-eslint/node_modules/ajv/lib/dot/ref.jst +85 -0
  81. package/packages/config-eslint/node_modules/ajv/lib/dot/required.jst +108 -0
  82. package/packages/config-eslint/node_modules/ajv/lib/dot/uniqueItems.jst +62 -0
  83. package/packages/config-eslint/node_modules/ajv/lib/dot/validate.jst +276 -0
  84. package/packages/config-eslint/node_modules/ajv/lib/dotjs/README.md +3 -0
  85. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limit.js +163 -0
  86. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitItems.js +80 -0
  87. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitLength.js +85 -0
  88. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitProperties.js +80 -0
  89. package/packages/config-eslint/node_modules/ajv/lib/dotjs/allOf.js +42 -0
  90. package/packages/config-eslint/node_modules/ajv/lib/dotjs/anyOf.js +73 -0
  91. package/packages/config-eslint/node_modules/ajv/lib/dotjs/comment.js +14 -0
  92. package/packages/config-eslint/node_modules/ajv/lib/dotjs/const.js +56 -0
  93. package/packages/config-eslint/node_modules/ajv/lib/dotjs/contains.js +81 -0
  94. package/packages/config-eslint/node_modules/ajv/lib/dotjs/custom.js +228 -0
  95. package/packages/config-eslint/node_modules/ajv/lib/dotjs/dependencies.js +168 -0
  96. package/packages/config-eslint/node_modules/ajv/lib/dotjs/enum.js +66 -0
  97. package/packages/config-eslint/node_modules/ajv/lib/dotjs/format.js +150 -0
  98. package/packages/config-eslint/node_modules/ajv/lib/dotjs/if.js +103 -0
  99. package/packages/config-eslint/node_modules/ajv/lib/dotjs/index.js +33 -0
  100. package/packages/config-eslint/node_modules/ajv/lib/dotjs/items.js +140 -0
  101. package/packages/config-eslint/node_modules/ajv/lib/dotjs/multipleOf.js +80 -0
  102. package/packages/config-eslint/node_modules/ajv/lib/dotjs/not.js +84 -0
  103. package/packages/config-eslint/node_modules/ajv/lib/dotjs/oneOf.js +73 -0
  104. package/packages/config-eslint/node_modules/ajv/lib/dotjs/pattern.js +75 -0
  105. package/packages/config-eslint/node_modules/ajv/lib/dotjs/properties.js +335 -0
  106. package/packages/config-eslint/node_modules/ajv/lib/dotjs/propertyNames.js +81 -0
  107. package/packages/config-eslint/node_modules/ajv/lib/dotjs/ref.js +124 -0
  108. package/packages/config-eslint/node_modules/ajv/lib/dotjs/required.js +270 -0
  109. package/packages/config-eslint/node_modules/ajv/lib/dotjs/uniqueItems.js +86 -0
  110. package/packages/config-eslint/node_modules/ajv/lib/dotjs/validate.js +482 -0
  111. package/packages/config-eslint/node_modules/ajv/lib/keyword.js +146 -0
  112. package/packages/config-eslint/node_modules/ajv/lib/refs/data.json +17 -0
  113. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-04.json +149 -0
  114. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-06.json +154 -0
  115. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-07.json +168 -0
  116. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-secure.json +94 -0
  117. package/packages/config-eslint/node_modules/ajv/package.json +106 -0
  118. package/packages/config-eslint/node_modules/ajv/scripts/.eslintrc.yml +3 -0
  119. package/packages/config-eslint/node_modules/ajv/scripts/bundle.js +61 -0
  120. package/packages/config-eslint/node_modules/ajv/scripts/compile-dots.js +73 -0
  121. package/packages/config-eslint/node_modules/ajv/scripts/info +10 -0
  122. package/packages/config-eslint/node_modules/ajv/scripts/prepare-tests +12 -0
  123. package/packages/config-eslint/node_modules/ajv/scripts/publish-built-version +32 -0
  124. package/packages/config-eslint/node_modules/ajv/scripts/travis-gh-pages +23 -0
  125. package/packages/config-eslint/node_modules/eslint-visitor-keys/LICENSE +201 -0
  126. package/packages/config-eslint/node_modules/eslint-visitor-keys/README.md +105 -0
  127. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs +384 -0
  128. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +27 -0
  129. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/index.d.ts +16 -0
  130. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts +12 -0
  131. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/index.js +65 -0
  132. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js +315 -0
  133. package/packages/config-eslint/node_modules/eslint-visitor-keys/package.json +74 -0
  134. package/packages/config-eslint/node_modules/espree/LICENSE +25 -0
  135. package/packages/config-eslint/node_modules/espree/README.md +244 -0
  136. package/packages/config-eslint/node_modules/espree/dist/espree.cjs +883 -0
  137. package/packages/config-eslint/node_modules/espree/espree.js +177 -0
  138. package/packages/config-eslint/node_modules/espree/lib/espree.js +349 -0
  139. package/packages/config-eslint/node_modules/espree/lib/features.js +27 -0
  140. package/packages/config-eslint/node_modules/espree/lib/options.js +123 -0
  141. package/packages/config-eslint/node_modules/espree/lib/token-translator.js +263 -0
  142. package/packages/config-eslint/node_modules/espree/lib/version.js +3 -0
  143. package/packages/config-eslint/node_modules/espree/package.json +86 -0
  144. package/packages/config-eslint/node_modules/globals/globals.json +1998 -0
  145. package/packages/config-eslint/node_modules/globals/index.d.ts +2077 -0
  146. package/packages/config-eslint/node_modules/globals/index.js +2 -0
  147. package/packages/config-eslint/node_modules/globals/license +9 -0
  148. package/packages/config-eslint/node_modules/globals/package.json +58 -0
  149. package/packages/config-eslint/node_modules/globals/readme.md +44 -0
  150. package/packages/config-eslint/node_modules/json-schema-traverse/.eslintrc.yml +27 -0
  151. package/packages/config-eslint/node_modules/json-schema-traverse/.travis.yml +8 -0
  152. package/packages/config-eslint/node_modules/json-schema-traverse/LICENSE +21 -0
  153. package/packages/config-eslint/node_modules/json-schema-traverse/README.md +83 -0
  154. package/packages/config-eslint/node_modules/json-schema-traverse/index.js +89 -0
  155. package/packages/config-eslint/node_modules/json-schema-traverse/package.json +43 -0
  156. package/packages/config-eslint/node_modules/json-schema-traverse/spec/.eslintrc.yml +6 -0
  157. package/packages/config-eslint/node_modules/json-schema-traverse/spec/fixtures/schema.js +125 -0
  158. package/packages/config-eslint/node_modules/json-schema-traverse/spec/index.spec.js +171 -0
  159. package/packages/config-eslint/package.json +7 -5
  160. package/packages/config-eslint/plugins/no-await-in-promise.js +2 -2
  161. package/packages/config-eslint/utils/create-config.js +377 -0
  162. package/packages/config-hooks/package.json +1 -1
  163. package/packages/config-htmllint/package.json +1 -1
  164. package/packages/config-markdownlint/package.json +2 -2
  165. package/packages/config-npmlint/package.json +1 -1
  166. package/packages/config-prettier/package.json +2 -2
  167. package/packages/config-stylelint/package.json +2 -2
  168. package/scripts/lint.eslint.sh +1 -1
  169. package/.eslintrc.cjs +0 -16
@@ -0,0 +1,98 @@
1
+ {{# def.definitions }}
2
+ {{# def.errors }}
3
+ {{# def.setupKeyword }}
4
+ {{# def.setupNextLevel }}
5
+
6
+
7
+ {{## def.validateItems:startFrom:
8
+ for (var {{=$idx}} = {{=startFrom}}; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) {
9
+ {{
10
+ $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
11
+ var $passData = $data + '[' + $idx + ']';
12
+ $it.dataPathArr[$dataNxt] = $idx;
13
+ }}
14
+
15
+ {{# def.generateSubschemaCode }}
16
+ {{# def.optimizeValidate }}
17
+
18
+ {{? $breakOnError }}
19
+ if (!{{=$nextValid}}) break;
20
+ {{?}}
21
+ }
22
+ #}}
23
+
24
+ {{
25
+ var $idx = 'i' + $lvl
26
+ , $dataNxt = $it.dataLevel = it.dataLevel + 1
27
+ , $nextData = 'data' + $dataNxt
28
+ , $currentBaseId = it.baseId;
29
+ }}
30
+
31
+ var {{=$errs}} = errors;
32
+ var {{=$valid}};
33
+
34
+ {{? Array.isArray($schema) }}
35
+ {{ /* 'items' is an array of schemas */}}
36
+ {{ var $additionalItems = it.schema.additionalItems; }}
37
+ {{? $additionalItems === false }}
38
+ {{=$valid}} = {{=$data}}.length <= {{= $schema.length }};
39
+ {{
40
+ var $currErrSchemaPath = $errSchemaPath;
41
+ $errSchemaPath = it.errSchemaPath + '/additionalItems';
42
+ }}
43
+ {{# def.checkError:'additionalItems' }}
44
+ {{ $errSchemaPath = $currErrSchemaPath; }}
45
+ {{# def.elseIfValid}}
46
+ {{?}}
47
+
48
+ {{~ $schema:$sch:$i }}
49
+ {{? {{# def.nonEmptySchema:$sch }} }}
50
+ {{=$nextValid}} = true;
51
+
52
+ if ({{=$data}}.length > {{=$i}}) {
53
+ {{
54
+ var $passData = $data + '[' + $i + ']';
55
+ $it.schema = $sch;
56
+ $it.schemaPath = $schemaPath + '[' + $i + ']';
57
+ $it.errSchemaPath = $errSchemaPath + '/' + $i;
58
+ $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);
59
+ $it.dataPathArr[$dataNxt] = $i;
60
+ }}
61
+
62
+ {{# def.generateSubschemaCode }}
63
+ {{# def.optimizeValidate }}
64
+ }
65
+
66
+ {{# def.ifResultValid }}
67
+ {{?}}
68
+ {{~}}
69
+
70
+ {{? typeof $additionalItems == 'object' && {{# def.nonEmptySchema:$additionalItems }} }}
71
+ {{
72
+ $it.schema = $additionalItems;
73
+ $it.schemaPath = it.schemaPath + '.additionalItems';
74
+ $it.errSchemaPath = it.errSchemaPath + '/additionalItems';
75
+ }}
76
+ {{=$nextValid}} = true;
77
+
78
+ if ({{=$data}}.length > {{= $schema.length }}) {
79
+ {{# def.validateItems: $schema.length }}
80
+ }
81
+
82
+ {{# def.ifResultValid }}
83
+ {{?}}
84
+
85
+ {{?? {{# def.nonEmptySchema:$schema }} }}
86
+ {{ /* 'items' is a single schema */}}
87
+ {{
88
+ $it.schema = $schema;
89
+ $it.schemaPath = $schemaPath;
90
+ $it.errSchemaPath = $errSchemaPath;
91
+ }}
92
+ {{# def.validateItems: 0 }}
93
+ {{?}}
94
+
95
+ {{? $breakOnError }}
96
+ {{= $closingBraces }}
97
+ if ({{=$errs}} == errors) {
98
+ {{?}}
@@ -0,0 +1,39 @@
1
+ {{## def.checkMissingProperty:_properties:
2
+ {{~ _properties:$propertyKey:$i }}
3
+ {{?$i}} || {{?}}
4
+ {{
5
+ var $prop = it.util.getProperty($propertyKey)
6
+ , $useData = $data + $prop;
7
+ }}
8
+ ( ({{# def.noPropertyInData }}) && (missing{{=$lvl}} = {{= it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) }}) )
9
+ {{~}}
10
+ #}}
11
+
12
+
13
+ {{## def.errorMissingProperty:_error:
14
+ {{
15
+ var $propertyPath = 'missing' + $lvl
16
+ , $missingProperty = '\' + ' + $propertyPath + ' + \'';
17
+ if (it.opts._errorDataPathProperty) {
18
+ it.errorPath = it.opts.jsonPointers
19
+ ? it.util.getPathExpr($currentErrorPath, $propertyPath, true)
20
+ : $currentErrorPath + ' + ' + $propertyPath;
21
+ }
22
+ }}
23
+ {{# def.error:_error }}
24
+ #}}
25
+
26
+
27
+ {{## def.allErrorsMissingProperty:_error:
28
+ {{
29
+ var $prop = it.util.getProperty($propertyKey)
30
+ , $missingProperty = it.util.escapeQuotes($propertyKey)
31
+ , $useData = $data + $prop;
32
+ if (it.opts._errorDataPathProperty) {
33
+ it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
34
+ }
35
+ }}
36
+ if ({{# def.noPropertyInData }}) {
37
+ {{# def.addError:_error }}
38
+ }
39
+ #}}
@@ -0,0 +1,22 @@
1
+ {{# def.definitions }}
2
+ {{# def.errors }}
3
+ {{# def.setupKeyword }}
4
+ {{# def.$data }}
5
+
6
+ {{# def.numberKeyword }}
7
+
8
+ var division{{=$lvl}};
9
+ if ({{?$isData}}
10
+ {{=$schemaValue}} !== undefined && (
11
+ typeof {{=$schemaValue}} != 'number' ||
12
+ {{?}}
13
+ (division{{=$lvl}} = {{=$data}} / {{=$schemaValue}},
14
+ {{? it.opts.multipleOfPrecision }}
15
+ Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}}
16
+ {{??}}
17
+ division{{=$lvl}} !== parseInt(division{{=$lvl}})
18
+ {{?}}
19
+ )
20
+ {{?$isData}} ) {{?}} ) {
21
+ {{# def.error:'multipleOf' }}
22
+ } {{? $breakOnError }} else { {{?}}
@@ -0,0 +1,43 @@
1
+ {{# def.definitions }}
2
+ {{# def.errors }}
3
+ {{# def.setupKeyword }}
4
+ {{# def.setupNextLevel }}
5
+
6
+ {{? {{# def.nonEmptySchema:$schema }} }}
7
+ {{
8
+ $it.schema = $schema;
9
+ $it.schemaPath = $schemaPath;
10
+ $it.errSchemaPath = $errSchemaPath;
11
+ }}
12
+
13
+ var {{=$errs}} = errors;
14
+
15
+ {{# def.setCompositeRule }}
16
+
17
+ {{
18
+ $it.createErrors = false;
19
+ var $allErrorsOption;
20
+ if ($it.opts.allErrors) {
21
+ $allErrorsOption = $it.opts.allErrors;
22
+ $it.opts.allErrors = false;
23
+ }
24
+ }}
25
+ {{= it.validate($it) }}
26
+ {{
27
+ $it.createErrors = true;
28
+ if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;
29
+ }}
30
+
31
+ {{# def.resetCompositeRule }}
32
+
33
+ if ({{=$nextValid}}) {
34
+ {{# def.error:'not' }}
35
+ } else {
36
+ {{# def.resetErrors }}
37
+ {{? it.opts.allErrors }} } {{?}}
38
+ {{??}}
39
+ {{# def.addError:'not' }}
40
+ {{? $breakOnError}}
41
+ if (false) {
42
+ {{?}}
43
+ {{?}}
@@ -0,0 +1,54 @@
1
+ {{# def.definitions }}
2
+ {{# def.errors }}
3
+ {{# def.setupKeyword }}
4
+ {{# def.setupNextLevel }}
5
+
6
+ {{
7
+ var $currentBaseId = $it.baseId
8
+ , $prevValid = 'prevValid' + $lvl
9
+ , $passingSchemas = 'passingSchemas' + $lvl;
10
+ }}
11
+
12
+ var {{=$errs}} = errors
13
+ , {{=$prevValid}} = false
14
+ , {{=$valid}} = false
15
+ , {{=$passingSchemas}} = null;
16
+
17
+ {{# def.setCompositeRule }}
18
+
19
+ {{~ $schema:$sch:$i }}
20
+ {{? {{# def.nonEmptySchema:$sch }} }}
21
+ {{
22
+ $it.schema = $sch;
23
+ $it.schemaPath = $schemaPath + '[' + $i + ']';
24
+ $it.errSchemaPath = $errSchemaPath + '/' + $i;
25
+ }}
26
+
27
+ {{# def.insertSubschemaCode }}
28
+ {{??}}
29
+ var {{=$nextValid}} = true;
30
+ {{?}}
31
+
32
+ {{? $i }}
33
+ if ({{=$nextValid}} && {{=$prevValid}}) {
34
+ {{=$valid}} = false;
35
+ {{=$passingSchemas}} = [{{=$passingSchemas}}, {{=$i}}];
36
+ } else {
37
+ {{ $closingBraces += '}'; }}
38
+ {{?}}
39
+
40
+ if ({{=$nextValid}}) {
41
+ {{=$valid}} = {{=$prevValid}} = true;
42
+ {{=$passingSchemas}} = {{=$i}};
43
+ }
44
+ {{~}}
45
+
46
+ {{# def.resetCompositeRule }}
47
+
48
+ {{= $closingBraces }}
49
+
50
+ if (!{{=$valid}}) {
51
+ {{# def.extraError:'oneOf' }}
52
+ } else {
53
+ {{# def.resetErrors }}
54
+ {{? it.opts.allErrors }} } {{?}}
@@ -0,0 +1,14 @@
1
+ {{# def.definitions }}
2
+ {{# def.errors }}
3
+ {{# def.setupKeyword }}
4
+ {{# def.$data }}
5
+
6
+ {{
7
+ var $regexp = $isData
8
+ ? '(new RegExp(' + $schemaValue + '))'
9
+ : it.usePattern($schema);
10
+ }}
11
+
12
+ if ({{# def.$dataNotType:'string' }} !{{=$regexp}}.test({{=$data}}) ) {
13
+ {{# def.error:'pattern' }}
14
+ } {{? $breakOnError }} else { {{?}}
@@ -0,0 +1,245 @@
1
+ {{# def.definitions }}
2
+ {{# def.errors }}
3
+ {{# def.setupKeyword }}
4
+ {{# def.setupNextLevel }}
5
+
6
+
7
+ {{## def.validateAdditional:
8
+ {{ /* additionalProperties is schema */
9
+ $it.schema = $aProperties;
10
+ $it.schemaPath = it.schemaPath + '.additionalProperties';
11
+ $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
12
+ $it.errorPath = it.opts._errorDataPathProperty
13
+ ? it.errorPath
14
+ : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
15
+ var $passData = $data + '[' + $key + ']';
16
+ $it.dataPathArr[$dataNxt] = $key;
17
+ }}
18
+
19
+ {{# def.generateSubschemaCode }}
20
+ {{# def.optimizeValidate }}
21
+ #}}
22
+
23
+
24
+ {{
25
+ var $key = 'key' + $lvl
26
+ , $idx = 'idx' + $lvl
27
+ , $dataNxt = $it.dataLevel = it.dataLevel + 1
28
+ , $nextData = 'data' + $dataNxt
29
+ , $dataProperties = 'dataProperties' + $lvl;
30
+
31
+ var $schemaKeys = Object.keys($schema || {}).filter(notProto)
32
+ , $pProperties = it.schema.patternProperties || {}
33
+ , $pPropertyKeys = Object.keys($pProperties).filter(notProto)
34
+ , $aProperties = it.schema.additionalProperties
35
+ , $someProperties = $schemaKeys.length || $pPropertyKeys.length
36
+ , $noAdditional = $aProperties === false
37
+ , $additionalIsSchema = typeof $aProperties == 'object'
38
+ && Object.keys($aProperties).length
39
+ , $removeAdditional = it.opts.removeAdditional
40
+ , $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional
41
+ , $ownProperties = it.opts.ownProperties
42
+ , $currentBaseId = it.baseId;
43
+
44
+ var $required = it.schema.required;
45
+ if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
46
+ var $requiredHash = it.util.toHash($required);
47
+ }
48
+
49
+ function notProto(p) { return p !== '__proto__'; }
50
+ }}
51
+
52
+
53
+ var {{=$errs}} = errors;
54
+ var {{=$nextValid}} = true;
55
+ {{? $ownProperties }}
56
+ var {{=$dataProperties}} = undefined;
57
+ {{?}}
58
+
59
+ {{? $checkAdditional }}
60
+ {{# def.iterateProperties }}
61
+ {{? $someProperties }}
62
+ var isAdditional{{=$lvl}} = !(false
63
+ {{? $schemaKeys.length }}
64
+ {{? $schemaKeys.length > 8 }}
65
+ || validate.schema{{=$schemaPath}}.hasOwnProperty({{=$key}})
66
+ {{??}}
67
+ {{~ $schemaKeys:$propertyKey }}
68
+ || {{=$key}} == {{= it.util.toQuotedString($propertyKey) }}
69
+ {{~}}
70
+ {{?}}
71
+ {{?}}
72
+ {{? $pPropertyKeys.length }}
73
+ {{~ $pPropertyKeys:$pProperty:$i }}
74
+ || {{= it.usePattern($pProperty) }}.test({{=$key}})
75
+ {{~}}
76
+ {{?}}
77
+ );
78
+
79
+ if (isAdditional{{=$lvl}}) {
80
+ {{?}}
81
+ {{? $removeAdditional == 'all' }}
82
+ delete {{=$data}}[{{=$key}}];
83
+ {{??}}
84
+ {{
85
+ var $currentErrorPath = it.errorPath;
86
+ var $additionalProperty = '\' + ' + $key + ' + \'';
87
+ if (it.opts._errorDataPathProperty) {
88
+ it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
89
+ }
90
+ }}
91
+ {{? $noAdditional }}
92
+ {{? $removeAdditional }}
93
+ delete {{=$data}}[{{=$key}}];
94
+ {{??}}
95
+ {{=$nextValid}} = false;
96
+ {{
97
+ var $currErrSchemaPath = $errSchemaPath;
98
+ $errSchemaPath = it.errSchemaPath + '/additionalProperties';
99
+ }}
100
+ {{# def.error:'additionalProperties' }}
101
+ {{ $errSchemaPath = $currErrSchemaPath; }}
102
+ {{? $breakOnError }} break; {{?}}
103
+ {{?}}
104
+ {{?? $additionalIsSchema }}
105
+ {{? $removeAdditional == 'failing' }}
106
+ var {{=$errs}} = errors;
107
+ {{# def.setCompositeRule }}
108
+
109
+ {{# def.validateAdditional }}
110
+
111
+ if (!{{=$nextValid}}) {
112
+ errors = {{=$errs}};
113
+ if (validate.errors !== null) {
114
+ if (errors) validate.errors.length = errors;
115
+ else validate.errors = null;
116
+ }
117
+ delete {{=$data}}[{{=$key}}];
118
+ }
119
+
120
+ {{# def.resetCompositeRule }}
121
+ {{??}}
122
+ {{# def.validateAdditional }}
123
+ {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
124
+ {{?}}
125
+ {{?}}
126
+ {{ it.errorPath = $currentErrorPath; }}
127
+ {{?}}
128
+ {{? $someProperties }}
129
+ }
130
+ {{?}}
131
+ }
132
+
133
+ {{# def.ifResultValid }}
134
+ {{?}}
135
+
136
+ {{ var $useDefaults = it.opts.useDefaults && !it.compositeRule; }}
137
+
138
+ {{? $schemaKeys.length }}
139
+ {{~ $schemaKeys:$propertyKey }}
140
+ {{ var $sch = $schema[$propertyKey]; }}
141
+
142
+ {{? {{# def.nonEmptySchema:$sch}} }}
143
+ {{
144
+ var $prop = it.util.getProperty($propertyKey)
145
+ , $passData = $data + $prop
146
+ , $hasDefault = $useDefaults && $sch.default !== undefined;
147
+ $it.schema = $sch;
148
+ $it.schemaPath = $schemaPath + $prop;
149
+ $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);
150
+ $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);
151
+ $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);
152
+ }}
153
+
154
+ {{# def.generateSubschemaCode }}
155
+
156
+ {{? {{# def.willOptimize }} }}
157
+ {{
158
+ $code = {{# def._optimizeValidate }};
159
+ var $useData = $passData;
160
+ }}
161
+ {{??}}
162
+ {{ var $useData = $nextData; }}
163
+ var {{=$nextData}} = {{=$passData}};
164
+ {{?}}
165
+
166
+ {{? $hasDefault }}
167
+ {{= $code }}
168
+ {{??}}
169
+ {{? $requiredHash && $requiredHash[$propertyKey] }}
170
+ if ({{# def.noPropertyInData }}) {
171
+ {{=$nextValid}} = false;
172
+ {{
173
+ var $currentErrorPath = it.errorPath
174
+ , $currErrSchemaPath = $errSchemaPath
175
+ , $missingProperty = it.util.escapeQuotes($propertyKey);
176
+ if (it.opts._errorDataPathProperty) {
177
+ it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
178
+ }
179
+ $errSchemaPath = it.errSchemaPath + '/required';
180
+ }}
181
+ {{# def.error:'required' }}
182
+ {{ $errSchemaPath = $currErrSchemaPath; }}
183
+ {{ it.errorPath = $currentErrorPath; }}
184
+ } else {
185
+ {{??}}
186
+ {{? $breakOnError }}
187
+ if ({{# def.noPropertyInData }}) {
188
+ {{=$nextValid}} = true;
189
+ } else {
190
+ {{??}}
191
+ if ({{=$useData}} !== undefined
192
+ {{? $ownProperties }}
193
+ && {{# def.isOwnProperty }}
194
+ {{?}}
195
+ ) {
196
+ {{?}}
197
+ {{?}}
198
+
199
+ {{= $code }}
200
+ }
201
+ {{?}} {{ /* $hasDefault */ }}
202
+ {{?}} {{ /* def.nonEmptySchema */ }}
203
+
204
+ {{# def.ifResultValid }}
205
+ {{~}}
206
+ {{?}}
207
+
208
+ {{? $pPropertyKeys.length }}
209
+ {{~ $pPropertyKeys:$pProperty }}
210
+ {{ var $sch = $pProperties[$pProperty]; }}
211
+
212
+ {{? {{# def.nonEmptySchema:$sch}} }}
213
+ {{
214
+ $it.schema = $sch;
215
+ $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
216
+ $it.errSchemaPath = it.errSchemaPath + '/patternProperties/'
217
+ + it.util.escapeFragment($pProperty);
218
+ }}
219
+
220
+ {{# def.iterateProperties }}
221
+ if ({{= it.usePattern($pProperty) }}.test({{=$key}})) {
222
+ {{
223
+ $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
224
+ var $passData = $data + '[' + $key + ']';
225
+ $it.dataPathArr[$dataNxt] = $key;
226
+ }}
227
+
228
+ {{# def.generateSubschemaCode }}
229
+ {{# def.optimizeValidate }}
230
+
231
+ {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
232
+ }
233
+ {{? $breakOnError }} else {{=$nextValid}} = true; {{?}}
234
+ }
235
+
236
+ {{# def.ifResultValid }}
237
+ {{?}} {{ /* def.nonEmptySchema */ }}
238
+ {{~}}
239
+ {{?}}
240
+
241
+
242
+ {{? $breakOnError }}
243
+ {{= $closingBraces }}
244
+ if ({{=$errs}} == errors) {
245
+ {{?}}
@@ -0,0 +1,52 @@
1
+ {{# def.definitions }}
2
+ {{# def.errors }}
3
+ {{# def.setupKeyword }}
4
+ {{# def.setupNextLevel }}
5
+
6
+ var {{=$errs}} = errors;
7
+
8
+ {{? {{# def.nonEmptySchema:$schema }} }}
9
+ {{
10
+ $it.schema = $schema;
11
+ $it.schemaPath = $schemaPath;
12
+ $it.errSchemaPath = $errSchemaPath;
13
+ }}
14
+
15
+ {{
16
+ var $key = 'key' + $lvl
17
+ , $idx = 'idx' + $lvl
18
+ , $i = 'i' + $lvl
19
+ , $invalidName = '\' + ' + $key + ' + \''
20
+ , $dataNxt = $it.dataLevel = it.dataLevel + 1
21
+ , $nextData = 'data' + $dataNxt
22
+ , $dataProperties = 'dataProperties' + $lvl
23
+ , $ownProperties = it.opts.ownProperties
24
+ , $currentBaseId = it.baseId;
25
+ }}
26
+
27
+ {{? $ownProperties }}
28
+ var {{=$dataProperties}} = undefined;
29
+ {{?}}
30
+ {{# def.iterateProperties }}
31
+ var startErrs{{=$lvl}} = errors;
32
+
33
+ {{ var $passData = $key; }}
34
+ {{# def.setCompositeRule }}
35
+ {{# def.generateSubschemaCode }}
36
+ {{# def.optimizeValidate }}
37
+ {{# def.resetCompositeRule }}
38
+
39
+ if (!{{=$nextValid}}) {
40
+ for (var {{=$i}}=startErrs{{=$lvl}}; {{=$i}}<errors; {{=$i}}++) {
41
+ vErrors[{{=$i}}].propertyName = {{=$key}};
42
+ }
43
+ {{# def.extraError:'propertyNames' }}
44
+ {{? $breakOnError }} break; {{?}}
45
+ }
46
+ }
47
+ {{?}}
48
+
49
+ {{? $breakOnError }}
50
+ {{= $closingBraces }}
51
+ if ({{=$errs}} == errors) {
52
+ {{?}}
@@ -0,0 +1,85 @@
1
+ {{# def.definitions }}
2
+ {{# def.errors }}
3
+ {{# def.setupKeyword }}
4
+
5
+ {{## def._validateRef:_v:
6
+ {{? it.opts.passContext }}
7
+ {{=_v}}.call(this,
8
+ {{??}}
9
+ {{=_v}}(
10
+ {{?}}
11
+ {{=$data}}, {{# def.dataPath }}{{# def.passParentData }}, rootData)
12
+ #}}
13
+
14
+ {{ var $async, $refCode; }}
15
+ {{? $schema == '#' || $schema == '#/' }}
16
+ {{
17
+ if (it.isRoot) {
18
+ $async = it.async;
19
+ $refCode = 'validate';
20
+ } else {
21
+ $async = it.root.schema.$async === true;
22
+ $refCode = 'root.refVal[0]';
23
+ }
24
+ }}
25
+ {{??}}
26
+ {{ var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); }}
27
+ {{? $refVal === undefined }}
28
+ {{ var $message = it.MissingRefError.message(it.baseId, $schema); }}
29
+ {{? it.opts.missingRefs == 'fail' }}
30
+ {{ it.logger.error($message); }}
31
+ {{# def.error:'$ref' }}
32
+ {{? $breakOnError }} if (false) { {{?}}
33
+ {{?? it.opts.missingRefs == 'ignore' }}
34
+ {{ it.logger.warn($message); }}
35
+ {{? $breakOnError }} if (true) { {{?}}
36
+ {{??}}
37
+ {{ throw new it.MissingRefError(it.baseId, $schema, $message); }}
38
+ {{?}}
39
+ {{?? $refVal.inline }}
40
+ {{# def.setupNextLevel }}
41
+ {{
42
+ $it.schema = $refVal.schema;
43
+ $it.schemaPath = '';
44
+ $it.errSchemaPath = $schema;
45
+ }}
46
+ {{ var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); }}
47
+ {{= $code }}
48
+ {{? $breakOnError}}
49
+ if ({{=$nextValid}}) {
50
+ {{?}}
51
+ {{??}}
52
+ {{
53
+ $async = $refVal.$async === true || (it.async && $refVal.$async !== false);
54
+ $refCode = $refVal.code;
55
+ }}
56
+ {{?}}
57
+ {{?}}
58
+
59
+ {{? $refCode }}
60
+ {{# def.beginDefOut}}
61
+ {{# def._validateRef:$refCode }}
62
+ {{# def.storeDefOut:__callValidate }}
63
+
64
+ {{? $async }}
65
+ {{ if (!it.async) throw new Error('async schema referenced by sync schema'); }}
66
+ {{? $breakOnError }} var {{=$valid}}; {{?}}
67
+ try {
68
+ await {{=__callValidate}};
69
+ {{? $breakOnError }} {{=$valid}} = true; {{?}}
70
+ } catch (e) {
71
+ if (!(e instanceof ValidationError)) throw e;
72
+ if (vErrors === null) vErrors = e.errors;
73
+ else vErrors = vErrors.concat(e.errors);
74
+ errors = vErrors.length;
75
+ {{? $breakOnError }} {{=$valid}} = false; {{?}}
76
+ }
77
+ {{? $breakOnError }} if ({{=$valid}}) { {{?}}
78
+ {{??}}
79
+ if (!{{=__callValidate}}) {
80
+ if (vErrors === null) vErrors = {{=$refCode}}.errors;
81
+ else vErrors = vErrors.concat({{=$refCode}}.errors);
82
+ errors = vErrors.length;
83
+ } {{? $breakOnError }} else { {{?}}
84
+ {{?}}
85
+ {{?}}