Update configuration to be clearer about js config (#4993)
So in the list, it says to use `prettier.config.js` as your file name for configuring prettier in js. But in the example it has `//.prettierrc.js`. This confused me so I tried both file names. Both these file names work to configure prettier so I updated the docs to reflect that.master
parent
a687b9383b
commit
dda7c265d0
|
@ -5,9 +5,9 @@ title: Configuration File
|
||||||
|
|
||||||
Prettier uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for configuration file support. This means you can configure prettier via:
|
Prettier uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for configuration file support. This means you can configure prettier via:
|
||||||
|
|
||||||
- A `.prettierrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`.
|
- A `.prettierrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json`.
|
||||||
- A `.prettierrc.toml` file, written in TOML (the `.toml` extension is _required_).
|
- A `.prettierrc.toml` file, written in TOML (the `.toml` extension is _required_).
|
||||||
- A `prettier.config.js` file that exports an object.
|
- A `prettier.config.js` or `.prettierrc.js` file that exports an object.
|
||||||
- A `"prettier"` key in your `package.json` file.
|
- A `"prettier"` key in your `package.json` file.
|
||||||
|
|
||||||
The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn't) found.
|
The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn't) found.
|
||||||
|
@ -28,7 +28,7 @@ JSON:
|
||||||
JS:
|
JS:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// .prettierrc.js
|
// prettier.config.js or .prettierrc.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
printWidth: 100,
|
printWidth: 100,
|
||||||
parser: "flow"
|
parser: "flow"
|
||||||
|
|
Loading…
Reference in New Issue