Skip to content

fix: output documentation link on errors #3680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions lib/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@
},
"ClientLogging": {
"enum": ["none", "error", "warn", "info", "log", "verbose"],
"decription": "Allows to set log level in the browser."
"decription": "Allows to set log level in the browser.",
"link": "https://webpack.js.org/configuration/dev-server/#logging"
},
"ClientOverlay": {
"anyOf": [
{
"description": "Enables a full-screen overlay in the browser when there are compiler errors or warnings.",
"link": "https://webpack.js.org/configuration/dev-server/#overlay",
"type": "boolean"
},
{
Expand All @@ -97,6 +99,7 @@
},
"ClientProgress": {
"description": "Prints compilation progress in percentage in the browser.",
"link": "https://webpack.js.org/configuration/dev-server/#progress",
"type": "boolean"
},
"ClientWebSocketTransport": {
Expand All @@ -108,7 +111,8 @@
"$ref": "#/definitions/ClientWebSocketTransportString"
}
],
"description": "Allows to set custom web socket transport to communicate with dev server."
"description": "Allows to set custom web socket transport to communicate with dev server.",
"link": "https://webpack.js.org/configuration/dev-server/#websockettransport"
},
"ClientWebSocketTransportEnum": {
"enum": ["sockjs", "ws"]
Expand All @@ -119,6 +123,7 @@
},
"ClientWebSocketURL": {
"description": "Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to).",
"link": "https://webpack.js.org/configuration/dev-server/#websocketurl",
"anyOf": [
{
"type": "string",
Expand Down Expand Up @@ -514,10 +519,12 @@
"directory": {
"type": "string",
"minLength": 1,
"description": "Directory for static contents."
"description": "Directory for static contents.",
"link": "https://webpack.js.org/configuration/dev-server/#directory"
},
"staticOptions": {
"type": "object",
"link": "https://webpack.js.org/configuration/dev-server/#staticoptions",
"additionalProperties": true
},
"publicPath": {
Expand All @@ -533,7 +540,8 @@
"type": "string"
}
],
"description": "The static files will be available in the browser under this public path."
"description": "The static files will be available in the browser under this public path.",
"link": "https://webpack.js.org/configuration/dev-server/#publicpath"
},
"serveIndex": {
"anyOf": [
Expand All @@ -545,7 +553,8 @@
"additionalProperties": true
}
],
"description": "Tells dev server to use serveIndex middleware when enabled."
"description": "Tells dev server to use serveIndex middleware when enabled.",
"link": "https://webpack.js.org/configuration/dev-server/#serveindex"
},
"watch": {
"anyOf": [
Expand All @@ -558,7 +567,8 @@
"link": "https://github.com/paulmillr/chokidar#api"
}
],
"description": "Watches for files in static content directory."
"description": "Watches for files in static content directory.",
"link": "https://webpack.js.org/configuration/dev-server/#watch"
}
}
},
Expand Down
17 changes: 13 additions & 4 deletions test/__snapshots__/validate-options.test.js.snap.webpack4
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ exports[`options validate should throw an error on the "bonjour" option with ''
exports[`options validate should throw an error on the "client" option with '{"logging":"silent"}' value 1`] = `
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options.client.logging should be one of these:
\\"none\\" | \\"error\\" | \\"warn\\" | \\"info\\" | \\"log\\" | \\"verbose\\""
\\"none\\" | \\"error\\" | \\"warn\\" | \\"info\\" | \\"log\\" | \\"verbose\\"
-> Read more at https://webpack.js.org/configuration/dev-server/#logging"
`;

exports[`options validate should throw an error on the "client" option with '{"logging":"whoops!"}' value 1`] = `
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options.client.logging should be one of these:
\\"none\\" | \\"error\\" | \\"warn\\" | \\"info\\" | \\"log\\" | \\"verbose\\""
\\"none\\" | \\"error\\" | \\"warn\\" | \\"info\\" | \\"log\\" | \\"verbose\\"
-> Read more at https://webpack.js.org/configuration/dev-server/#logging"
`;

exports[`options validate should throw an error on the "client" option with '{"overlay":""}' value 1`] = `
Expand All @@ -90,6 +92,7 @@ exports[`options validate should throw an error on the "client" option with '{"o
Details:
* options.client.overlay should be a boolean.
-> Enables a full-screen overlay in the browser when there are compiler errors or warnings.
-> Read more at https://webpack.js.org/configuration/dev-server/#overlay
* options.client.overlay should be an object:
object { errors?, warnings? }"
`;
Expand All @@ -115,7 +118,8 @@ exports[`options validate should throw an error on the "client" option with '{"o
exports[`options validate should throw an error on the "client" option with '{"progress":""}' value 1`] = `
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options.client.progress should be a boolean.
-> Prints compilation progress in percentage in the browser."
-> Prints compilation progress in percentage in the browser.
-> Read more at https://webpack.js.org/configuration/dev-server/#progress"
`;

exports[`options validate should throw an error on the "client" option with '{"unknownOption":true}' value 1`] = `
Expand All @@ -134,6 +138,7 @@ exports[`options validate should throw an error on the "client" option with '{"w
* options.client.webSocketTransport should be one of these:
\\"sockjs\\" | \\"ws\\" | non-empty string
-> Allows to set custom web socket transport to communicate with dev server.
-> Read more at https://webpack.js.org/configuration/dev-server/#websockettransport
Details:
* options.client.webSocketTransport should be one of these:
\\"sockjs\\" | \\"ws\\"
Expand Down Expand Up @@ -554,7 +559,8 @@ exports[`options validate should throw an error on the "static" option with '' v
exports[`options validate should throw an error on the "static" option with '{"directory":false}' value 1`] = `
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options.static.directory should be a non-empty string.
-> Directory for static contents."
-> Directory for static contents.
-> Read more at https://webpack.js.org/configuration/dev-server/#directory"
`;

exports[`options validate should throw an error on the "static" option with '{"publicPath":false}' value 1`] = `
Expand All @@ -567,6 +573,7 @@ exports[`options validate should throw an error on the "static" option with '{"p
* options.static.publicPath should be one of these:
[string, ...] (should not have fewer than 1 item) | string
-> The static files will be available in the browser under this public path.
-> Read more at https://webpack.js.org/configuration/dev-server/#publicpath
Details:
* options.static.publicPath should be an array:
[string, ...] (should not have fewer than 1 item)
Expand All @@ -583,6 +590,7 @@ exports[`options validate should throw an error on the "static" option with '{"s
* options.static.serveIndex should be one of these:
boolean | object { … }
-> Tells dev server to use serveIndex middleware when enabled.
-> Read more at https://webpack.js.org/configuration/dev-server/#serveindex
Details:
* options.static.serveIndex should be a boolean.
* options.static.serveIndex should be an object:
Expand All @@ -599,6 +607,7 @@ exports[`options validate should throw an error on the "static" option with '{"w
* options.static.watch should be one of these:
boolean | object { … }
-> Watches for files in static content directory.
-> Read more at https://webpack.js.org/configuration/dev-server/#watch
Details:
* options.static.watch should be a boolean.
* options.static.watch should be an object:
Expand Down
17 changes: 13 additions & 4 deletions test/__snapshots__/validate-options.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ exports[`options validate should throw an error on the "bonjour" option with ''
exports[`options validate should throw an error on the "client" option with '{"logging":"silent"}' value 1`] = `
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options.client.logging should be one of these:
\\"none\\" | \\"error\\" | \\"warn\\" | \\"info\\" | \\"log\\" | \\"verbose\\""
\\"none\\" | \\"error\\" | \\"warn\\" | \\"info\\" | \\"log\\" | \\"verbose\\"
-> Read more at https://webpack.js.org/configuration/dev-server/#logging"
`;

exports[`options validate should throw an error on the "client" option with '{"logging":"whoops!"}' value 1`] = `
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options.client.logging should be one of these:
\\"none\\" | \\"error\\" | \\"warn\\" | \\"info\\" | \\"log\\" | \\"verbose\\""
\\"none\\" | \\"error\\" | \\"warn\\" | \\"info\\" | \\"log\\" | \\"verbose\\"
-> Read more at https://webpack.js.org/configuration/dev-server/#logging"
`;

exports[`options validate should throw an error on the "client" option with '{"overlay":""}' value 1`] = `
Expand All @@ -90,6 +92,7 @@ exports[`options validate should throw an error on the "client" option with '{"o
Details:
* options.client.overlay should be a boolean.
-> Enables a full-screen overlay in the browser when there are compiler errors or warnings.
-> Read more at https://webpack.js.org/configuration/dev-server/#overlay
* options.client.overlay should be an object:
object { errors?, warnings? }"
`;
Expand All @@ -115,7 +118,8 @@ exports[`options validate should throw an error on the "client" option with '{"o
exports[`options validate should throw an error on the "client" option with '{"progress":""}' value 1`] = `
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options.client.progress should be a boolean.
-> Prints compilation progress in percentage in the browser."
-> Prints compilation progress in percentage in the browser.
-> Read more at https://webpack.js.org/configuration/dev-server/#progress"
`;

exports[`options validate should throw an error on the "client" option with '{"unknownOption":true}' value 1`] = `
Expand All @@ -134,6 +138,7 @@ exports[`options validate should throw an error on the "client" option with '{"w
* options.client.webSocketTransport should be one of these:
\\"sockjs\\" | \\"ws\\" | non-empty string
-> Allows to set custom web socket transport to communicate with dev server.
-> Read more at https://webpack.js.org/configuration/dev-server/#websockettransport
Details:
* options.client.webSocketTransport should be one of these:
\\"sockjs\\" | \\"ws\\"
Expand Down Expand Up @@ -554,7 +559,8 @@ exports[`options validate should throw an error on the "static" option with '' v
exports[`options validate should throw an error on the "static" option with '{"directory":false}' value 1`] = `
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options.static.directory should be a non-empty string.
-> Directory for static contents."
-> Directory for static contents.
-> Read more at https://webpack.js.org/configuration/dev-server/#directory"
`;

exports[`options validate should throw an error on the "static" option with '{"publicPath":false}' value 1`] = `
Expand All @@ -567,6 +573,7 @@ exports[`options validate should throw an error on the "static" option with '{"p
* options.static.publicPath should be one of these:
[string, ...] (should not have fewer than 1 item) | string
-> The static files will be available in the browser under this public path.
-> Read more at https://webpack.js.org/configuration/dev-server/#publicpath
Details:
* options.static.publicPath should be an array:
[string, ...] (should not have fewer than 1 item)
Expand All @@ -583,6 +590,7 @@ exports[`options validate should throw an error on the "static" option with '{"s
* options.static.serveIndex should be one of these:
boolean | object { … }
-> Tells dev server to use serveIndex middleware when enabled.
-> Read more at https://webpack.js.org/configuration/dev-server/#serveindex
Details:
* options.static.serveIndex should be a boolean.
* options.static.serveIndex should be an object:
Expand All @@ -599,6 +607,7 @@ exports[`options validate should throw an error on the "static" option with '{"w
* options.static.watch should be one of these:
boolean | object { … }
-> Watches for files in static content directory.
-> Read more at https://webpack.js.org/configuration/dev-server/#watch
Details:
* options.static.watch should be a boolean.
* options.static.watch should be an object:
Expand Down