Skip to content

Commit 549ea08

Browse files
committedAug 8, 2018
fix(options): improved ValidationError messages
1 parent fbf05de commit 549ea08

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed
 

‎src/options.json

+18
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
"type": "object"
1212
}
1313
},
14+
"errorMessage": {
15+
"properties": {
16+
"ctx": "should be {Object} (https://github.com/postcss/postcss-loader#context-ctx)",
17+
"path": "should be {String} (https://github.com/postcss/postcss-loader#path)"
18+
}
19+
},
1420
"additionalProperties": false
1521
},
1622
"exec": {
@@ -39,5 +45,17 @@
3945
"type": [ "string", "boolean" ]
4046
}
4147
},
48+
"errorMessage": {
49+
"properties": {
50+
"exec": "should be {Boolean} (https://github.com/postcss/postcss-loader#exec)",
51+
"ident": "should be {String} (https://github.com/postcss/postcss-loader#plugins)",
52+
"config": "should be {Object} (https://github.com/postcss/postcss-loader#config)",
53+
"parser": "should be {String|Object} (https://github.com/postcss/postcss-loader#parser)",
54+
"syntax": "should be {String|Object} (https://github.com/postcss/postcss-loader#syntax)",
55+
"stringifier": "should be {String|Object} (https://github.com/postcss/postcss-loader#stringifier)",
56+
"plugins": "should be {Array|Object|Function} (https://github.com/postcss/postcss-loader#plugins)",
57+
"sourceMap": "should be {String|Boolean} (https://github.com/postcss/postcss-loader#sourcemap)"
58+
}
59+
},
4260
"additionalProperties": true
4361
}

‎test/__snapshots__/Errors.test.js.snap

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`Errors Syntax Error 1`] = `
4-
"Syntax Error
4+
"Syntax Error
55
66
(1:3) Unexpected separator in property
77
@@ -14,6 +14,8 @@ exports[`Errors Syntax Error 1`] = `
1414
exports[`Errors Validation Error 1`] = `
1515
"ValidationError: PostCSS Loader Invalid Options
1616
17-
options.sourceMap should be string,boolean
18-
"
17+
options.sourceMap should be {String|Boolean} (https://github.com/postcss/postcss-loader#sourcemap)
18+
19+
at validateOptions (/Users/Cini/Github/webpack/loaders/postcss/node_modules/@webpack-utilities/schema/src/validateOptions.js:25:11)
20+
at Object.loader (/Users/Cini/Github/webpack/loaders/postcss/src/index.js:44:3)"
1921
`;

0 commit comments

Comments
 (0)
Please sign in to comment.