Skip to content

Commit e16221b

Browse files
authored
fix: output documentation link on errors (#3680)
1 parent d10bcc3 commit e16221b

File tree

3 files changed

+42
-14
lines changed

3 files changed

+42
-14
lines changed

lib/options.json

+16-6
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@
7171
},
7272
"ClientLogging": {
7373
"enum": ["none", "error", "warn", "info", "log", "verbose"],
74-
"decription": "Allows to set log level in the browser."
74+
"decription": "Allows to set log level in the browser.",
75+
"link": "https://webpack.js.org/configuration/dev-server/#logging"
7576
},
7677
"ClientOverlay": {
7778
"anyOf": [
7879
{
7980
"description": "Enables a full-screen overlay in the browser when there are compiler errors or warnings.",
81+
"link": "https://webpack.js.org/configuration/dev-server/#overlay",
8082
"type": "boolean"
8183
},
8284
{
@@ -97,6 +99,7 @@
9799
},
98100
"ClientProgress": {
99101
"description": "Prints compilation progress in percentage in the browser.",
102+
"link": "https://webpack.js.org/configuration/dev-server/#progress",
100103
"type": "boolean"
101104
},
102105
"ClientWebSocketTransport": {
@@ -108,7 +111,8 @@
108111
"$ref": "#/definitions/ClientWebSocketTransportString"
109112
}
110113
],
111-
"description": "Allows to set custom web socket transport to communicate with dev server."
114+
"description": "Allows to set custom web socket transport to communicate with dev server.",
115+
"link": "https://webpack.js.org/configuration/dev-server/#websockettransport"
112116
},
113117
"ClientWebSocketTransportEnum": {
114118
"enum": ["sockjs", "ws"]
@@ -119,6 +123,7 @@
119123
},
120124
"ClientWebSocketURL": {
121125
"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).",
126+
"link": "https://webpack.js.org/configuration/dev-server/#websocketurl",
122127
"anyOf": [
123128
{
124129
"type": "string",
@@ -514,10 +519,12 @@
514519
"directory": {
515520
"type": "string",
516521
"minLength": 1,
517-
"description": "Directory for static contents."
522+
"description": "Directory for static contents.",
523+
"link": "https://webpack.js.org/configuration/dev-server/#directory"
518524
},
519525
"staticOptions": {
520526
"type": "object",
527+
"link": "https://webpack.js.org/configuration/dev-server/#staticoptions",
521528
"additionalProperties": true
522529
},
523530
"publicPath": {
@@ -533,7 +540,8 @@
533540
"type": "string"
534541
}
535542
],
536-
"description": "The static files will be available in the browser under this public path."
543+
"description": "The static files will be available in the browser under this public path.",
544+
"link": "https://webpack.js.org/configuration/dev-server/#publicpath"
537545
},
538546
"serveIndex": {
539547
"anyOf": [
@@ -545,7 +553,8 @@
545553
"additionalProperties": true
546554
}
547555
],
548-
"description": "Tells dev server to use serveIndex middleware when enabled."
556+
"description": "Tells dev server to use serveIndex middleware when enabled.",
557+
"link": "https://webpack.js.org/configuration/dev-server/#serveindex"
549558
},
550559
"watch": {
551560
"anyOf": [
@@ -558,7 +567,8 @@
558567
"link": "https://github.com/paulmillr/chokidar#api"
559568
}
560569
],
561-
"description": "Watches for files in static content directory."
570+
"description": "Watches for files in static content directory.",
571+
"link": "https://webpack.js.org/configuration/dev-server/#watch"
562572
}
563573
}
564574
},

test/__snapshots__/validate-options.test.js.snap.webpack4

+13-4
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ exports[`options validate should throw an error on the "bonjour" option with ''
6969
exports[`options validate should throw an error on the "client" option with '{"logging":"silent"}' value 1`] = `
7070
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
7171
- options.client.logging should be one of these:
72-
\\"none\\" | \\"error\\" | \\"warn\\" | \\"info\\" | \\"log\\" | \\"verbose\\""
72+
\\"none\\" | \\"error\\" | \\"warn\\" | \\"info\\" | \\"log\\" | \\"verbose\\"
73+
-> Read more at https://webpack.js.org/configuration/dev-server/#logging"
7374
`;
7475

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

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

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

560566
exports[`options validate should throw an error on the "static" option with '{"publicPath":false}' value 1`] = `
@@ -567,6 +573,7 @@ exports[`options validate should throw an error on the "static" option with '{"p
567573
* options.static.publicPath should be one of these:
568574
[string, ...] (should not have fewer than 1 item) | string
569575
-> The static files will be available in the browser under this public path.
576+
-> Read more at https://webpack.js.org/configuration/dev-server/#publicpath
570577
Details:
571578
* options.static.publicPath should be an array:
572579
[string, ...] (should not have fewer than 1 item)
@@ -583,6 +590,7 @@ exports[`options validate should throw an error on the "static" option with '{"s
583590
* options.static.serveIndex should be one of these:
584591
boolean | object { … }
585592
-> Tells dev server to use serveIndex middleware when enabled.
593+
-> Read more at https://webpack.js.org/configuration/dev-server/#serveindex
586594
Details:
587595
* options.static.serveIndex should be a boolean.
588596
* options.static.serveIndex should be an object:
@@ -599,6 +607,7 @@ exports[`options validate should throw an error on the "static" option with '{"w
599607
* options.static.watch should be one of these:
600608
boolean | object { … }
601609
-> Watches for files in static content directory.
610+
-> Read more at https://webpack.js.org/configuration/dev-server/#watch
602611
Details:
603612
* options.static.watch should be a boolean.
604613
* options.static.watch should be an object:

test/__snapshots__/validate-options.test.js.snap.webpack5

+13-4
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ exports[`options validate should throw an error on the "bonjour" option with ''
6969
exports[`options validate should throw an error on the "client" option with '{"logging":"silent"}' value 1`] = `
7070
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
7171
- options.client.logging should be one of these:
72-
\\"none\\" | \\"error\\" | \\"warn\\" | \\"info\\" | \\"log\\" | \\"verbose\\""
72+
\\"none\\" | \\"error\\" | \\"warn\\" | \\"info\\" | \\"log\\" | \\"verbose\\"
73+
-> Read more at https://webpack.js.org/configuration/dev-server/#logging"
7374
`;
7475

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

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

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

560566
exports[`options validate should throw an error on the "static" option with '{"publicPath":false}' value 1`] = `
@@ -567,6 +573,7 @@ exports[`options validate should throw an error on the "static" option with '{"p
567573
* options.static.publicPath should be one of these:
568574
[string, ...] (should not have fewer than 1 item) | string
569575
-> The static files will be available in the browser under this public path.
576+
-> Read more at https://webpack.js.org/configuration/dev-server/#publicpath
570577
Details:
571578
* options.static.publicPath should be an array:
572579
[string, ...] (should not have fewer than 1 item)
@@ -583,6 +590,7 @@ exports[`options validate should throw an error on the "static" option with '{"s
583590
* options.static.serveIndex should be one of these:
584591
boolean | object { … }
585592
-> Tells dev server to use serveIndex middleware when enabled.
593+
-> Read more at https://webpack.js.org/configuration/dev-server/#serveindex
586594
Details:
587595
* options.static.serveIndex should be a boolean.
588596
* options.static.serveIndex should be an object:
@@ -599,6 +607,7 @@ exports[`options validate should throw an error on the "static" option with '{"w
599607
* options.static.watch should be one of these:
600608
boolean | object { … }
601609
-> Watches for files in static content directory.
610+
-> Read more at https://webpack.js.org/configuration/dev-server/#watch
602611
Details:
603612
* options.static.watch should be a boolean.
604613
* options.static.watch should be an object:

0 commit comments

Comments
 (0)