Skip to content

Commit

Permalink
fix #660?
Browse files Browse the repository at this point in the history
  • Loading branch information
benmosher committed Nov 14, 2016
1 parent 4faf721 commit bfdc2bb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).

## [Unreleased]
### Fixed
- attempt to fix crash in [`no-mutable-exports`]. ([#660])


## [2.2.0] - 2016-11-07
Expand Down Expand Up @@ -424,6 +426,7 @@ for info on changes for earlier releases.
[#157]: https://github.com/benmosher/eslint-plugin-import/pull/157
[#314]: https://github.com/benmosher/eslint-plugin-import/pull/314

[#660]: https://github.com/benmosher/eslint-plugin-import/issues/660
[#653]: https://github.com/benmosher/eslint-plugin-import/issues/653
[#609]: https://github.com/benmosher/eslint-plugin-import/issues/609
[#604]: https://github.com/benmosher/eslint-plugin-import/issues/604
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-mutable-exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
for (let variable of variables) {
if (variable.name === name) {
for (let def of variable.defs) {
if (def.type === 'Variable') {
if (def.type === 'Variable' && def.parent) {
checkDeclaration(def.parent)
}
}
Expand Down
10 changes: 10 additions & 0 deletions tests/src/rules/no-mutable-exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,15 @@ ruleTester.run('no-mutable-exports', rule, {
code: 'var count = 1\nexport default count',
errors: ['Exporting mutable \'var\' binding, use \'const\' instead.'],
}),

// todo: undeclared globals
// test({
// code: 'count = 1\nexport { count }',
// errors: ['Exporting mutable global binding, use \'const\' instead.'],
// }),
// test({
// code: 'count = 1\nexport default count',
// errors: ['Exporting mutable global binding, use \'const\' instead.'],
// }),
],
})

1 comment on commit bfdc2bb

@hazeledmands
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that this fixes #660 (and #758) with a test: see PR #835 :)

Please sign in to comment.