description:"Enforces braces for `if`/`for`/`do`/`while` statements.",
rationale:(_a=["\n ```ts\n if (foo === bar)\n foo++;\n bar++;\n ```\n\n In the code above, the author almost certainly meant for both `foo++` and `bar++`\n to be executed only if `foo === bar`. However, he forgot braces and `bar++` will be executed\n no matter what. This rule could prevent such a mistake."],_a.raw=["\n \\`\\`\\`ts\n if (foo === bar)\n foo++;\n bar++;\n \\`\\`\\`\n\n In the code above, the author almost certainly meant for both \\`foo++\\` and \\`bar++\\`\n to be executed only if \\`foo === bar\\`. However, he forgot braces and \\`bar++\\` will be executed\n no matter what. This rule could prevent such a mistake."],Lint.Utils.dedent(_a)),
optionsDescription:(_b=["\n One of the following options may be provided:\n\n * `\"","\"` forbids any unnecessary curly braces.\n * `\"","\"` skips checking braces for control-flow statements\n that are on one line and start on the same line as their control-flow keyword\n "],_b.raw=["\n One of the following options may be provided:\n\n * \\`\"","\"\\` forbids any unnecessary curly braces.\n * \\`\"","\"\\` skips checking braces for control-flow statements\n that are on one line and start on the same line as their control-flow keyword\n "],Lint.Utils.dedent(_b,OPTION_AS_NEEDED,OPTION_IGNORE_SAME_LINE)),
options:{
type:"array",
items:{
type:"string",
enum:[
OPTION_AS_NEEDED,
OPTION_IGNORE_SAME_LINE,
],
},
},
optionExamples:[
true,
[true,OPTION_IGNORE_SAME_LINE],
[true,OPTION_AS_NEEDED],
],
type:"functionality",
typescriptOnly:false,
};
/* tslint:enable:object-literal-sort-keys */
Rule.FAILURE_STRING_AS_NEEDED="Block contains only one statement; remove the curly braces.";