Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[[FEAT]] Implement new option
futurehostile
A recent change to JSHint included the ECMAScript 6 global identifiers in JSHint's collection of "predefined" variables. This disallowed the definition of those global values even in contexts that did not implement them. The intent of this change was to help users avoid bugs when migrating to the new version of the language. Re-using an existing warning mechanism caused confusion among many users [1][2][3] for two reasons: 1. The generated warning messages were somewhat misleading (i.e. the warning "Redefinition of 'Promise'." is inaccurate in ES5 environments) 2. The method of disabling the warnings did not accurately communicate the intent of the developer (i.e. setting `predef: -Promise` does not prompt the user to consider the user to consider if creating their own global variable named `Promise` is appropriate) A dedicated warning message more clearly describes the best practice that motivates this particular constraint on global variable names. An explicit option makes it less likely that users will disable this warning without understanding the motivation. Intoduce a new option, `futurehostile`, and dedicated warning message to better communicate the intent of restricting usage of future-reserved identifiers. [1] GH-1747 redefinition of Promise (W079) [2] GH-1995 ES6 globals are activated even though esnext=false [3] GH-2171 Remove Set from the ECMAScript5 reserved words
- Loading branch information
1 parent
69b3187
commit da52aa0
Showing
6 changed files
with
164 additions
and
53 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
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
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
da52aa0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jugglinmike very nice work, thank you