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