]> git.proxmox.com Git - pve-eslint.git/blame - eslint/docs/src/rules/no-multi-str.md
import 8.41.0 source
[pve-eslint.git] / eslint / docs / src / rules / no-multi-str.md
CommitLineData
8f9d1d4d
DC
1---
2title: no-multi-str
8f9d1d4d
DC
3rule_type: suggestion
4---
5
eb39fafa
DC
6
7It's possible to create multiline strings in JavaScript by using a slash before a newline, such as:
8
9```js
10var x = "Line 1 \
11 Line 2";
12```
13
14Some consider this to be a bad practice as it was an undocumented feature of JavaScript that was only formalized later.
15
16## Rule Details
17
18This rule is aimed at preventing the use of multiline strings.
19
20Examples of **incorrect** code for this rule:
21
8f9d1d4d
DC
22::: incorrect
23
eb39fafa
DC
24```js
25/*eslint no-multi-str: "error"*/
456be15e
TL
26
27var x = "some very \
28long text";
eb39fafa
DC
29```
30
8f9d1d4d
DC
31:::
32
eb39fafa
DC
33Examples of **correct** code for this rule:
34
8f9d1d4d
DC
35::: correct
36
eb39fafa
DC
37```js
38/*eslint no-multi-str: "error"*/
39
456be15e
TL
40var x = "some very long text";
41
42var x = "some very " +
43 "long text";
eb39fafa 44```
8f9d1d4d
DC
45
46:::