diff --git a/docs/api.md b/docs/api.md index 50dab9a63..8d4fdc6aa 100644 --- a/docs/api.md +++ b/docs/api.md @@ -49,7 +49,10 @@ If `options.useCache` is `false`, all caching will be bypassed. ```js const text = await fs.readFile(filePath, "utf8"); const options = await prettier.resolveConfig(filePath); -const formatted = await prettier.format(text, options); +const formatted = await prettier.format(text, { + ...options, + filepath: filePath, +}); ``` If `options.editorconfig` is `true` and an [`.editorconfig` file](https://editorconfig.org/) is in your project, Prettier will parse it and convert its properties to the corresponding Prettier configuration. This configuration will be overridden by `.prettierrc`, etc. Currently, the following EditorConfig properties are supported: