@depup/typescript-eslint__utils 8.57.1-depup.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.
- package/LICENSE +21 -0
- package/README.md +25 -0
- package/changes.json +5 -0
- package/dist/ast-utils/eslint-utils/PatternMatcher.d.ts +47 -0
- package/dist/ast-utils/eslint-utils/PatternMatcher.js +44 -0
- package/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts +75 -0
- package/dist/ast-utils/eslint-utils/ReferenceTracker.js +48 -0
- package/dist/ast-utils/eslint-utils/astUtilities.d.ts +83 -0
- package/dist/ast-utils/eslint-utils/astUtilities.js +101 -0
- package/dist/ast-utils/eslint-utils/index.d.ts +5 -0
- package/dist/ast-utils/eslint-utils/index.js +21 -0
- package/dist/ast-utils/eslint-utils/predicates.d.ts +31 -0
- package/dist/ast-utils/eslint-utils/predicates.js +59 -0
- package/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts +16 -0
- package/dist/ast-utils/eslint-utils/scopeAnalysis.js +51 -0
- package/dist/ast-utils/helpers.d.ts +18 -0
- package/dist/ast-utils/helpers.js +21 -0
- package/dist/ast-utils/index.d.ts +4 -0
- package/dist/ast-utils/index.js +20 -0
- package/dist/ast-utils/misc.d.ts +6 -0
- package/dist/ast-utils/misc.js +11 -0
- package/dist/ast-utils/predicates.d.ts +68 -0
- package/dist/ast-utils/predicates.js +108 -0
- package/dist/eslint-utils/InferTypesFromRule.d.ts +9 -0
- package/dist/eslint-utils/InferTypesFromRule.js +2 -0
- package/dist/eslint-utils/RuleCreator.d.ts +32 -0
- package/dist/eslint-utils/RuleCreator.js +54 -0
- package/dist/eslint-utils/applyDefault.d.ts +8 -0
- package/dist/eslint-utils/applyDefault.js +33 -0
- package/dist/eslint-utils/deepMerge.d.ts +14 -0
- package/dist/eslint-utils/deepMerge.js +46 -0
- package/dist/eslint-utils/getParserServices.d.ts +22 -0
- package/dist/eslint-utils/getParserServices.js +41 -0
- package/dist/eslint-utils/index.d.ts +6 -0
- package/dist/eslint-utils/index.js +22 -0
- package/dist/eslint-utils/nullThrows.d.ts +12 -0
- package/dist/eslint-utils/nullThrows.js +21 -0
- package/dist/eslint-utils/parserSeemsToBeTSESLint.d.ts +1 -0
- package/dist/eslint-utils/parserSeemsToBeTSESLint.js +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +45 -0
- package/dist/json-schema.d.ts +387 -0
- package/dist/json-schema.js +8 -0
- package/dist/ts-eslint/AST.d.ts +8 -0
- package/dist/ts-eslint/AST.js +3 -0
- package/dist/ts-eslint/Config.d.ts +291 -0
- package/dist/ts-eslint/Config.js +3 -0
- package/dist/ts-eslint/ESLint.d.ts +7 -0
- package/dist/ts-eslint/ESLint.js +13 -0
- package/dist/ts-eslint/Linter.d.ts +255 -0
- package/dist/ts-eslint/Linter.js +13 -0
- package/dist/ts-eslint/Parser.d.ts +94 -0
- package/dist/ts-eslint/Parser.js +3 -0
- package/dist/ts-eslint/ParserOptions.d.ts +1 -0
- package/dist/ts-eslint/ParserOptions.js +2 -0
- package/dist/ts-eslint/Processor.d.ts +63 -0
- package/dist/ts-eslint/Processor.js +3 -0
- package/dist/ts-eslint/Rule.d.ts +614 -0
- package/dist/ts-eslint/Rule.js +2 -0
- package/dist/ts-eslint/RuleTester.d.ts +183 -0
- package/dist/ts-eslint/RuleTester.js +11 -0
- package/dist/ts-eslint/Scope.d.ts +42 -0
- package/dist/ts-eslint/Scope.js +43 -0
- package/dist/ts-eslint/SourceCode.d.ts +354 -0
- package/dist/ts-eslint/SourceCode.js +8 -0
- package/dist/ts-eslint/eslint/ESLintShared.d.ts +381 -0
- package/dist/ts-eslint/eslint/ESLintShared.js +2 -0
- package/dist/ts-eslint/eslint/FlatESLint.d.ts +87 -0
- package/dist/ts-eslint/eslint/FlatESLint.js +19 -0
- package/dist/ts-eslint/eslint/LegacyESLint.d.ts +72 -0
- package/dist/ts-eslint/eslint/LegacyESLint.js +36 -0
- package/dist/ts-eslint/index.d.ts +11 -0
- package/dist/ts-eslint/index.js +27 -0
- package/dist/ts-estree.d.ts +3 -0
- package/dist/ts-estree.js +9 -0
- package/dist/ts-utils/NoInfer.d.ts +9 -0
- package/dist/ts-utils/NoInfer.js +2 -0
- package/dist/ts-utils/index.d.ts +2 -0
- package/dist/ts-utils/index.js +18 -0
- package/dist/ts-utils/isArray.d.ts +1 -0
- package/dist/ts-utils/isArray.js +7 -0
- package/package.json +120 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.TSUtils = exports.TSESLint = exports.JSONSchema = exports.ESLintUtils = exports.ASTUtils = void 0;
|
|
40
|
+
exports.ASTUtils = __importStar(require("./ast-utils"));
|
|
41
|
+
exports.ESLintUtils = __importStar(require("./eslint-utils"));
|
|
42
|
+
exports.JSONSchema = __importStar(require("./json-schema"));
|
|
43
|
+
exports.TSESLint = __importStar(require("./ts-eslint"));
|
|
44
|
+
__exportStar(require("./ts-estree"), exports);
|
|
45
|
+
exports.TSUtils = __importStar(require("./ts-utils"));
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a fork of https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13f63c2eb8d7479caf01ab8d72f9e3683368a8f5/types/json-schema/index.d.ts
|
|
3
|
+
* We intentionally fork this because:
|
|
4
|
+
* - ESLint ***ONLY*** supports JSONSchema v4
|
|
5
|
+
* - We want to provide stricter types
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
|
|
9
|
+
*/
|
|
10
|
+
export type JSONSchema4TypeName = 'any' | 'array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string';
|
|
11
|
+
/**
|
|
12
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
|
|
13
|
+
*/
|
|
14
|
+
export type JSONSchema4Type = boolean | number | string | null;
|
|
15
|
+
export type JSONSchema4TypeExtended = JSONSchema4Array | JSONSchema4Object | JSONSchema4Type;
|
|
16
|
+
export interface JSONSchema4Object {
|
|
17
|
+
[key: string]: JSONSchema4TypeExtended;
|
|
18
|
+
}
|
|
19
|
+
export interface JSONSchema4Array extends Array<JSONSchema4TypeExtended> {
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Meta schema
|
|
23
|
+
*
|
|
24
|
+
* Recommended values:
|
|
25
|
+
* - 'http://json-schema.org/schema#'
|
|
26
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
27
|
+
* - 'http://json-schema.org/draft-04/schema#'
|
|
28
|
+
* - 'http://json-schema.org/draft-04/hyper-schema#'
|
|
29
|
+
* - 'http://json-schema.org/draft-03/schema#'
|
|
30
|
+
* - 'http://json-schema.org/draft-03/hyper-schema#'
|
|
31
|
+
*
|
|
32
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
33
|
+
*/
|
|
34
|
+
export type JSONSchema4Version = string;
|
|
35
|
+
/**
|
|
36
|
+
* JSON Schema V4
|
|
37
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04
|
|
38
|
+
*/
|
|
39
|
+
export type JSONSchema4 = JSONSchema4AllOfSchema | JSONSchema4AnyOfSchema | JSONSchema4AnySchema | JSONSchema4ArraySchema | JSONSchema4BooleanSchema | JSONSchema4MultiSchema | JSONSchema4NullSchema | JSONSchema4NumberSchema | JSONSchema4ObjectSchema | JSONSchema4OneOfSchema | JSONSchema4RefSchema | JSONSchema4StringSchema;
|
|
40
|
+
interface JSONSchema4Base {
|
|
41
|
+
/**
|
|
42
|
+
* Reusable definitions that can be referenced via `$ref`
|
|
43
|
+
*/
|
|
44
|
+
$defs?: Record<string, JSONSchema4> | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Path to a schema defined in `definitions`/`$defs` that will form the base
|
|
47
|
+
* for this schema.
|
|
48
|
+
*
|
|
49
|
+
* If you are defining an "array" schema (`schema: [ ... ]`) for your rule
|
|
50
|
+
* then you should prefix this with `items/0` so that the validator can find
|
|
51
|
+
* your definitions.
|
|
52
|
+
*
|
|
53
|
+
* eg: `'#/items/0/definitions/myDef'`
|
|
54
|
+
*
|
|
55
|
+
* Otherwise if you are defining an "object" schema (`schema: { ... }`) for
|
|
56
|
+
* your rule you can directly reference your definitions
|
|
57
|
+
*
|
|
58
|
+
* eg: `'#/definitions/myDef'`
|
|
59
|
+
*/
|
|
60
|
+
$ref?: string | undefined;
|
|
61
|
+
$schema?: JSONSchema4Version | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* (AND) Must be valid against all of the sub-schemas
|
|
64
|
+
*/
|
|
65
|
+
allOf?: JSONSchema4[] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* (OR) Must be valid against any of the sub-schemas
|
|
68
|
+
*/
|
|
69
|
+
anyOf?: JSONSchema4[] | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* The default value for the item if not present
|
|
72
|
+
*/
|
|
73
|
+
default?: JSONSchema4TypeExtended | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Reusable definitions that can be referenced via `$ref`
|
|
76
|
+
*/
|
|
77
|
+
definitions?: Record<string, JSONSchema4> | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* This attribute is a string that provides a full description of the of
|
|
80
|
+
* purpose the instance property.
|
|
81
|
+
*
|
|
82
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
|
|
83
|
+
*/
|
|
84
|
+
description?: string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* The value of this property MUST be another schema which will provide
|
|
87
|
+
* a base schema which the current schema will inherit from. The
|
|
88
|
+
* inheritance rules are such that any instance that is valid according
|
|
89
|
+
* to the current schema MUST be valid according to the referenced
|
|
90
|
+
* schema. This MAY also be an array, in which case, the instance MUST
|
|
91
|
+
* be valid for all the schemas in the array. A schema that extends
|
|
92
|
+
* another schema MAY define additional attributes, constrain existing
|
|
93
|
+
* attributes, or add other constraints.
|
|
94
|
+
*
|
|
95
|
+
* Conceptually, the behavior of extends can be seen as validating an
|
|
96
|
+
* instance against all constraints in the extending schema as well as
|
|
97
|
+
* the extended schema(s).
|
|
98
|
+
*
|
|
99
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26
|
|
100
|
+
*/
|
|
101
|
+
extends?: string | string[] | undefined;
|
|
102
|
+
id?: string | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* (NOT) Must not be valid against the given schema
|
|
105
|
+
*/
|
|
106
|
+
not?: JSONSchema4 | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* (XOR) Must be valid against exactly one of the sub-schemas
|
|
109
|
+
*/
|
|
110
|
+
oneOf?: JSONSchema4[] | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* This attribute indicates if the instance must have a value, and not
|
|
113
|
+
* be undefined. This is false by default, making the instance
|
|
114
|
+
* optional.
|
|
115
|
+
*
|
|
116
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7
|
|
117
|
+
*/
|
|
118
|
+
required?: boolean | string[] | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* This attribute is a string that provides a short description of the
|
|
121
|
+
* instance property.
|
|
122
|
+
*
|
|
123
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
|
|
124
|
+
*/
|
|
125
|
+
title?: string | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* A single type, or a union of simple types
|
|
128
|
+
*/
|
|
129
|
+
type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
|
|
130
|
+
}
|
|
131
|
+
export interface JSONSchema4RefSchema extends JSONSchema4Base {
|
|
132
|
+
$ref: string;
|
|
133
|
+
type?: undefined;
|
|
134
|
+
}
|
|
135
|
+
export interface JSONSchema4AllOfSchema extends JSONSchema4Base {
|
|
136
|
+
allOf: JSONSchema4[];
|
|
137
|
+
type?: undefined;
|
|
138
|
+
}
|
|
139
|
+
export interface JSONSchema4AnyOfSchema extends JSONSchema4Base {
|
|
140
|
+
anyOf: JSONSchema4[];
|
|
141
|
+
type?: undefined;
|
|
142
|
+
}
|
|
143
|
+
export interface JSONSchema4OneOfSchema extends JSONSchema4Base {
|
|
144
|
+
oneOf: JSONSchema4[];
|
|
145
|
+
type?: undefined;
|
|
146
|
+
}
|
|
147
|
+
export interface JSONSchema4MultiSchema extends Omit<JSONSchema4ObjectSchema, 'enum' | 'type'>, Omit<JSONSchema4ArraySchema, 'enum' | 'type'>, Omit<JSONSchema4StringSchema, 'enum' | 'type'>, Omit<JSONSchema4NumberSchema, 'enum' | 'type'>, Omit<JSONSchema4BooleanSchema, 'enum' | 'type'>, Omit<JSONSchema4NullSchema, 'enum' | 'type'>, Omit<JSONSchema4AnySchema, 'enum' | 'type'> {
|
|
148
|
+
/**
|
|
149
|
+
* This provides an enumeration of all possible values that are valid
|
|
150
|
+
* for the instance property. This MUST be an array, and each item in
|
|
151
|
+
* the array represents a possible value for the instance value. If
|
|
152
|
+
* this attribute is defined, the instance value MUST be one of the
|
|
153
|
+
* values in the array in order for the schema to be valid.
|
|
154
|
+
*
|
|
155
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
|
|
156
|
+
*/
|
|
157
|
+
enum?: JSONSchema4Type[];
|
|
158
|
+
type: JSONSchema4TypeName[];
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* @see https://json-schema.org/understanding-json-schema/reference/object.html
|
|
162
|
+
*/
|
|
163
|
+
export interface JSONSchema4ObjectSchema extends JSONSchema4Base {
|
|
164
|
+
/**
|
|
165
|
+
* This attribute defines a schema for all properties that are not
|
|
166
|
+
* explicitly defined in an object type definition. If specified, the
|
|
167
|
+
* value MUST be a schema or a boolean. If false is provided, no
|
|
168
|
+
* additional properties are allowed beyond the properties defined in
|
|
169
|
+
* the schema. The default value is an empty schema which allows any
|
|
170
|
+
* value for additional properties.
|
|
171
|
+
*
|
|
172
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4
|
|
173
|
+
*/
|
|
174
|
+
additionalProperties?: boolean | JSONSchema4 | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* The `dependencies` keyword conditionally applies a sub-schema when a given
|
|
177
|
+
* property is present. This schema is applied in the same way `allOf` applies
|
|
178
|
+
* schemas. Nothing is merged or extended. Both schemas apply independently.
|
|
179
|
+
*/
|
|
180
|
+
dependencies?: Record<string, JSONSchema4 | string[]> | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* The maximum number of properties allowed for record-style schemas
|
|
183
|
+
*/
|
|
184
|
+
maxProperties?: number | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* The minimum number of properties required for record-style schemas
|
|
187
|
+
*/
|
|
188
|
+
minProperties?: number | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* This attribute is an object that defines the schema for a set of
|
|
191
|
+
* property names of an object instance. The name of each property of
|
|
192
|
+
* this attribute's object is a regular expression pattern in the ECMA
|
|
193
|
+
* 262/Perl 5 format, while the value is a schema. If the pattern
|
|
194
|
+
* matches the name of a property on the instance object, the value of
|
|
195
|
+
* the instance's property MUST be valid against the pattern name's
|
|
196
|
+
* schema value.
|
|
197
|
+
*
|
|
198
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3
|
|
199
|
+
*/
|
|
200
|
+
patternProperties?: Record<string, JSONSchema4> | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* This attribute is an object with property definitions that define the
|
|
203
|
+
* valid values of instance object property values. When the instance
|
|
204
|
+
* value is an object, the property values of the instance object MUST
|
|
205
|
+
* conform to the property definitions in this object. In this object,
|
|
206
|
+
* each property definition's value MUST be a schema, and the property's
|
|
207
|
+
* name MUST be the name of the instance property that it defines. The
|
|
208
|
+
* instance property value MUST be valid according to the schema from
|
|
209
|
+
* the property definition. Properties are considered unordered, the
|
|
210
|
+
* order of the instance properties MAY be in any order.
|
|
211
|
+
*
|
|
212
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
|
|
213
|
+
*/
|
|
214
|
+
properties?: Record<string, JSONSchema4> | undefined;
|
|
215
|
+
type: 'object';
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* @see https://json-schema.org/understanding-json-schema/reference/array.html
|
|
219
|
+
*/
|
|
220
|
+
export interface JSONSchema4ArraySchema extends JSONSchema4Base {
|
|
221
|
+
/**
|
|
222
|
+
* May only be defined when "items" is defined, and is a tuple of JSONSchemas.
|
|
223
|
+
*
|
|
224
|
+
* This provides a definition for additional items in an array instance
|
|
225
|
+
* when tuple definitions of the items is provided. This can be false
|
|
226
|
+
* to indicate additional items in the array are not allowed, or it can
|
|
227
|
+
* be a schema that defines the schema of the additional items.
|
|
228
|
+
*
|
|
229
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6
|
|
230
|
+
*/
|
|
231
|
+
additionalItems?: boolean | JSONSchema4 | undefined;
|
|
232
|
+
/**
|
|
233
|
+
* This attribute defines the allowed items in an instance array, and
|
|
234
|
+
* MUST be a schema or an array of schemas. The default value is an
|
|
235
|
+
* empty schema which allows any value for items in the instance array.
|
|
236
|
+
*
|
|
237
|
+
* When this attribute value is a schema and the instance value is an
|
|
238
|
+
* array, then all the items in the array MUST be valid according to the
|
|
239
|
+
* schema.
|
|
240
|
+
*
|
|
241
|
+
* When this attribute value is an array of schemas and the instance
|
|
242
|
+
* value is an array, each position in the instance array MUST conform
|
|
243
|
+
* to the schema in the corresponding position for this array. This
|
|
244
|
+
* called tuple typing. When tuple typing is used, additional items are
|
|
245
|
+
* allowed, disallowed, or constrained by the "additionalItems"
|
|
246
|
+
* (Section 5.6) attribute using the same rules as
|
|
247
|
+
* "additionalProperties" (Section 5.4) for objects.
|
|
248
|
+
*
|
|
249
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5
|
|
250
|
+
*/
|
|
251
|
+
items?: JSONSchema4 | JSONSchema4[] | undefined;
|
|
252
|
+
/**
|
|
253
|
+
* Defines the maximum length of an array
|
|
254
|
+
*/
|
|
255
|
+
maxItems?: number | undefined;
|
|
256
|
+
/**
|
|
257
|
+
* Defines the minimum length of an array
|
|
258
|
+
*/
|
|
259
|
+
minItems?: number | undefined;
|
|
260
|
+
type: 'array';
|
|
261
|
+
/**
|
|
262
|
+
* Enforces that all items in the array are unique
|
|
263
|
+
*/
|
|
264
|
+
uniqueItems?: boolean | undefined;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* @see https://json-schema.org/understanding-json-schema/reference/string.html
|
|
268
|
+
*/
|
|
269
|
+
export interface JSONSchema4StringSchema extends JSONSchema4Base {
|
|
270
|
+
enum?: string[] | undefined;
|
|
271
|
+
/**
|
|
272
|
+
* The `format` keyword allows for basic semantic identification of certain
|
|
273
|
+
* kinds of string values that are commonly used.
|
|
274
|
+
*
|
|
275
|
+
* For example, because JSON doesn’t have a “DateTime” type, dates need to be
|
|
276
|
+
* encoded as strings. `format` allows the schema author to indicate that the
|
|
277
|
+
* string value should be interpreted as a date.
|
|
278
|
+
*
|
|
279
|
+
* ajv v6 provides a few built-in formats - all other strings will cause AJV
|
|
280
|
+
* to throw during schema compilation
|
|
281
|
+
*/
|
|
282
|
+
format?: 'date' | 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'json-pointer' | 'json-pointer-uri-fragment' | 'regex' | 'relative-json-pointer' | 'time' | 'uri' | 'uri-reference' | 'uri-template' | 'url' | 'uuid' | undefined;
|
|
283
|
+
/**
|
|
284
|
+
* The maximum allowed length for the string
|
|
285
|
+
*/
|
|
286
|
+
maxLength?: number | undefined;
|
|
287
|
+
/**
|
|
288
|
+
* The minimum allowed length for the string
|
|
289
|
+
*/
|
|
290
|
+
minLength?: number | undefined;
|
|
291
|
+
/**
|
|
292
|
+
* The `pattern` keyword is used to restrict a string to a particular regular
|
|
293
|
+
* expression. The regular expression syntax is the one defined in JavaScript
|
|
294
|
+
* (ECMA 262 specifically) with Unicode support.
|
|
295
|
+
*
|
|
296
|
+
* When defining the regular expressions, it’s important to note that the
|
|
297
|
+
* string is considered valid if the expression matches anywhere within the
|
|
298
|
+
* string. For example, the regular expression "p" will match any string with
|
|
299
|
+
* a p in it, such as "apple" not just a string that is simply "p". Therefore,
|
|
300
|
+
* it is usually less confusing, as a matter of course, to surround the
|
|
301
|
+
* regular expression in ^...$, for example, "^p$", unless there is a good
|
|
302
|
+
* reason not to do so.
|
|
303
|
+
*/
|
|
304
|
+
pattern?: string | undefined;
|
|
305
|
+
type: 'string';
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* @see https://json-schema.org/understanding-json-schema/reference/numeric.html
|
|
309
|
+
*/
|
|
310
|
+
export interface JSONSchema4NumberSchema extends JSONSchema4Base {
|
|
311
|
+
/**
|
|
312
|
+
* This provides an enumeration of all possible values that are valid
|
|
313
|
+
* for the instance property. This MUST be an array, and each item in
|
|
314
|
+
* the array represents a possible value for the instance value. If
|
|
315
|
+
* this attribute is defined, the instance value MUST be one of the
|
|
316
|
+
* values in the array in order for the schema to be valid.
|
|
317
|
+
*
|
|
318
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
|
|
319
|
+
*/
|
|
320
|
+
enum?: number[] | undefined;
|
|
321
|
+
/**
|
|
322
|
+
* The exclusive minimum allowed value for the number
|
|
323
|
+
* - `true` = `x < maximum`
|
|
324
|
+
* - `false` = `x <= maximum`
|
|
325
|
+
*
|
|
326
|
+
* Default is `false`
|
|
327
|
+
*/
|
|
328
|
+
exclusiveMaximum?: boolean | undefined;
|
|
329
|
+
/**
|
|
330
|
+
* Indicates whether or not `minimum` is the inclusive or exclusive minimum
|
|
331
|
+
* - `true` = `x > minimum`
|
|
332
|
+
* - `false` = `x ≥ minimum`
|
|
333
|
+
*
|
|
334
|
+
* Default is `false`
|
|
335
|
+
*/
|
|
336
|
+
exclusiveMinimum?: boolean | undefined;
|
|
337
|
+
/**
|
|
338
|
+
* The maximum allowed value for the number
|
|
339
|
+
*/
|
|
340
|
+
maximum?: number | undefined;
|
|
341
|
+
/**
|
|
342
|
+
* The minimum allowed value for the number
|
|
343
|
+
*/
|
|
344
|
+
minimum?: number | undefined;
|
|
345
|
+
/**
|
|
346
|
+
* Numbers can be restricted to a multiple of a given number, using the
|
|
347
|
+
* `multipleOf` keyword. It may be set to any positive number.
|
|
348
|
+
*/
|
|
349
|
+
multipleOf?: number | undefined;
|
|
350
|
+
type: 'integer' | 'number';
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* @see https://json-schema.org/understanding-json-schema/reference/boolean.html
|
|
354
|
+
*/
|
|
355
|
+
export interface JSONSchema4BooleanSchema extends JSONSchema4Base {
|
|
356
|
+
/**
|
|
357
|
+
* This provides an enumeration of all possible values that are valid
|
|
358
|
+
* for the instance property. This MUST be an array, and each item in
|
|
359
|
+
* the array represents a possible value for the instance value. If
|
|
360
|
+
* this attribute is defined, the instance value MUST be one of the
|
|
361
|
+
* values in the array in order for the schema to be valid.
|
|
362
|
+
*
|
|
363
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
|
|
364
|
+
*/
|
|
365
|
+
enum?: boolean[] | undefined;
|
|
366
|
+
type: 'boolean';
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* @see https://json-schema.org/understanding-json-schema/reference/null.html
|
|
370
|
+
*/
|
|
371
|
+
export interface JSONSchema4NullSchema extends JSONSchema4Base {
|
|
372
|
+
/**
|
|
373
|
+
* This provides an enumeration of all possible values that are valid
|
|
374
|
+
* for the instance property. This MUST be an array, and each item in
|
|
375
|
+
* the array represents a possible value for the instance value. If
|
|
376
|
+
* this attribute is defined, the instance value MUST be one of the
|
|
377
|
+
* values in the array in order for the schema to be valid.
|
|
378
|
+
*
|
|
379
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
|
|
380
|
+
*/
|
|
381
|
+
enum?: null[] | undefined;
|
|
382
|
+
type: 'null';
|
|
383
|
+
}
|
|
384
|
+
export interface JSONSchema4AnySchema extends JSONSchema4Base {
|
|
385
|
+
type: 'any';
|
|
386
|
+
}
|
|
387
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This is a fork of https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13f63c2eb8d7479caf01ab8d72f9e3683368a8f5/types/json-schema/index.d.ts
|
|
4
|
+
* We intentionally fork this because:
|
|
5
|
+
* - ESLint ***ONLY*** supports JSONSchema v4
|
|
6
|
+
* - We want to provide stricter types
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|