Skip to content

Commit

Permalink
remove for-of syntax from rules/export
Browse files Browse the repository at this point in the history
  • Loading branch information
benmosher committed Jul 7, 2016
1 parent 5dd3d70 commit dc3e852
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel

## [Unreleased]
### Fixed
- pinned `es6-symbol` dependency to `^3.1.0` instead of `*` 😳 ([#415])
- removing `Symbol` dependencies (i.e. `for-of` loops) due to Node 0.10 polyfill
issue (see [#415]). Should not make any discernible semantic difference.

## [1.10.2] - 2016-07-04
### Fixed
Expand Down
21 changes: 10 additions & 11 deletions src/rules/export.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'es6-symbol/implement'
import Map from 'es6-map'
import Set from 'es6-set'

Expand Down Expand Up @@ -32,11 +31,11 @@ module.exports = function (context) {
addNamed(node.declaration.id.name, node.declaration.id)
}

if (node.declaration.declarations != null) {
for (let declaration of node.declaration.declarations) {
recursivePatternCapture(declaration.id, v => addNamed(v.name, v))
}
}
if (node.declaration.declarations == null) return

node.declaration.declarations.forEach(declaration => {
recursivePatternCapture(declaration.id, v => addNamed(v.name, v))
})
},

'ExportAllDeclaration': function (node) {
Expand All @@ -62,15 +61,15 @@ module.exports = function (context) {
},

'Program:exit': function () {
for (let [name, nodes] of named) {
if (nodes.size <= 1) continue
named.forEach((nodes, name) => {
if (nodes.size <= 1) return

for (let node of nodes) {
nodes.forEach(node => {
if (name === 'default') {
context.report(node, 'Multiple default exports.')
} else context.report(node, `Multiple exports of name '${name}'.`)
}
}
})
})
},
}
}

0 comments on commit dc3e852

Please sign in to comment.