]> git.proxmox.com Git - pve-eslint.git/blobdiff - eslint/docs/rules/semi.md
import 8.3.0 source
[pve-eslint.git] / eslint / docs / rules / semi.md
index 049ae41cf16e1ada7093fa2a092012667e8c324c..cb8e6dd0dabd4dd54efb383ad9073d3aa260e3cd 100644 (file)
@@ -76,6 +76,8 @@ Object option (when `"never"`):
 * `"beforeStatementContinuationChars": "always"` requires semicolons at the end of statements if the next line starts with `[`, `(`, `/`, `+`, or `-`.
 * `"beforeStatementContinuationChars": "never"` disallows semicolons as the end of statements if it doesn't make ASI hazard even if the next line starts with `[`, `(`, `/`, `+`, or `-`.
 
+**Note:** `beforeStatementContinuationChars` does not apply to class fields because class fields are not statements.
+
 ### always
 
 Examples of **incorrect** code for this rule with the default `"always"` option:
@@ -88,6 +90,10 @@ var name = "ESLint"
 object.method = function() {
     // ...
 }
+
+class Foo {
+    bar = 1
+}
 ```
 
 Examples of **correct** code for this rule with the default `"always"` option:
@@ -100,6 +106,10 @@ var name = "ESLint";
 object.method = function() {
     // ...
 };
+
+class Foo {
+    bar = 1;
+}
 ```
 
 ### never
@@ -114,6 +124,10 @@ var name = "ESLint";
 object.method = function() {
     // ...
 };
+
+class Foo {
+    bar = 1;
+}
 ```
 
 Examples of **correct** code for this rule with the `"never"` option:
@@ -142,6 +156,10 @@ import b from "b"
 ;(function() {
     // ...
 })()
+
+class Foo {
+    bar = 1
+}
 ```
 
 #### omitLastInOneLineBlock
@@ -154,6 +172,14 @@ Examples of additional **correct** code for this rule with the `"always", { "omi
 if (foo) { bar() }
 
 if (foo) { bar(); baz() }
+
+function f() { bar(); baz() }
+
+class C {
+    foo() { bar(); baz() }
+
+    static { bar(); baz() }
+}
 ```
 
 #### beforeStatementContinuationChars