1 # Enforce location of semicolons (semi-style)
3 Generally, semicolons are at the end of lines. However, in semicolon-less style, semicolons are at the beginning of lines. This rule enforces that semicolons are at the configured location.
7 This rule reports line terminators around semicolons.
9 This rule has an option.
13 "semi-style": ["error", "last"],
17 - `"last"` (Default) enforces that semicolons are at the end of statements.
18 - `"first"` enforces that semicolons are at the beginning of statements. Semicolons of `for` loop heads (`for(a;b;c){}`) should be at the end of lines even if you use this option.
20 Examples of **incorrect** code for this rule with `"last"` option:
23 /*eslint semi-style: ["error", "last"]*/
26 ;[1, 2, 3].forEach(bar)
37 Examples of **correct** code for this rule with `"last"` option:
40 /*eslint semi-style: ["error", "last"]*/
43 [1, 2, 3].forEach(bar)
54 Examples of **incorrect** code for this rule with `"first"` option:
57 /*eslint semi-style: ["error", "first"]*/
60 [1, 2, 3].forEach(bar)
71 Examples of **correct** code for this rule with `"first"` option:
74 /*eslint semi-style: ["error", "first"]*/
77 ;[1, 2, 3].forEach(bar)
90 If you don't want to notify the location of semicolons, then it's safe to disable this rule.
94 - [no-extra-semi](./no-extra-semi.md)
96 - [semi-spacing](./semi-spacing.md)