]> git.proxmox.com Git - pve-eslint.git/blob - eslint/docs/src/rules/no-multi-str.md
import 8.41.0 source
[pve-eslint.git] / eslint / docs / src / rules / no-multi-str.md
1 ---
2 title: no-multi-str
3 rule_type: suggestion
4 ---
5
6
7 It's possible to create multiline strings in JavaScript by using a slash before a newline, such as:
8
9 ```js
10 var x = "Line 1 \
11 Line 2";
12 ```
13
14 Some 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
18 This rule is aimed at preventing the use of multiline strings.
19
20 Examples of **incorrect** code for this rule:
21
22 ::: incorrect
23
24 ```js
25 /*eslint no-multi-str: "error"*/
26
27 var x = "some very \
28 long text";
29 ```
30
31 :::
32
33 Examples of **correct** code for this rule:
34
35 ::: correct
36
37 ```js
38 /*eslint no-multi-str: "error"*/
39
40 var x = "some very long text";
41
42 var x = "some very " +
43 "long text";
44 ```
45
46 :::