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

Commit 63526b7

Browse files
committed
Internal: js-file - add es6/module to escope options
Fixes #1875
1 parent da81cd6 commit 63526b7

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/js-file.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,10 @@ JsFile.prototype = {
754754
*/
755755
getScope: function() {
756756
if (!this._scope) {
757-
this._scope = escope.analyze(this._tree);
757+
this._scope = escope.analyze(this._tree, {
758+
ecmaVersion: 6,
759+
sourceType: 'module'
760+
});
758761
}
759762

760763
return this._scope;

test/specs/rules/disallow-unused-params.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ describe('rules/disallow-unused-params', function() {
2323
)).to.have.no.errors();
2424
});
2525

26+
it('should not error with es6 imports #1875', function() {
27+
expect(checker.checkString(
28+
'import one from "one"; function some() {}'
29+
)).to.have.no.errors();
30+
});
31+
2632
it('should report unused param', function() {
2733
expect(checker.checkString(
2834
'function fun(test) { }'

0 commit comments

Comments
 (0)