Skip to content

Commit 3aa6b38

Browse files
fix(README): adapt validate() examples to 2.x api (#98)
1 parent 8262b9f commit 3aa6b38

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Some validations do more than just validating your data shape, they check for be
8181
- **no-root-files-node-modules-nameclash** (default: true): this checks that files/folders that are found in directories specified via webpacks `resolve.root` option do not nameclash with `node_modules` packages. This prevents nasty path resolving bugs (for a motivating example, have a look at [this redux issue](https://github.com/reactjs/redux/issues/1681)).
8282

8383
You opt in/out of rules by using the `rules` option:
84-
```
84+
```js
8585
module.exports = validate(config, {
8686
rules: {
8787
'no-root-files-node-modules-nameclash': false,
@@ -92,13 +92,13 @@ module.exports = validate(config, {
9292
**Note**: This is not yet implemented via cli options, the default rules will apply in that case.
9393
9494
#### Quiet Mode
95-
If you want to mute console output apart from errors, set `--quiet` (`-q`) or `validate(config, yourSchema, {quiet: true})`. This is particularly useful if you are using webpack `--json` as you'll want to avoid writing additional text to the JSON output.
95+
If you want to mute console output apart from errors, set `--quiet` (`-q`) or `validate(config, { quiet: true })`. This is particularly useful if you are using webpack `--json` as you'll want to avoid writing additional text to the JSON output.
9696
97-
#### Validate All **package.json** `scripts`
97+
#### Validate all **package.json** `scripts`
9898
It is possible to use the CLI to validate all your **package.json** `scripts` related configurations at once by using `--all-scripts` (`-a`). The system will try to guess the convention you are using and then executes validation against each script target based on that.
9999
100100
#### Advanced Usage
101-
If you need to access the validation results directly and want to control the side-effects (i.e. console.log output, `process.exit(1)` on fail behaviour) yourself, you can call the validation function like so: `validate(config, yourSchema, { returnValidation: true })`. This will make 1) the function return the validation results instead of your configuration and 2) not perform any side effects.
101+
If you need to access the validation results directly and want to control the side-effects (i.e. console.log output, `process.exit(1)` on fail behaviour) yourself, you can call the validation function like so: `validate(config, { returnValidation: true })`. This will make 1) the function return the validation results instead of your configuration and 2) not perform any side effects.
102102
103103
#### Support
104104
Because this module uses the amazing `Joi` validation library, this module only supports Node >=4.0.0.

0 commit comments

Comments
 (0)