Improve overrides documentation (#6416)

Refs. #6415.
master
Simon Lydell 2019-08-27 07:09:12 +02:00 committed by GitHub
parent 5c976c4636
commit 2827543154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 2 deletions

View File

@ -61,7 +61,9 @@ singleQuote = true
## Configuration Overrides
Prettier borrows eslint's [override format](http://eslint.org/docs/user-guide/configuring#example-configuration). This allows you to apply configuration to specific files.
Overrides let you have different configuration for certain file extensions, folders and specific files.
Prettier borrows ESLints [override format](http://eslint.org/docs/user-guide/configuring#example-configuration).
JSON:
@ -74,6 +76,12 @@ JSON:
"options": {
"semi": true
}
},
{
"files": ["*.html", "legacy/**/*.js"],
"options": {
"tabWidth": 4
}
}
]
}
@ -87,6 +95,11 @@ overrides:
- files: "*.test.js"
options:
semi: true
- files:
- "*.html"
- "legacy/**/*.js"
options:
tabWidth: 4
```
`files` is required for each override, and may be a string or array of strings. `excludeFiles` may be optionally provided to exclude files for a given rule, and may also be a string or array of strings.

View File

@ -62,7 +62,9 @@ singleQuote = true
## Configuration Overrides
Prettier borrows eslint's [override format](http://eslint.org/docs/user-guide/configuring#example-configuration). This allows you to apply configuration to specific files.
Overrides let you have different configuration for certain file extensions, folders and specific files.
Prettier borrows ESLints [override format](http://eslint.org/docs/user-guide/configuring#example-configuration).
JSON:
@ -75,6 +77,12 @@ JSON:
"options": {
"semi": true
}
},
{
"files": ["*.html", "legacy/**/*.js"],
"options": {
"tabWidth": 4
}
}
]
}
@ -88,6 +96,11 @@ overrides:
- files: "*.test.js"
options:
semi: true
- files:
- "*.html"
- "legacy/**/*.js"
options:
tabWidth: 4
```
`files` is required for each override, and may be a string or array of strings. `excludeFiles` may be optionally provided to exclude files for a given rule, and may also be a string or array of strings.