branch: master
commit 38aa66bec00d8d4703da97d8a59ac4c669417545
Author: Carl Lei <[email protected]>
Commit: Carl Lei <[email protected]>

    Do not print trailing semicolon for export function and class
---
 js2-mode.el     |    4 +++-
 tests/parser.el |    6 ++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/js2-mode.el b/js2-mode.el
index bf7219a..2e5b210 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -2551,7 +2551,9 @@ so many of its properties will be nil.
       (js2-print-from-clause from))
      (exports-list
       (js2-print-named-imports exports-list)))
-    (unless (and default (not (js2-assign-node-p default)))
+    (unless (or (and default (not (js2-assign-node-p default)))
+                (and declaration (or (js2-function-node-p declaration)
+                                     (js2-class-node-p declaration))))
       (insert ";\n"))))
 
 (cl-defstruct (js2-while-node
diff --git a/tests/parser.el b/tests/parser.el
index 79481c8..198e578 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -799,6 +799,12 @@ the test."
 (js2-deftest-parse parse-export-generator-declaration "export default 
function* one() {\n}")
 (js2-deftest-parse parse-export-assignment-expression "export default a = b;")
 
+(js2-deftest-parse parse-export-function-declaration-no-semi
+  "export function f() {\n}")
+
+(js2-deftest-parse parse-export-class-declaration-no-semi
+  "export class C {\n}")
+
 ;;; Strings
 
 (js2-deftest-parse string-literal

Reply via email to