Skip to content

Commit

Permalink
[[FIX]] The __iterator__ property is deprecated.
Browse files Browse the repository at this point in the history
It should be used `Symbol.iterator`.
Now JSHint throws W103 instead of W104.
  • Loading branch information
nicolo-ribaudo authored and lukeapage committed Jun 21, 2015
1 parent 1749ac0 commit 7780613
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ exports.register = function(linter) {
});

// Check for properties named __iterator__. This is a special property
// available only in browsers with JavaScript 1.7 implementation.
// available only in browsers with JavaScript 1.7 implementation, but
// it is deprecated for ES6

linter.on("Identifier", function style_scanIterator(data) {
if (linter.getOption("iterator")) {
return;
}

if (data.name === "__iterator__") {
linter.warn("W104", {
linter.warn("W103", {
line: data.line,
char: data.char,
data: [ data.name ]
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ exports.testProtoAndIterator = function (test) {
.addError(7, "The '__proto__' property is deprecated.")
.addError(8, "The '__proto__' property is deprecated.")
.addError(10, "The '__proto__' property is deprecated.")
.addError(27, "'__iterator__' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
.addError(27, "The '__iterator__' property is deprecated.")
.addError(33, "The '__proto__' property is deprecated.")
.addError(37, "The '__proto__' property is deprecated.")
.test(source, {es3: true});
Expand Down

0 comments on commit 7780613

Please sign in to comment.