Sha256: fe1c98c3077d9bd4b65b3ee59123d0b7cc2b816d1222448ce26c2bac2c38f8fa

Contents?: true

Size: 1.26 KB

Versions: 24

Compression:

Stored size: 1.26 KB

Contents

# string-no-newline

Disallow (unescaped) newlines in strings.

<!-- prettier-ignore -->
```css
a {
  content: "first
    second";     ↑
}                ↑
/**              ↑
 * The newline here */
```

[The spec](https://www.w3.org/TR/CSS2/syndata.html#strings) says this: "A string cannot directly contain a newline. To include a newline in a string, use an escape representing the line feed character in ISO-10646 (U+000A), such as '\A' or '\00000a'." And also: "It is possible to break strings over several lines, for aesthetic or other reasons, but in such a case the newline itself has to be escaped with a backslash (\\)."

## Options

### `true`

The following patterns are considered violations:

<!-- prettier-ignore -->
```css
a {
  content: "first
    second";
}
```

<!-- prettier-ignore -->
```css
[title="something
is probably wrong"] {}
```

<!-- prettier-ignore -->
```css
a {
  font-family: "Times
    New
    Roman";
}
```

The following patterns are _not_ considered violations:

<!-- prettier-ignore -->
```css
a {
  content: "first\Asecond";
}
```

<!-- prettier-ignore -->
```css
a {
  content: "first\\nsecond";
}
```

<!-- prettier-ignore -->
```css
[title="nothing\
  is wrong"] {}
```

<!-- prettier-ignore -->
```css
a {
  font-family: "Times New Roman";
}
```

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-5.0.7 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-5.0.6 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-5.0.5 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-5.0.4 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-5.0.3 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-5.0.2 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-5.0.1 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-4.3.5 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-5.0.0 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-4.3.4 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-4.3.3 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-4.3.2 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-4.3.1 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-4.3 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-4.2.3 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-4.2.2 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-4.2.1 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-4.2 node_modules/stylelint/lib/rules/string-no-newline/README.md
trusty-cms-4.1.9 node_modules/stylelint/lib/rules/string-no-newline/README.md