
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
configuration-validator
Advanced tools
Validate your webpack configuration and save yourself hours of debugging time
Built as the pluggable validator for webpack-validator but could be used to validate any configuration object.
var configValidator = require('configuration-validator')
// call the function with your config and validators
configValidator('Name of config', config, arrayOfValidators)
A validator is an object that describes to configuration-validator what it should run on and defines a function to run to do the validation. Here's an example of a simple validator that checks for the value to be a boolean:
{
key: 'foo.bar', // can be any depth. Uses lodash's `get` method
description: 'Some descriptive message', // used in verbose mode (in development)
validate: function validateFooBar(value, context) {
// value is the value of `foo.bar` for the given object
// context is an object with the following properties:
// - `key` - `foo.bar` in this case
// - `parent` - the parent object in which this value is found
// - `config` - the entire object being validated
if (typeof value !== 'boolean') {
// if it's not a boolean, then we fail the validation. In this case
// we return a message that is an error or a warning
return 'must be a boolean' // just shorthand for: {error: 'must be a boolean'}
// or you can do:
// return {warning: 'must be a boolean'} // output is yellow
// return {error: 'must be a boolean'} // output is red
}
},
}
One handy feature of the configuration-validator is that it will warn if your object has a path that's not covered by validation keys. For example, consider the following config:
// config
const config = {
bar: {
foo: true,
foobar: 2,
},
baz: 32,
}
There are three paths associated with this config object: bar.foo, bar.foobar, and baz.
Given the following validators:
const validators = [
{key: 'bar.foo', validate() {}},
{key: 'baz', validate() {}},
]
You will get a warning indicating that bar.foobar is an uncovered path (meaning it's not validated).
To cover all paths, you could simply add a validotor for bar.foobar or add a validator for the entire bar path like so:
const validators = [
{key: 'bar', validate() {}},
{key: 'baz', validate() {}},
]
One issue you might have with this is currently you lose the deep path check because the entire object is considered to be covered. So, if you were to misspell the foo property, you wouldn't get the warning.
Catching misspellings is the biggest benefit of the uncovered path validation feature, so it's normally best to try to avoid doing validation on entire objects if possible and try to validate privitives and arrays only.
MIT
FAQs
Validate your webpack configuration and save yourself hours of debugging time
We found that configuration-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.