{"id":19412900,"url":"https://github.com/fisker/prettier-format","last_synced_at":"2025-07-10T15:36:20.855Z","repository":{"id":35008076,"uuid":"195997368","full_name":"fisker/prettier-format","owner":"fisker","description":"auto load config and run prettier on code","archived":false,"fork":false,"pushed_at":"2024-04-04T01:03:50.000Z","size":393,"stargazers_count":1,"open_issues_count":12,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-04T02:25:39.992Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fisker.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"fisker","open_collective":"fisker","custom":"https://buymeacoffee.com/fisker","patreon":"fisker_cheung"}},"created_at":"2019-07-09T11:42:46.000Z","updated_at":"2024-04-15T11:48:27.232Z","dependencies_parsed_at":"2024-02-14T11:26:20.769Z","dependency_job_id":"9c64a154-6134-4e60-a60d-36722f2982de","html_url":"https://github.com/fisker/prettier-format","commit_stats":{"total_commits":807,"total_committers":6,"mean_commits":134.5,"dds":0.5613382899628252,"last_synced_commit":"cf988fdb2c84bb5b5ad498d60f41be43f674a592"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fisker%2Fprettier-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fisker%2Fprettier-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fisker%2Fprettier-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fisker%2Fprettier-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fisker","download_url":"https://codeload.github.com/fisker/prettier-format/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233642168,"owners_count":18707255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T12:29:15.885Z","updated_at":"2025-01-13T23:42:19.010Z","avatar_url":"https://github.com/fisker.png","language":"JavaScript","readme":"# prettier-format\n\n[![Build Status][github_actions_badge]][github_actions_link]\n[![Coverage][coveralls_badge]][coveralls_link]\n[![Npm Version][package_version_badge]][package_link]\n[![MIT License][license_badge]][license_link]\n\n[github_actions_badge]: https://img.shields.io/github/workflow/status/fisker/prettier-format/CI/master?style=flat-square\n[github_actions_link]: https://github.com/fisker/prettier-format/actions?query=branch%3Amaster\n[coveralls_badge]: https://img.shields.io/coveralls/github/fisker/prettier-format/master?style=flat-square\n[coveralls_link]: https://coveralls.io/github/fisker/prettier-format?branch=master\n[license_badge]: https://img.shields.io/npm/l/prettier-format.svg?style=flat-square\n[license_link]: https://github.com/fisker/prettier-format/blob/master/license\n[package_version_badge]: https://img.shields.io/npm/v/prettier-format.svg?style=flat-square\n[package_link]: https://www.npmjs.com/package/prettier-format\n\n\u003e auto load config and run prettier on code\n\n## Motivation\n\nTo load config and format code with prettier, you have to do\n\n```js\nconst config = await prettier.resolveConfig('path/to/file', {useCache: false})\n\nconst formatted = await prettier.format(source, {...config, semi: false})\n```\n\nI want it simple\n\n```js\nconst formatted = await format(source, {\n  filepath: 'path/to/file',\n  useCache: false,\n  semi: false,\n})\n```\n\n## Install\n\n```sh\nyarn add prettier-format\n```\n\n## Usage\n\n```js\nimport format from 'prettier-format'\n\nawait format(`hello (  'world' )`)\n// =\u003e hello(\"world\");\\n\n```\n\n## API\n\n### format(source, options?)\n\nReturns `promise` resolves with formatted code.\n\n#### source\n\nType: `string`\n\nSource code you want to format.\n\n#### options\n\nType: `object`\n\nany value [`prettier.resolveConfig`](https://prettier.io/docs/en/api.html#prettierresolveconfigfilepath-options) takes\n\nany value [`prettier.format`](https://prettier.io/docs/en/api.html#prettierformatsource-options) takes\n\n#### options.filepath\n\nType: `string`\n\nThe filepath of source code, if filepath is not empty, config will load automaticly.\n\n## Related\n\n- [write-prettier-file](https://github.com/fisker/write-prettier-file) write formatted code to file.\n","funding_links":["https://github.com/sponsors/fisker","https://opencollective.com/fisker","https://buymeacoffee.com/fisker","https://patreon.com/fisker_cheung"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffisker%2Fprettier-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffisker%2Fprettier-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffisker%2Fprettier-format/lists"}