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