lockfile-lint supports file-based configuration via cosmiconfig, allowing options to be specified in configuration files instead of command-line arguments.
Configuration files are searched in the following order (first match wins):
lockfile-lint key in package.json.lockfile-lintrc (JSON or YAML).lockfile-lintrc.json.lockfile-lintrc.yaml or .lockfile-lintrc.yml.lockfile-lintrc.js (CommonJS module exporting object)lockfile-lint.config.js (CommonJS module exporting object)Configuration files are searched starting from the current working directory up the file tree until found. Search stops at the first matching file.
Command-line arguments always override configuration file values.
All CLI options are supported in configuration files using camelCase naming:
{
"path": "package-lock.json",
"type": "npm",
"validateHttps": true,
"allowedHosts": ["npm"],
"allowedSchemes": ["https:", "git+https:"],
"allowedUrls": ["https://github.com/user/repo#hash"],
"emptyHostname": true,
"validatePackageNames": true,
"validateIntegrity": true,
"allowedPackageNameAliases": ["alias:original"],
"integrityExclude": ["package-name"],
"format": "pretty"
}{
"name": "my-project",
"lockfile-lint": {
"path": "package-lock.json",
"validateHttps": true,
"allowedHosts": ["npm"]
}
}{
"path": "yarn.lock",
"allowedHosts": ["yarn", "npm"],
"allowedSchemes": ["https:", "git+https:"],
"validatePackageNames": true
}module.exports = {
path: "package-lock.json",
validateHttps: true,
allowedHosts: ["npm"],
validateIntegrity: true
};path is specified in config file, it can still be overridden by --path CLI argumentallowedHosts) are merged with CLI arguments, with CLI taking precedencelockfile-lint uses the debug npm package for detailed logging.
DEBUG=lockfile-lint lockfile-lint --path yarn.lock --validate-httpsDebug output uses the standard debug package format:
lockfile-lint:validator:https Validating package: example@1.0.0
lockfile-lint:config Loading config from: .lockfile-lintrc.json