Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

Commit 6cf76b8

Browse files
authoredJul 18, 2019
feat: improved validation error messages (#85)
1 parent aebfd74 commit 6cf76b8

8 files changed

+331
-265
lines changed
 

‎.github/CONTRIBUTING.md

+8
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ module. Thankfully, Github provides a means to do this. Add a dependency to the
147147

148148
Where `{id}` is the # ID of your Pull Request.
149149

150+
## Contributor License Agreement
151+
152+
When submitting your contribution, a CLA (Contributor License Agreement) bot will come by to verify that you signed the [CLA](https://cla.js.foundation/webpack-contrib/raw-loader).
153+
If it is your first time, it will link you to the right place to sign it.
154+
However, if you have committed your contributions using an email that is not the same as your email used on GitHub, the CLA bot can't accept your contribution.
155+
156+
Run `git config user.email` to see your Git email, and verify it with [your GitHub email](https://github.com/settings/emails).
157+
150158
## Thanks
151159

152160
For your interest, time, understanding, and for following this simple guide.

‎lint-staged.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
'*.js': ['prettier --write', 'eslint --fix', 'git add'],
3-
'(!CHANGELOG.md).{json,md,yml,css}': ['prettier --write', 'git add'],
3+
'*.{json,md,yml,css}': ['prettier --write', 'git add'],
44
};

‎package-lock.json

+298-242
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,34 @@
3838
},
3939
"dependencies": {
4040
"loader-utils": "^1.1.0",
41-
"schema-utils": "^1.0.0"
41+
"schema-utils": "^2.0.1"
4242
},
4343
"devDependencies": {
44-
"@babel/cli": "^7.1.5",
45-
"@babel/core": "^7.1.6",
46-
"@babel/preset-env": "^7.1.6",
47-
"@commitlint/cli": "^8.0.0",
48-
"@commitlint/config-conventional": "^8.0.0",
49-
"@webpack-contrib/defaults": "^5.0.0",
44+
"@babel/cli": "^7.5.5",
45+
"@babel/core": "^7.5.5",
46+
"@babel/preset-env": "^7.5.5",
47+
"@commitlint/cli": "^8.1.0",
48+
"@commitlint/config-conventional": "^8.1.0",
49+
"@webpack-contrib/defaults": "^5.0.2",
5050
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
51-
"babel-jest": "^24.5.0",
51+
"babel-jest": "^24.8.0",
5252
"commitlint-azure-pipelines-cli": "^1.0.2",
5353
"cross-env": "^5.2.0",
5454
"del": "^5.0.0",
5555
"del-cli": "^2.0.0",
5656
"eslint": "^6.0.1",
5757
"eslint-config-prettier": "^6.0.0",
58-
"eslint-plugin-import": "^2.14.0",
58+
"eslint-plugin-import": "^2.18.0",
5959
"eslint-plugin-prettier": "^3.1.0",
6060
"husky": "^3.0.0",
61-
"jest": "^24.5.0",
61+
"jest": "^24.8.0",
6262
"jest-junit": "^6.4.0",
6363
"lint-staged": "^9.2.0",
6464
"memory-fs": "^0.4.1",
6565
"npm-run-all": "^4.1.5",
66-
"prettier": "^1.11.1",
66+
"prettier": "^1.18.2",
6767
"standard-version": "^6.0.1",
68-
"webpack": "^4.3.0"
68+
"webpack": "^4.36.1"
6969
},
7070
"keywords": [
7171
"webpack"

‎src/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import schema from './options.json';
66
export default function rawLoader(source) {
77
const options = getOptions(this) || {};
88

9-
validateOptions(schema, options, 'Raw Loader');
9+
validateOptions(schema, options, {
10+
name: 'Raw Loader',
11+
baseDataPath: 'options',
12+
});
1013

1114
const json = JSON.stringify(source)
1215
.replace(/\u2028/g, '\\u2028')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`validate options 1`] = `
4+
"Invalid options object. Raw Loader has been initialised using an options object that does not match the API schema.
5+
- options has an unknown property 'unknown'. These properties are valid:
6+
object {}"
7+
`;

‎test/__snapshots__/validation.test.js.snap

-8
This file was deleted.

‎test/validation.test.js ‎test/validate-options.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import loader from '../src';
22

3-
it('validation', () => {
3+
it('validate options', () => {
44
const validate = (options) =>
55
loader.call(
66
Object.assign(

0 commit comments

Comments
 (0)
This repository has been archived.