feat(ui): JS config support

This commit is contained in:
Guillaume Chau
2018-04-28 19:59:06 +02:00
parent 5b5d754e09
commit 87116364a7
2 changed files with 28 additions and 11 deletions
+4 -3
View File
@@ -104,7 +104,7 @@ api.describeConfig({
})
```
Then you can specify which files will be read when loading the configuration and then written to (JS files aren't supported yet):
Then you can specify which files will be read when loading the configuration and then written to:
```js
api.describeConfig({
@@ -112,13 +112,14 @@ api.describeConfig({
// All possible files for this config
files: {
json: ['.eslintrc', '.eslintrc.json'],
js: ['.eslintrc.js'],
// Will read from `package.json`
package: 'eslintConfig'
},
})
```
Supported types: `json`, `yaml`, `package`.
Supported types: `json`, `yaml`, `js`, `package`.
Use the `onRead` hook to return a list of prompts to be displayed for the configuration:
@@ -164,7 +165,7 @@ Arguments:
- `prompts`: current prompts runtime objects
- `answers`: answers data from the user inputs
- `data`: initial data read from the file
- `data`: read-only initial data read from the file
- `file`: descriptor of the found file (`{ type: 'json', path: '...' }`)
- `api`: onWrite API