prettier-plugin-curly
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -19,2 +19,5 @@ "use strict"; | ||
[`if (a) { b; }`, `if (a) { b; }`], | ||
[`if (a) b; else c;`, `if (a) { b; } else { c; }`], | ||
[`if (a) b; else { c; }`, `if (a) { b; } else { c; }`], | ||
[`if (a) b; else if (b) c;`, `if (a) { b; } else if (b) { c; }`], | ||
["let a; let a;", "let a; let a;"], | ||
@@ -21,0 +24,0 @@ ["foo; import a from 'bar'", "foo; import a from 'bar'"], |
@@ -53,5 +53,16 @@ "use strict"; | ||
") { ", | ||
code.slice(node.consequent.start, node.end), | ||
code.slice(node.consequent.start, node.consequent.end), | ||
" }", | ||
].join(""); | ||
node.alternate && [ | ||
" else ", | ||
node.alternate.type !== "IfStatement" && [ | ||
node.alternate.type !== "BlockStatement" && "{ ", | ||
code.slice(node.alternate.start, node.alternate.end), | ||
node.alternate.type !== "BlockStatement" && " }", | ||
], | ||
], | ||
] | ||
.flat(Infinity) | ||
.filter(Boolean) | ||
.join(""); | ||
case "WhileStatement": | ||
@@ -58,0 +69,0 @@ return [ |
{ | ||
"name": "prettier-plugin-curly", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Prettier plugin to enforce consistent brace style for all control statements.", | ||
@@ -50,7 +50,7 @@ "repository": { | ||
"@typescript-eslint/parser": "^6.0.0", | ||
"@vitest/coverage-istanbul": "^0.33.0", | ||
"@vitest/coverage-istanbul": "^0.34.0", | ||
"console-fail-test": "^0.2.3", | ||
"cspell": "^6.31.1", | ||
"cspell": "^7.0.0", | ||
"eslint": "^8.40.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-deprecation": "^1.4.1", | ||
@@ -65,10 +65,10 @@ "eslint-plugin-eslint-comments": "^3.2.0", | ||
"eslint-plugin-simple-import-sort": "^10.0.0", | ||
"eslint-plugin-typescript-sort-keys": "^2.3.0", | ||
"eslint-plugin-vitest": "^0.2.2", | ||
"eslint-plugin-typescript-sort-keys": "^3.0.0", | ||
"eslint-plugin-vitest": "^0.3.0", | ||
"eslint-plugin-yml": "^1.7.0", | ||
"husky": "^8.0.3", | ||
"jsonc-eslint-parser": "^2.3.0", | ||
"knip": "2.15.5", | ||
"lint-staged": "^13.2.2", | ||
"markdownlint": "^0.29.0", | ||
"knip": "2.21.1", | ||
"lint-staged": "^14.0.0", | ||
"markdownlint": "^0.30.0", | ||
"markdownlint-cli": "^0.35.0", | ||
@@ -83,3 +83,3 @@ "npm-package-json-lint": "^7.0.0", | ||
"typescript": "^5.0.4", | ||
"vitest": "^0.33.0", | ||
"vitest": "^0.34.0", | ||
"yaml-eslint-parser": "^1.2.2" | ||
@@ -90,3 +90,3 @@ }, | ||
}, | ||
"packageManager": "pnpm@8.6.7", | ||
"packageManager": "pnpm@8.7.1", | ||
"engines": { | ||
@@ -93,0 +93,0 @@ "node": ">=18" |
@@ -60,2 +60,4 @@ <h1 align="center">prettier-plugin-curly</h1> | ||
> See [The Blurry Line Between Formatting and Style](https://blog.joshuakgoldberg.com/the-blurry-line-between-formatting-and-style) for more details. | ||
## Development | ||
@@ -75,3 +77,3 @@ | ||
<tr> | ||
<td align="center" valign="top" width="14.28%"><a href="http://www.joshuakgoldberg.com"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg"/><br /><sub><b>Josh Goldberg</b></sub></a><br /><a href="#tool-JoshuaKGoldberg" title="Tools">🔧</a> <a href="#maintenance-JoshuaKGoldberg" title="Maintenance">🚧</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="http://www.joshuakgoldberg.com"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg"/><br /><sub><b>Josh Goldberg</b></sub></a><br /><a href="#tool-JoshuaKGoldberg" title="Tools">🔧</a> <a href="#maintenance-JoshuaKGoldberg" title="Maintenance">🚧</a> <a href="https://github.com/JoshuaKGoldberg/prettier-plugin-curly/commits?author=JoshuaKGoldberg" title="Code">💻</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="https://navinmoorthy.me/"><img src="https://avatars.githubusercontent.com/u/39694575?v=4?s=100" width="100px;" alt="Navin Moorthy"/><br /><sub><b>Navin Moorthy</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/prettier-plugin-curly/issues?q=author%3Anavin-moorthy" title="Bug reports">🐛</a></td> | ||
@@ -78,0 +80,0 @@ <td align="center" valign="top" width="14.28%"><a href="https://mk1.io"><img src="https://avatars.githubusercontent.com/u/58381667?v=4?s=100" width="100px;" alt="ʀᴀʏ"/><br /><sub><b>ʀᴀʏ</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/prettier-plugin-curly/commits?author=so1ve" title="Documentation">📖</a> <a href="https://github.com/JoshuaKGoldberg/prettier-plugin-curly/commits?author=so1ve" title="Code">💻</a> <a href="https://github.com/JoshuaKGoldberg/prettier-plugin-curly/issues?q=author%3Aso1ve" title="Bug reports">🐛</a></td> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
25800
232
92