yanglint BUGFIX added restriction for LYB printing
diff --git a/tools/lint/cmd_data.c b/tools/lint/cmd_data.c
index 8e068fe..75b4760 100644
--- a/tools/lint/cmd_data.c
+++ b/tools/lint/cmd_data.c
@@ -372,6 +372,11 @@
         goto cleanup;
     }
 
+    if (!out && (outformat == LYD_LYB)) {
+        YLMSG_E("The LYB format requires the -o option specified.\n");
+        goto cleanup;
+    }
+
     /* process input data files provided as standalone command line arguments */
     for (int i = 0; i < argc - optind; i++) {
         struct ly_in *in;
diff --git a/tools/lint/main_ni.c b/tools/lint/main_ni.c
index c2d5c56..22456b0 100644
--- a/tools/lint/main_ni.c
+++ b/tools/lint/main_ni.c
@@ -927,6 +927,10 @@
         YLMSG_W("--tree-line-length take effect only in case of the tree output format.\n");
     }
 
+    if (!c->out && (c->data_out_format == LYD_LYB)) {
+        YLMSG_E("The LYB format requires the -o option specified.\n");
+        return -1;
+    }
     /* default output stream */
     if (!c->out) {
         if (ly_out_new_file(stdout, &c->out)) {
diff --git a/tools/lint/tests/interactive/data_format.test b/tools/lint/tests/interactive/data_format.test
index 56a93f6..dc4b7e0 100644
--- a/tools/lint/tests/interactive/data_format.test
+++ b/tools/lint/tests/interactive/data_format.test
@@ -14,4 +14,10 @@
     ly_cmd "data -f json $ddir/modleaf.xml" "{\r\n  \"modleaf:lfl\": 7\r\n}"
 }}
 
+test data_format_lyb_err {Print data in lyb format} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+    ly_cmd "load modleaf"
+    ly_cmd_err "data -f lyb $ddir/modleaf.xml" "The LYB format requires the -o"
+}}
+
 cleanupTests
diff --git a/tools/lint/tests/non-interactive/format.test b/tools/lint/tests/non-interactive/format.test
index 601acfc..8df5544 100644
--- a/tools/lint/tests/non-interactive/format.test
+++ b/tools/lint/tests/non-interactive/format.test
@@ -36,6 +36,10 @@
     ly_cmd "-f json $mdir/modleaf.yang $ddir/modleaf.xml" "{\n  \"modleaf:lfl\": 7\n}"
 } {}
 
+test format_data_lyb_err {Printing in LYB format: expect error due to missing parameter} {
+    ly_cmd_err "-f lyb $mdir/modleaf.yang $ddir/modleaf.xml" "The LYB format requires the -o"
+} {}
+
 test format_tree_submodule {Print submodule in tree format} {
     ly_cmd "-s modsub -f tree $mdir/modinclude.yang" "submodule: modsub"
 } {}