- Type:
Object
- Default:
{}
Predefined configs. Must have the name of the config, which can be called from options.settings
(as string) or options.props.extends
from the options.settings
(as object) or found config file.
For example, usage with options.settings
:
{
"predefinedConfigs": { "name": { "ok": true } },
"settings": "name"
}
For example, usage with options.props.extends
(extends
by default) from found config file:
{
"extends": "name"
}
Predefined config will be merged with config from found config file.
- Type:
String[]
- Default:
[]
The names of the config files that can be used as a configs.
- Type:
Parser[]
- Default:
see below
Parsers that will be apply to the found configs. The parser receive the content from the configuration file and returns an object.
{
options: {
parsers: [
// Before applying the parser we check the pattern for the current file
{ pattern: /.*\.yml$/, parser: (text) => mySuperYamlParser(text) }
]
}
}
The Parser
interface has the following type:
interface Parser {
pattern: RegExp;
parser: (text: string) => object;
}
- Type:
String
- Default:
null
Allow to get the path to the configuration file from environment variable.
- Type:
Object
- Default:
{ package: null, extends: 'extends' }
- Available:
IOptions
- Type:
String
- Default:
extends
The name of property in the package.json
file. If you set this option, we'll look for package.json
file.
- Type:
String
- Default:
extends
Allow to use extends
property in a configuration file or settings to reference to another configuration file or predefined config.
Use ~
to refer to HOME directory and ./
or ../
to refer to the current workspace (relative). Also you can use absolute path.
Tip
We'll merge config in order from the most deep to the top.
See fixtures/extends
directory as an example.
- Type:
Boolean
- Default:
true
Control of cache.
- Type:
Object|String
- Default:
null
The settings from the editor or plugin/module options. Can have the object, the name of a predefined config or the path to the config.
{
"predefinedConfigs": { "name": { "ok": true } },
"settings": { "ok": true },
"settings": "name",
"settings": "~/my-module-config.json",
"settings": "../configs/my-module-config.json"
}
Tip
Use
~
to refer to HOME directory and./
or../
to refer to the current workspace (relative). Also you can use absolute path.
- Type:
Boolean
- Default:
false
Allow to use each parser to config file. Necessary in the case that a single file can have multiple syntaxes. We just ignore the pattern
property.
- Type:
Function
- Default:
(result) => result
A function that returns the result. The result
has the following object:
{
from: './path/to/config/file.json', // Also can be 'settings' or 'predefined'
config: { ok: true }
}
- Type:
Boolean
- Default:
true
Allow configs in the HOME directory or not.
- Type:
Boolean
- Default:
null
Merge builded config with passed object.