diff --git a/lint/rules/curly.md b/lint/rules/curly.md new file mode 100644 index 000000000..e440fa16b --- /dev/null +++ b/lint/rules/curly.md @@ -0,0 +1,59 @@ +--- +tags: [recommended] +--- + +Enfore consistent brace style for all control statements. + +**Invalid:** + +```ts +if (foo) bar; + +if (foo) { + bar; +} else baz; + +while (foo) bar; + +do bar; while (foo); + +for (let i = 0; i < 10; i++) bar; + +for (a in b) bar; + +for (const a of b) bar; +``` + +**Valid:** + +```ts +if (foo) { + bar; +} + +if (foo) { + bar; +} else { + baz; +} + +while (foo) { + bar; +} + +do { + bar; +} while (foo); + +for (let i = 0; i < 10; i++) { + bar; +} + +for (a in b) { + bar; +} + +for (const a of b) { + bar; +} +```