unified-engine accepts configuration through options and through
configuration files.
One configuration file can be given through rcPath, this is loaded
regardless of detectConfig and rcName.
Otherwise, configuration files are detected if detectConfig
is turned on, depending on the following options:
- If
rcNameis given,$rcName(JSON),$rcName.js(CommonJS),$rcName.yml(YAML), and$rcName.yaml(YAML) are loaded - If
packageFieldis given,package.json(JSON) files are loaded and their$packageFields are used as configuration
In this case, the first file that is searched for in a directory is used as the configuration. If no file is found, the parent directory is searched, and so on.
An example rc file could look as follows:
{
"settings": {
"bullet": "*",
"ruleRepetition": 3,
"fences": true
},
"plugins": [
"inline-links",
"lint-recommended"
]
}An example rc.js file could look as follows:
exports.plugins = [
'./script/natural-language',
'lint-recommended',
'license'
]
exports.settings = {bullet: '*'}An example rc.yaml file could look as follows:
plugins:
- lint
- document
- minify
settings:
verbose: true
quote: "'"
quoteSmart: true
preferUnquoted: trueThe following properties are currently used in configuration files.
The settings field, related to settings in options,
configures the parser and compiler of the processor.
{
"settings": {
"position": "false"
}
}- Type:
Object
The plugins field, related to plugins in options, has either
an array of plug-in names (or paths) or plugin–options tuples, or an object
mapping plug-in’s to their options.
Plug-in options can be false, which specifies that a plug-in should not be
used. In all other cases, they are treated as an object, and merged by the
cascade. Thus, it’s possible to specify part of the options from one
configuration file, and overwrite or extend it from another file.
Accepts an array:
{
"plugins": [
"foo",
"bar",
[
"qux",
{"quux": true}
]
]
}Or an object:
{
"plugins": {
"foo": null,
"bar": {
"baz": "qux"
}
}
}- Type:
Array.<string>orObject.<*>