Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
Internal: js-file - add es6/module to escope options
Browse files Browse the repository at this point in the history
Fixes #1875
  • Loading branch information
hzoo committed Oct 17, 2015
1 parent da81cd6 commit 63526b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/js-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,10 @@ JsFile.prototype = {
*/
getScope: function() {
if (!this._scope) {
this._scope = escope.analyze(this._tree);
this._scope = escope.analyze(this._tree, {
ecmaVersion: 6,
sourceType: 'module'

This comment has been minimized.

Copy link
@markelog

markelog Oct 20, 2015

Member

nice

});
}

return this._scope;
Expand Down
6 changes: 6 additions & 0 deletions test/specs/rules/disallow-unused-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ describe('rules/disallow-unused-params', function() {
)).to.have.no.errors();
});

it('should not error with es6 imports #1875', function() {
expect(checker.checkString(
'import one from "one"; function some() {}'
)).to.have.no.errors();
});

it('should report unused param', function() {
expect(checker.checkString(
'function fun(test) { }'
Expand Down

0 comments on commit 63526b7

Please sign in to comment.