]>
git.proxmox.com Git - pve-eslint.git/blob - eslint/tests/lib/rules/semi-style.js
2 * @fileoverview Tests for semi-style rule.
3 * @author Toru Nagashima
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
12 const rule
= require("../../../lib/rules/semi-style"),
13 { RuleTester
} = require("../../../lib/rule-tester");
15 //------------------------------------------------------------------------------
17 //------------------------------------------------------------------------------
19 const ruleTester
= new RuleTester();
21 ruleTester
.run("semi-style", rule
, {
28 "for((a\n);\n(b\n);\n(c));",
30 { code
: ";", options
: ["last"] },
31 { code
: ";foo;bar;baz;", options
: ["last"] },
32 { code
: "foo;\nbar;", options
: ["last"] },
33 { code
: "for(a;b;c);", options
: ["last"] },
34 { code
: "for(a;\nb;\nc);", options
: ["last"] },
35 { code
: "for((a\n);\n(b\n);\n(c));", options
: ["last"] },
36 { code
: "if(a)foo;\nbar", options
: ["last"] },
37 { code
: ";", options
: ["first"] },
38 { code
: ";foo;bar;baz;", options
: ["first"] },
39 { code
: "foo\n;bar;", options
: ["first"] },
40 { code
: "for(a;b;c);", options
: ["first"] },
41 { code
: "for(a;\nb;\nc);", options
: ["first"] },
42 { code
: "for((a\n);\n(b\n);\n(c));", options
: ["first"] },
133 messageId
: "expectedSemiColon",
135 pos
: "the end of the previous line"
140 code
: "if(a)foo\n;bar",
141 output
: "if(a)foo;\nbar",
143 messageId
: "expectedSemiColon",
145 pos
: "the end of the previous line"
150 code
: "var foo\n;bar",
151 output
: "var foo;\nbar",
153 messageId
: "expectedSemiColon",
155 pos
: "the end of the previous line"
163 messageId
: "expectedSemiColon",
165 pos
: "the end of the previous line"
170 code
: "for(a\n;b;c)d",
171 output
: "for(a;\nb;c)d",
173 messageId
: "expectedSemiColon",
175 pos
: "the end of the previous line"
180 code
: "for(a;b\n;c)d",
181 output
: "for(a;b;\nc)d",
183 messageId
: "expectedSemiColon",
185 pos
: "the end of the previous line"
190 code
: "do;while(a)\n;b",
191 output
: "do;while(a);\nb",
193 messageId
: "expectedSemiColon",
195 pos
: "the end of the previous line"
205 messageId
: "expectedSemiColon",
207 pos
: "the end of the previous line"
212 code
: "if(a)foo\n;bar",
213 output
: "if(a)foo;\nbar",
216 messageId
: "expectedSemiColon",
218 pos
: "the end of the previous line"
223 code
: "var foo\n;bar",
224 output
: "var foo;\nbar",
227 messageId
: "expectedSemiColon",
229 pos
: "the end of the previous line"
238 messageId
: "expectedSemiColon",
240 pos
: "the end of the previous line"
245 code
: "for(a\n;b;c)d",
246 output
: "for(a;\nb;c)d",
249 messageId
: "expectedSemiColon",
251 pos
: "the end of the previous line"
256 code
: "for(a;b\n;c)d",
257 output
: "for(a;b;\nc)d",
260 messageId
: "expectedSemiColon",
262 pos
: "the end of the previous line"
271 messageId
: "expectedSemiColon",
273 pos
: "the end of the previous line"
283 messageId
: "expectedSemiColon",
285 pos
: "the beginning of the next line"
290 code
: "if(a)foo;\nbar",
291 output
: "if(a)foo\n;bar",
294 messageId
: "expectedSemiColon",
296 pos
: "the beginning of the next line"
301 code
: "var foo;\nbar",
302 output
: "var foo\n;bar",
305 messageId
: "expectedSemiColon",
307 pos
: "the beginning of the next line"
316 messageId
: "expectedSemiColon",
318 pos
: "the beginning of the next line"
323 code
: "for(a\n;b;c)d",
324 output
: "for(a;\nb;c)d",
327 messageId
: "expectedSemiColon",
329 pos
: "the end of the previous line"
334 code
: "for(a;b\n;c)d",
335 output
: "for(a;b;\nc)d",
338 messageId
: "expectedSemiColon",
340 pos
: "the end of the previous line"
346 code
: "foo\n;/**/bar",
349 messageId
: "expectedSemiColon",
351 pos
: "the end of the previous line"
356 code
: "foo\n/**/;bar",
359 messageId
: "expectedSemiColon",
361 pos
: "the end of the previous line"
367 code
: "foo;\n/**/bar",
371 messageId
: "expectedSemiColon",
373 pos
: "the beginning of the next line"
378 code
: "foo/**/;\nbar",
382 messageId
: "expectedSemiColon",
384 pos
: "the beginning of the next line"