Repository: jshint/jshint
Pull request #3461 (2020-04-04 12:39:47)

docs: Fix simple typo, overriden -> overridden
There is a small typo in tests/cli.js, tests/regression/libs/backbone.js.

Should read `overridden` rather than `overriden`.



coveralls: 
[![Coverage Status](https://coveralls.io/builds/29843828/badge)](https://coveralls.io/builds/29843828)

Coverage remained the same at 100.0% when pulling **b428701ebfbea067de94635bf6e7d3a675fc33f7 on timgates42:bugfix_typo_overridden** into **b23f046ff563986c5862324067bad401b24fc34c on jshint:master**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/29843828/badge)](https://coveralls.io/builds/29843828)

Coverage remained the same at 100.0% when pulling **b428701ebfbea067de94635bf6e7d3a675fc33f7 on timgates42:bugfix_typo_overridden** into **b23f046ff563986c5862324067bad401b24fc34c on jshint:master**.

jugglinmike: Thanks for the patch! We can forgo the CLA because this contribution is non-substantive.

There's one change I'd like to remove from this patch. `backbone.js` is a third-party library which we've included in this project for the purposes of regression testing. While the modification undeniably corrects a typo, it's not code we maintain here, so I'd rather not make any modifications to it. Can you revert that change?

Patch:
diff --git a/README.md b/README.md
index fb4dbc74..268d81e9 100644
--- a/README.md
+++ b/README.md
@@ -62,16 +62,13 @@ Engineers from these companies and projects use JSHint:
 * [Wikipedia](https://wikipedia.org/)
 * [Facebook](https://facebook.com/)
 * [Twitter](https://twitter.com/)
-* [Bootstrap](http://getbootstrap.com/)
 * [Disqus](https://disqus.com/)
 * [Medium](https://medium.com/)
 * [Yahoo!](https://yahoo.com/)
 * [SmugMug](http://smugmug.com/)
-* [jQuery](http://jquery.com/)
-* [PDF.js](http://mozilla.github.io/pdf.js)
+* [jQuery UI](https://jqueryui.com/) ([Source](https://github.com/jquery/jquery-ui/blob/master/package.json))
+* [jQuery Mobile](https://jquerymobile.com/) ([Source](https://github.com/jquery/jquery-mobile/blob/master/package.json#))
 * [Coursera](http://coursera.com/)
-* [Adobe Brackets](http://brackets.io/)
-* [Apache Cordova](http://cordova.io/)
 * [RedHat](http://redhat.com/)
 * [SoundCloud](http://soundcloud.com/)
 * [Nodejitsu](http://nodejitsu.com/)
@@ -82,7 +79,6 @@ Engineers from these companies and projects use JSHint:
 * [Cloud9](http://c9.io/)
 * [CodeClimate](https://codeclimate.com/)
 * [Zendesk](http://zendesk.com/)
-* [Apache CouchDB](http://couchdb.apache.org/)
 * [Google](https://www.google.com/)
 * [Codacy](https://www.codacy.com) [ref](https://support.codacy.com/hc/en-us/articles/207995005-Special-Thanks)
 * [Spotify](https://www.spotify.com)
diff --git a/src/jshint.js b/src/jshint.js
index 66193ba2..8e235b0b 100644
--- a/src/jshint.js
+++ b/src/jshint.js
@@ -5219,7 +5219,7 @@ var JSHINT = (function() {
       }
       nolinebreak(state.tokens.curr);
       advance(";");
-      if (decl) {
+      if (decl && decl.first && decl.first[0]) {
         if (decl.value === "const"  && !decl.hasInitializer) {
           warning("E012", decl, decl.first[0].value);
         }


Test patch:
diff --git a/tests/cli.js b/tests/cli.js
index 7930c417..8273f1c1 100644
--- a/tests/cli.js
+++ b/tests/cli.js
@@ -299,7 +299,7 @@ exports.group = {
     ]);
     test.ok(rep.reporter.args[0][0].length === 0);
 
-    // Test overriden, failed file
+    // Test overridden, failed file
     cli.interpret([
       "node", "jshint", "bar.js", "--config", "config.json", "--reporter", "reporter.js"
     ]);
@@ -344,7 +344,7 @@ exports.group = {
     ]);
     test.ok(rep.reporter.args[0][0].length === 0);
 
-    // Test overriden, failed file
+    // Test overridden, failed file
     cli.interpret([
       "node", "jshint", "src/bar.js", "--config", "config.json", "--reporter", "reporter.js"
     ]);
@@ -389,7 +389,7 @@ exports.group = {
     ]);
     test.ok(rep.reporter.args[0][0].length === 0);
 
-    // Test overriden, failed file
+    // Test overridden, failed file
     cli.interpret([
       "node", "jshint", "./src/bar.js", "--config", "config.json", "--reporter", "reporter.js"
     ]);
@@ -1515,7 +1515,7 @@ exports.useStdin = {
       test.done();
     },
 
-    // Test overriden, failed file
+    // Test overridden, failed file
     failure: function(test) {
       cli.interpret([
         "node", "jshint", "--filename", "bar.js", "--config", "config.json", "--reporter", "reporter.js", "-"
@@ -1570,7 +1570,7 @@ exports.useStdin = {
       test.done();
     },
 
-    // Test overriden, failed file
+    // Test overridden, failed file
     failure: function(test) {
       cli.interpret([
         "node", "jshint", "--filename", "src/bar.js", "--config", "config.json", "--reporter", "reporter.js", "-"
@@ -1625,7 +1625,7 @@ exports.useStdin = {
       test.done();
     },
 
-    // Test overriden, failed file
+    // Test overridden, failed file
     failure: function(test) {
       cli.interpret([
         "node", "jshint", "--filename", "./src/bar.js", "--config", "config.json", "--reporter", "reporter.js", "-"
diff --git a/tests/unit/core.js b/tests/unit/core.js
index ba126e69..a02be031 100644
--- a/tests/unit/core.js
+++ b/tests/unit/core.js
@@ -2352,6 +2352,20 @@ exports.initializeCStyle = function(test) {
   test.done();
 };
 
+// regression test for gh-3455
+exports.constWithoutVar = function(test) {
+  TestRun(test)
+    .addError(1, 11, "Expected an identifier and instead saw ';'.")
+    .addError(1, 12, "Expected an identifier and instead saw ')'.")
+    .addError(1, 12, "Expected ';' and instead saw ''.")
+    .addError(1, 12, "Unrecoverable syntax error. (100% scanned).")
+    .test([
+      "for (const;)"
+    ], { esversion: 6 });
+
+  test.done();
+};
+
 exports.constWithoutInit = function(test) {
   TestRun(test, "single binding")
     .addError(1, 6, "const 'x' is initialized to 'undefined'.")