.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / rules / max-line-length / README.md
1 # max-line-length
2
3 Limit the length of a line.
4
5 ```css
6 a { color: red }
7 /**            ↑
8  *       The end */
9 ```
10
11 Lines that exceed the maximum length but contain no whitespace (other than at the beginning of the line) are ignored.
12
13 When evaluating the line length, the arguments of any `url(...)` functions are excluded from the calculation, because typically you have no control over the length of these arguments. This means that long `url()` functions should not contribute to violations.
14
15 ## Options
16
17 `int`: Maximum number of characters allowed.
18
19 For example, with `20`:
20
21 The following patterns are considered violations:
22
23 ```css
24 a { color: 0; top: 0; }
25 ```
26
27 ```css
28 a {
29   background: linear-gradient(red, blue);
30 }
31 ```
32
33 The following patterns are *not* considered violations:
34
35 ```css
36 a {
37   color: 0;
38   top: 0;
39 }
40 ```
41
42 ```css
43 a {
44   background: url(a-url-that-is-over-20-characters-long);
45 }
46 ```
47
48 ## Optional secondary options
49
50 ### `ignore: ["non-comments"]`
51
52 Only enforce the line-length limit for lines within comments.
53
54 This does not apply to comments that are stuck in between other stuff, only to lines that begin at the beginning or in the middle of a comment.
55
56 For example, with a maximum length of `30`.
57
58 The following patterns are considered violations:
59
60 Each have only one violation.
61
62 ```css
63 /* This line is too long for my rule */
64 a { color: pink; background: orange; }
65 a { color: pink; /* this comment is also long but not on its own line */ }
66 ```
67
68 ```css
69 a { color: pink; background: orange; }
70 /**
71  * This line is short,
72  * but this line is too long for my liking,
73  * though this one is fine
74  */
75 a { color: pink; /* this comment is also long but not on its own line */ }
76 ```
77
78 ### `ignore: ["comments"]`
79
80 Only enforce the line-length limit for lines that are not comments.
81
82 This also applies to comments that are between code on the same line.
83
84 For example, with a maximum length of `30`.
85
86 The following patterns are considered violations:
87
88 ```css
89 a { color: pink; } /* comment that is too long */
90 ```
91
92 ```css
93 a { /* this comment is too long for the max length */ }
94 ```
95
96 The following patterns are *not* considered violations:
97
98 ```css
99 /* comment that is too long for my rule*/
100 a { color: pink; }
101 ```
102
103 ```css
104 /*
105  * comment that is too long the max length
106  * comment that is too long the max length
107  *
108  */
109 a { color: pink; }
110 ```
111
112 ### `ignorePattern: "/regex/"`
113
114 Ignore any line that matches the given regex pattern, regardless of whether it is comment or not.
115
116 Given:
117
118 ```js
119 "/^@import\\s+/"
120 ```
121
122 The following pattern is *not* considered a violation:
123
124 ```css
125 @import "../../../../another/css/or/scss/file/or/something.css";
126 ```
127
128 Given the following, with a maximum length of `20`.
129
130 ```js
131 ["/https?:\/\/[0-9,a-z]*.*/"]
132 ```
133
134 The following pattern is *not* considered a violation:
135
136 ```css
137 /* ignore urls https://www.example.com */
138 ```