-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[[FIX]] Improve reporting of "Bad assignment."
When an assignment expression has an invalid left-hand side, JSHint previously issued error E013 ("Bad assignment."), bailed out of assignment interpretation and instead interpreted the left-hand side as an ExpressionStatement. In issuing E013, JSHint interprets the invalid JavaScript as an assignment expression. Failing to parse the invalid target as the left-hand side of the expression is inconsistent with this interpretation. The inconsistency commonly triggers inappropriate (and potentially confusing) errors such as "Missing semicolon," and "Expected an assignment or function call and instead saw an expression." Instead, JSHint should warn about the faulty assignment but continue parsing as though the expression were a valid assignment target. Doing so avoids emitting those errors that suggest that the left-hand side were written as an ExpressionStatement. 1. Interpret faulty assignment targets as the left-hand side of assignment expressions in all cases, issuing error E013 and moving on 2. Remove inappropriate errors from affected unit tests (noting that the underlying "Bad assignment." error remains unchanged)
- Loading branch information
1 parent
7311bdd
commit 08df19e
Showing
2 changed files
with
15 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters