1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 | const baseConfigProperties = {
|
9 | env: { type: "object" },
|
10 | extends: { $ref: "#/definitions/stringOrStrings" },
|
11 | globals: { type: "object" },
|
12 | overrides: {
|
13 | type: "array",
|
14 | items: { $ref: "#/definitions/overrideConfig" },
|
15 | additionalItems: false
|
16 | },
|
17 | parser: { type: ["string", "null"] },
|
18 | parserOptions: { type: "object" },
|
19 | plugins: { type: "array" },
|
20 | processor: { type: "string" },
|
21 | rules: { type: "object" },
|
22 | settings: { type: "object" },
|
23 | noInlineConfig: { type: "boolean" },
|
24 |
|
25 | ecmaFeatures: { type: "object" }
|
26 | };
|
27 |
|
28 | const configSchema = {
|
29 | definitions: {
|
30 | stringOrStrings: {
|
31 | oneOf: [
|
32 | { type: "string" },
|
33 | {
|
34 | type: "array",
|
35 | items: { type: "string" },
|
36 | additionalItems: false
|
37 | }
|
38 | ]
|
39 | },
|
40 | stringOrStringsRequired: {
|
41 | oneOf: [
|
42 | { type: "string" },
|
43 | {
|
44 | type: "array",
|
45 | items: { type: "string" },
|
46 | additionalItems: false,
|
47 | minItems: 1
|
48 | }
|
49 | ]
|
50 | },
|
51 |
|
52 |
|
53 | objectConfig: {
|
54 | type: "object",
|
55 | properties: {
|
56 | root: { type: "boolean" },
|
57 | ...baseConfigProperties
|
58 | },
|
59 | additionalProperties: false
|
60 | },
|
61 |
|
62 |
|
63 | overrideConfig: {
|
64 | type: "object",
|
65 | properties: {
|
66 | excludedFiles: { $ref: "#/definitions/stringOrStrings" },
|
67 | files: { $ref: "#/definitions/stringOrStringsRequired" },
|
68 | ...baseConfigProperties
|
69 | },
|
70 | required: ["files"],
|
71 | additionalProperties: false
|
72 | }
|
73 | },
|
74 |
|
75 | $ref: "#/definitions/objectConfig"
|
76 | };
|
77 |
|
78 | module.exports = configSchema;
|