Fix pluginSearchDirs schema (#12474)

* Fix `pluginSearchDirs` schema

* `anyOf` -> `oneOf`

* Fix test
This commit is contained in:
fisker Cheung authored and GitHub committed 2022-03-20 14:50:27 +09:00
1 parent 067edce213
commit ef3fe51380
2 files changed
+27 -4

No files matched your search

+13
View File
@@ -84,6 +84,19 @@ function optionToSchema(option) {
}
if (option.array) {
schema = wrapWithArraySchema(schema);
// #10274
if (option.name === "pluginSearchDirs") {
schema = {
oneOf: [
schema,
{
enum: [false],
description: "Disable plugin autoloading.",
},
],
};
}
}
return {
description: option.description,
@@ -281,10 +281,20 @@ This option cannot be used with --range-start and --range-end.",
"description": "Custom directory that contains prettier plugins in node_modules subdirectory.
Overrides default behavior when plugins are searched relatively to the location of Prettier.
Multiple values are accepted.",
"items": Object {
"type": "string",
},
"type": "array",
"oneOf": Array [
Object {
"items": Object {
"type": "string",
},
"type": "array",
},
Object {
"description": "Disable plugin autoloading.",
"enum": Array [
false,
],
},
],
},
"plugins": Object {
"default": Array [],