Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 635 Bytes

leading_newlines_in_multiline_strings.md

File metadata and controls

32 lines (23 loc) · 635 Bytes

Pattern: Missing leading newline for multi-line string

Issue: -

Description

Multi-line strings are easier to read when they start with a newline (a newline starting a multi-line string is ignored).

Example of incorrect code:

var s1 = '''{
  "a": 1,
  "b": 2
}''';

Example of correct code:

var s1 = '''
{
  "a": 1,
  "b": 2
}''';

var s2 = '''This onliner multiline string is ok. It usually allows to escape both ' and " in the string.''';

Further Reading