newline-before-break
- Group
- Style
- Path
lint/style/newline-before-break- Default
- Off, opt in
- Origin
- Falcon
- Rule
- 273 of 512
Requires a blank line before a break that follows another statement.
Checks labeled and unlabeled breaks in blocks. First statements, unbraced breaks, and switch-case lists are exempt. Blank lines above comments count.
Invalid
void loops(bool condition) {
while (condition) {
print('before');
break;
}
outer: for (var i = 0; i < 3; i++) {
while (condition) {
print('nested');
break outer;
}
}
}
void commented(bool condition) {
while (condition) {
print('before');
// No separating blank line.
break;
}
} print('before'); break; print('nested'); break outer; // No separating blank line. break;Valid
void loops(bool condition) {
while (condition) {
break;
}
while (condition) {
print('before');
break;
}
outer: for (var i = 0; i < 3; i++) {
while (condition) {
break outer;
}
}
while (condition) {
if (condition) break;
}
}
void cases(int value) {
switch (value) {
default:
print(value);
break;
}
}
void commented(bool condition) {
while (condition) {
print('before');
// Stop this loop.
break;
}
}Configure newline-before-break
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"style": {
"newline-before-break": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/style/newline-before-break: <reason>More style rules
- newline-before-case
Requires a blank line between successive switch statement case clauses.
- newline-before-constructor
Requires a blank line before constructors following another member.
- newline-before-continue
Requires a blank line before a continue that follows another statement.
- newline-before-method
Requires a blank line before method declarations following another member.
- newline-before-return
newline-before-returnFlags
returnstatements that are not preceded by a blank line. - newline-before-throw
Requires a blank line before a throw that follows another statement.
- no-default-cases
no_default_casesFlags
default:in switch statements over enums and enum-like classes. - no-leading-underscores-for-library-prefixes
no_leading_underscores_for_library_prefixesrecommendedFlags import prefixes that begin with an underscore.