Improve overrides documentation (#6416)

Refs. #6415.
This commit is contained in:
Simon Lydell authored and GitHub committed 2019-08-27 07:09:12 +02:00
1 parent 5c976c4636
commit 2827543154
2 files changed
+28 -2

No files matched your search

+14 -1
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 ESLint’s [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.
@@ -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 ESLint’s [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.