mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.5 KiB
68 lines
1.5 KiB
/**
|
|
* @fileoverview Defines a schema for configs.
|
|
* @author Sylvan Mably
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
const baseConfigProperties = {
|
|
env: { type: "object" },
|
|
globals: { type: "object" },
|
|
parser: { type: ["string", "null"] },
|
|
parserOptions: { type: "object" },
|
|
plugins: { type: "array" },
|
|
rules: { type: "object" },
|
|
settings: { type: "object" }
|
|
};
|
|
|
|
const overrideProperties = Object.assign(
|
|
{},
|
|
baseConfigProperties,
|
|
{
|
|
files: {
|
|
oneOf: [
|
|
{ type: "string" },
|
|
{
|
|
type: "array",
|
|
items: { type: "string" },
|
|
minItems: 1
|
|
}
|
|
]
|
|
},
|
|
excludedFiles: {
|
|
oneOf: [
|
|
{ type: "string" },
|
|
{
|
|
type: "array",
|
|
items: { type: "string" }
|
|
}
|
|
]
|
|
}
|
|
}
|
|
);
|
|
|
|
const topLevelConfigProperties = Object.assign(
|
|
{},
|
|
baseConfigProperties,
|
|
{
|
|
extends: { type: ["string", "array"] },
|
|
root: { type: "boolean" },
|
|
overrides: {
|
|
type: "array",
|
|
items: {
|
|
type: "object",
|
|
properties: overrideProperties,
|
|
required: ["files"],
|
|
additionalProperties: false
|
|
}
|
|
}
|
|
}
|
|
);
|
|
|
|
const configSchema = {
|
|
type: "object",
|
|
properties: topLevelConfigProperties,
|
|
additionalProperties: false
|
|
};
|
|
|
|
module.exports = configSchema;
|
|
|