missing-whitespace-between-adjacent-strings
Same as missing_whitespace_between_adjacent_strings in Dart lints
- Group
- Style
- Path
lint/style/missing-whitespace-between-adjacent-strings- Default
- On (recommended)
- Origin
- Dart lints
- Rule
- 270 of 512
Flags adjacent string literals that join two words without a space between them.
When a part of an adjacent-string concatenation contains whitespace (so it reads as prose), neither it nor the next part supplying whitespace at the seam usually means a missing space:
var s = 'This string will be concatenated' // flagged
'with the next one.';
var s = 'This string will be concatenated '
'with the next one.'; // fine
An interpolation at the seam counts as whitespace. Strings passed straight
to RegExp(...) or an unqualified matches(...) call are skipped, since
patterns are split for readability rather than prose.
Invalid
void use(Object o) {}
bool matches(String pattern) => pattern.isNotEmpty;
void main() {
var name = 'Ann';
use('This string will be concatenated'
'with the next one.');
use('Hello there' 'world');
use('$name is' 'here');
use('one two' 'three four'
'five');
use('line one' '''
line two''');
use2(text: 'named arg' 'too');
}
void use2({required String text}) {} var name = 'Ann'; use('This string will be concatenated' 'with the next one.'); use('Hello there' 'world'); use('Hello there' 'world'); use('$name is' 'here'); use('$name is' 'here'); use('one two' 'three four' use('$name is' 'here'); use('one two' 'three four' 'five'); use('line one' '''line two'''); use2(text: 'named arg' 'too');Valid
void use(Object o) {}
bool matches(String pattern) => pattern.isNotEmpty;
void main() {
var name = 'Ann';
use('This string will be concatenated '
'with the next one.');
use('Hello' ' world');
use('nospace' 'here');
use('Name is ' '$name.');
use('Name is' '${name}x');
use('Name is' '$name.');
use('Name is $name' 'x');
use(RegExp('(foo bar)' '(baz)'));
use(new RegExp('a b' 'c'));
use(matches('a b' 'c'));
use('tab\t' 'x');
}Configure missing-whitespace-between-adjacent-strings
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"style": {
"missing-whitespace-between-adjacent-strings": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/style/missing-whitespace-between-adjacent-strings: <reason>More style rules
- newline-before-break
Requires a blank line before a break that follows another statement.
- 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.