Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fisker/write-prettier-file
write prettier formatted file
https://github.com/fisker/write-prettier-file
Last synced: 6 days ago
JSON representation
write prettier formatted file
- Host: GitHub
- URL: https://github.com/fisker/write-prettier-file
- Owner: fisker
- License: mit
- Created: 2019-06-24T09:08:29.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-05-29T02:06:58.000Z (6 months ago)
- Last Synced: 2024-05-29T15:49:38.561Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 1.9 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# write-prettier-file
[![Build Status][github_actions_badge]][github_actions_link]
[![Coverage][coveralls_badge]][coveralls_link]
[![Npm Version][package_version_badge]][package_link]
[![MIT License][license_badge]][license_link][github_actions_badge]: https://img.shields.io/github/workflow/status/fisker/write-prettier-file/CI/master?style=flat-square
[github_actions_link]: https://github.com/fisker/write-prettier-file/actions?query=branch%3Amaster
[coveralls_badge]: https://img.shields.io/coveralls/github/fisker/write-prettier-file/master?style=flat-square
[coveralls_link]: https://coveralls.io/github/fisker/write-prettier-file?branch=master
[license_badge]: https://img.shields.io/npm/l/write-prettier-file.svg?style=flat-square
[license_link]: https://github.com/fisker/write-prettier-file/blob/master/license
[package_version_badge]: https://img.shields.io/npm/v/write-prettier-file.svg?style=flat-square
[package_link]: https://www.npmjs.com/package/write-prettier-file> write prettier formatted file
## Install
```sh
yarn add write-prettier-file
```## Ustage
```js
import writePrettierFile from 'write-prettier-file'await writePrettierFile('example.js', `hello('world');`)
```## API
### writePrettierFile(file, data, options?)
#### file
Type: `string | URL`
Path to file.
#### data
Type: `string`
Source code, you want to format
#### options
Type: `object`
any value [`prettier-format`](https://github.com/fisker/prettier-format) takes
#### options.resolveConfig
Type: `boolean`
Set to `false` to prevent load config.
## Related
- [prettier-format](https://github.com/fisker/prettier-format) run prettier on code.