{"id":15698982,"url":"https://github.com/pgilad/esformatter-braces","last_synced_at":"2025-05-08T22:16:45.203Z","repository":{"id":57227549,"uuid":"21433597","full_name":"pgilad/esformatter-braces","owner":"pgilad","description":"Esformatter plugin for enforcing braces around statements","archived":false,"fork":false,"pushed_at":"2015-05-28T13:59:51.000Z","size":271,"stargazers_count":9,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-08T22:16:38.364Z","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/pgilad.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}},"created_at":"2014-07-02T17:36:32.000Z","updated_at":"2022-08-11T14:04:06.000Z","dependencies_parsed_at":"2022-09-12T22:30:42.963Z","dependency_job_id":null,"html_url":"https://github.com/pgilad/esformatter-braces","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgilad%2Fesformatter-braces","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgilad%2Fesformatter-braces/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgilad%2Fesformatter-braces/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgilad%2Fesformatter-braces/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgilad","download_url":"https://codeload.github.com/pgilad/esformatter-braces/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253154983,"owners_count":21862624,"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-10-03T19:37:14.052Z","updated_at":"2025-05-08T22:16:45.184Z","avatar_url":"https://github.com/pgilad.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [esformatter](https://github.com/millermedeiros/esformatter)-braces\n\n\u003e esformatter plugin for enforcing braces around statements\n\n[![NPM Version](http://img.shields.io/npm/v/esformatter-braces.svg?style=flat)](https://npmjs.org/package/esformatter-braces)\n[![NPM Downloads](http://img.shields.io/npm/dm/esformatter-braces.svg?style=flat)](https://npmjs.org/package/esformatter-braces)\n[![Build Status](http://img.shields.io/travis/pgilad/esformatter-braces.svg?style=flat)](https://travis-ci.org/pgilad/esformatter-braces)\n\n**Esformatter-braces** is a plugin for [esformatter](https://github.com/millermedeiros/esformatter) meant for brace enforcement around statements. Recommended by Douglas Crockford in his [coding style guide](http://javascript.crockford.com/code.html).\n\nTurn this:\n```js\nif (theSkyIsBlue)\n    stareAtItForAWhile();\n```\n\ninto:\n```js\nif (theSkyIsBlue) {\n    stareAtItForAWhile();\n}\n```\n\nFor more information see:\n- [Jetbrain's Idea](http://www.jetbrains.com/idea/webhelp10.5/wrapping-and-braces.html) and specifically the **Force brace always** section.\n- The [jsHint](https://github.com/jshint/jshint/) option - [curly](http://www.jshint.com/docs/options/#curly)\n\nCurrently the following node statements are handled:\n **If conditionals**, **While**, **Do While**, **For loops**\n\n*For any other formatting (such as braces placement, spacing and line wrapping) use esformatter or other plugins.*\n\n## Goals\n\n- Add similar options to IDEA's: **Do not force** and **Multiline**\n- Possibly do the reverse: remove braces if possible (single line statements)\n\n## Installation\n\n```sh\n$ npm install esformatter-braces --save-dev\n```\n\n## Config\n\nNewest esformatter versions autoload plugins from your `node_modules` [See this](https://github.com/millermedeiros/esformatter#plugins)\n\nAdd to your esformatter config file:\n\n```json\n{\n  \"plugins\": [\n    \"esformatter-braces\"\n  ]\n}\n```\n\nOr you can manually register your plugin:\n```js\n// register plugin\nesformatter.register(require('esformatter-braces'));\n```\n\n## Usage\n\n```js\nvar fs = require('fs');\nvar esformatter = require('esformatter');\n//register plugin manually\nesformatter.register(require('esformatter-braces'));\n\nvar str = fs.readFileSync('someKewlFile.js').toString();\nvar output = esformatter.format(str);\n//-\u003e output will now contain the formatted string\n```\n\nSee [esformatter](https://github.com/millermedeiros/esformatter) for more options and further usage.\n\n## License\n\nMIT @[Gilad Peleg](http://giladpeleg.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgilad%2Fesformatter-braces","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgilad%2Fesformatter-braces","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgilad%2Fesformatter-braces/lists"}