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

Commit 31b0085

Browse files
corbinuJamesHenry
authored andcommitted
Chore: Remove es6-map and es6-weakmap as they are included in node4 (#10) (#13)
1 parent 12a1ca1 commit 31b0085

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+162
-5723
lines changed

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ npm-debug.log
22
.DS_Store
33
.vimrc.local
44
t.js
5-
esprima.js
65
.travis.yml
76
.npmignore
87
/tmp/

Makefile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const NODE = "node",
4141
// Files
4242
MAKEFILE = "./Makefile.js",
4343
JS_FILES = "src/**/*.js",
44-
TEST_FILES = "test/**/*.js";
44+
TEST_FILES = "test/*.js";
4545

4646
//------------------------------------------------------------------------------
4747
// Tasks

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ Example:
1414

1515
```js
1616
var eslintScope = require('eslint-scope');
17-
var esprima = require('esprima');
17+
var espree = require('espree');
1818
var estraverse = require('estraverse');
1919

20-
var ast = esprima.parse(code);
20+
var ast = espree.parse(code);
2121
var scopeManager = eslintScope.analyze(ast);
2222

2323
var currentScope = scopeManager.acquire(ast); // global scope
2424

2525
estraverse.traverse(ast, {
2626
enter: function(node, parent) {
2727
// do stuff
28-
28+
2929
if (/Function/.test(node.type)) {
3030
currentScope = scopeManager.acquire(node); // get current function scope
3131
}
@@ -34,7 +34,7 @@ estraverse.traverse(ast, {
3434
if (/Function/.test(node.type)) {
3535
currentScope = currentScope.upper; // set to parent scope
3636
}
37-
37+
3838
// do stuff
3939
}
4040
});

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"eslint-config-eslint": "^3.0.0",
3232
"eslint-release": "^0.10.1",
3333
"espree": "^3.1.1",
34-
"esprima": "^2.7.1",
3534
"istanbul": "^0.4.5",
3635
"mocha": "^3.2.0",
3736
"npm-license": "^0.3.3",

src/definition.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ class Definition {
3535
*/
3636
this.type = type;
3737
/**
38-
* @member {esprima.Identifier} Definition#name - the identifier AST node of the occurrence.
38+
* @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence.
3939
*/
4040
this.name = name;
4141
/**
42-
* @member {esprima.Node} Definition#node - the enclosing node of the identifier.
42+
* @member {espree.Node} Definition#node - the enclosing node of the identifier.
4343
*/
4444
this.node = node;
4545
/**
46-
* @member {esprima.Node?} Definition#parent - the enclosing statement node of the identifier.
46+
* @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier.
4747
*/
4848
this.parent = parent;
4949
/**

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* <em>escope</em> works on a syntax tree of the parsed source code which has
4040
* to adhere to the <a
4141
* href="https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API">
42-
* Mozilla Parser API</a>. E.g. <a href="http://esprima.org">esprima</a> is a parser
42+
* Mozilla Parser API</a>. E.g. <a href="https://github.com/eslint/espree">espree</a> is a parser
4343
* that produces such syntax trees.
4444
* <p>
4545
* The main interface is the {@link analyze} function.
@@ -111,10 +111,10 @@ function updateDeeply(target, override) {
111111
}
112112

113113
/**
114-
* Main interface function. Takes an Esprima syntax tree and returns the
114+
* Main interface function. Takes an Espree syntax tree and returns the
115115
* analyzed scopes.
116116
* @function analyze
117-
* @param {esprima.Tree} tree - Abstract Syntax Tree
117+
* @param {espree.Tree} tree - Abstract Syntax Tree
118118
* @param {Object} providedOptions - Options that tailor the scope analysis
119119
* @param {boolean} [providedOptions.optimistic=false] - the optimistic flag
120120
* @param {boolean} [providedOptions.directive=false]- the directive flag

src/pattern-visitor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class PatternVisitor extends esrecurse.Visitor {
114114
// ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression.
115115
// By spec, LeftHandSideExpression is Pattern or MemberExpression.
116116
// (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758)
117-
// But espree 2.0 and esprima 2.0 parse to ArrayExpression, ObjectExpression, etc...
117+
// But espree 2.0 parses to ArrayExpression, ObjectExpression, etc...
118118
//
119119

120120
SpreadElement(node) {

src/reference.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Reference {
3535
constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) {
3636
/**
3737
* Identifier syntax node.
38-
* @member {esprima#Identifier} Reference#identifier
38+
* @member {espreeIdentifier} Reference#identifier
3939
*/
4040
this.identifier = ident;
4141
/**
@@ -64,7 +64,7 @@ class Reference {
6464
if (this.isWrite()) {
6565
/**
6666
* If reference is writeable, this is the tree being written to it.
67-
* @member {esprima#Node} Reference#writeExpr
67+
* @member {espreeNode} Reference#writeExpr
6868
*/
6969
this.writeExpr = writeExpr;
7070
/**

src/scope-manager.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class ScopeManager {
9393
* If the node declares nothing, this method returns an empty array.
9494
* CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details.
9595
*
96-
* @param {Esprima.Node} node - a node to get.
96+
* @param {Espree.Node} node - a node to get.
9797
* @returns {Variable[]} variables that declared by the node.
9898
*/
9999
getDeclaredVariables(node) {
@@ -103,7 +103,7 @@ class ScopeManager {
103103
/**
104104
* acquire scope from node.
105105
* @method ScopeManager#acquire
106-
* @param {Esprima.Node} node - node for the acquired scope.
106+
* @param {Espree.Node} node - node for the acquired scope.
107107
* @param {boolean=} inner - look up the most inner scope, default value is false.
108108
* @returns {Scope?} Scope from node
109109
*/
@@ -158,7 +158,7 @@ class ScopeManager {
158158
/**
159159
* acquire all scopes from node.
160160
* @method ScopeManager#acquireAll
161-
* @param {Esprima.Node} node - node for the acquired scope.
161+
* @param {Espree.Node} node - node for the acquired scope.
162162
* @returns {Scopes?} Scope array
163163
*/
164164
acquireAll(node) {
@@ -168,7 +168,7 @@ class ScopeManager {
168168
/**
169169
* release the node.
170170
* @method ScopeManager#release
171-
* @param {Esprima.Node} node - releasing node.
171+
* @param {Espree.Node} node - releasing node.
172172
* @param {boolean=} inner - look up the most inner scope, default value is false.
173173
* @returns {Scope?} upper scope for the node.
174174
*/

src/scope.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class Scope {
182182
this.dynamic = this.type === "global" || this.type === "with";
183183
/**
184184
* A reference to the scope-defining syntax node.
185-
* @member {esprima.Node} Scope#block
185+
* @member {espree.Node} Scope#block
186186
*/
187187
this.block = block;
188188
/**
@@ -428,7 +428,7 @@ class Scope {
428428
/**
429429
* returns resolved {Reference}
430430
* @method Scope#resolve
431-
* @param {Esprima.Identifier} ident - identifier to be resolved.
431+
* @param {Espree.Identifier} ident - identifier to be resolved.
432432
* @returns {Reference} reference
433433
*/
434434
resolve(ident) {

src/variable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Variable {
3838
/**
3939
* List of defining occurrences of this variable (like in 'var ...'
4040
* statements or as parameter), as AST nodes.
41-
* @member {esprima.Identifier[]} Variable#identifiers
41+
* @member {espree.Identifier[]} Variable#identifiers
4242
*/
4343
this.identifiers = [];
4444
/**

test/arguments.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
/* eslint-disable no-unused-expressions */
2626

2727
const expect = require("chai").expect;
28-
const esprima = require("esprima");
28+
const espree = require("./util/espree");
2929
const analyze = require("..").analyze;
3030

3131
describe("arguments", function() {
3232
it("arguments are correctly materialized", function() {
33-
const ast = esprima.parse(`
33+
const ast = espree(`
3434
(function () {
3535
arguments;
3636
}());

test/catch-scope.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
/* eslint-disable no-unused-expressions */
2626

2727
const expect = require("chai").expect;
28-
const esprima = require("esprima");
28+
const espree = require("./util/espree");
2929
const analyze = require("..").analyze;
3030

3131
describe("catch", function() {
3232
it("creates scope", function() {
33-
const ast = esprima.parse(`
33+
const ast = espree(`
3434
(function () {
3535
try {
3636
} catch (e) {

test/child-visitor-keys.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
"use strict";
2424

2525
const expect = require("chai").expect;
26-
const esprima = require("esprima");
26+
const espree = require("./util/espree");
2727
const analyze = require("..").analyze;
2828

2929
describe("childVisitorKeys option", function() {
3030
it("should handle as a known node if the childVisitorKeys option was given.", function() {
31-
const ast = esprima.parse(`
31+
const ast = espree(`
3232
var foo = 0;
3333
`);
3434

@@ -47,7 +47,7 @@ describe("childVisitorKeys option", function() {
4747
});
4848

4949
it("should not visit to properties which are not given.", function() {
50-
const ast = esprima.parse(`
50+
const ast = espree(`
5151
let foo = bar;
5252
`);
5353

@@ -73,7 +73,7 @@ describe("childVisitorKeys option", function() {
7373
});
7474

7575
it("should visit to given properties.", function() {
76-
const ast = esprima.parse(`
76+
const ast = espree(`
7777
let foo = bar;
7878
`);
7979

test/es6-arrow-function-expression.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
/* eslint-disable no-unused-expressions */
2626

2727
const expect = require("chai").expect;
28-
const parse = require("../third_party/esprima").parse;
28+
const espree = require("./util/espree");
2929
const analyze = require("..").analyze;
3030

3131
describe("ES6 arrow function expression", function() {
3232
it("materialize scope for arrow function expression", function() {
33-
const ast = parse(`
33+
const ast = espree(`
3434
var arrow = () => {
3535
let i = 0;
3636
var j = 20;
@@ -58,7 +58,7 @@ describe("ES6 arrow function expression", function() {
5858
});
5959

6060
it("generate bindings for parameters", function() {
61-
const ast = parse("var arrow = (a, b, c, d) => {}");
61+
const ast = espree("var arrow = (a, b, c, d) => {}");
6262

6363
const scopeManager = analyze(ast, {ecmaVersion: 6});
6464
expect(scopeManager.scopes).to.have.length(2);

test/es6-block-scope.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
/* eslint-disable no-unused-expressions */
2626

2727
const expect = require("chai").expect;
28-
const parse = require("../third_party/esprima").parse;
28+
const espree = require("./util/espree");
2929
const analyze = require("..").analyze;
3030

3131
describe("ES6 block scope", function() {
3232
it("let is materialized in ES6 block scope#1", function() {
33-
const ast = parse(`
33+
const ast = espree(`
3434
{
3535
let i = 20;
3636
i;
@@ -54,7 +54,7 @@ describe("ES6 block scope", function() {
5454
});
5555

5656
it("let is materialized in ES6 block scope#2", function() {
57-
const ast = parse(`
57+
const ast = espree(`
5858
{
5959
let i = 20;
6060
var i = 20;
@@ -81,7 +81,7 @@ describe("ES6 block scope", function() {
8181
});
8282

8383
it("function delaration is materialized in ES6 block scope", function() {
84-
const ast = parse(`
84+
const ast = espree(`
8585
{
8686
function test() {
8787
}
@@ -111,7 +111,7 @@ describe("ES6 block scope", function() {
111111
});
112112

113113
it("let is not hoistable#1", function() {
114-
const ast = parse(`
114+
const ast = espree(`
115115
var i = 42; (1)
116116
{
117117
i; // (2) ReferenceError at runtime.
@@ -140,7 +140,7 @@ describe("ES6 block scope", function() {
140140
});
141141

142142
it("let is not hoistable#2", function() {
143-
const ast = parse(`
143+
const ast = espree(`
144144
(function () {
145145
var i = 42; // (1)
146146
i; // (1)

test/es6-catch.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
/* eslint-disable no-unused-expressions */
2626

2727
const expect = require("chai").expect;
28-
const parse = require("../third_party/esprima").parse;
28+
const espree = require("./util/espree");
2929
const analyze = require("..").analyze;
3030

3131
describe("ES6 catch", function() {
3232
it("takes binding pattern", function() {
33-
const ast = parse(`
33+
const ast = espree(`
3434
try {
3535
} catch ({ a, b, c, d }) {
3636
let e = 20;
@@ -64,15 +64,12 @@ describe("ES6 catch", function() {
6464
expect(scope.block.type).to.be.equal("CatchClause");
6565
expect(scope.isStrict).to.be.false;
6666

67-
// FIXME After Esprima's bug is fixed, I'll add tests #33
68-
// https://github.com/estools/escope/issues/33#issuecomment-64135832
69-
//
70-
// expect(scope.variables).to.have.length(4);
71-
// expect(scope.variables[0].name).to.be.equal('a');
72-
// expect(scope.variables[1].name).to.be.equal('b');
73-
// expect(scope.variables[2].name).to.be.equal('c');
74-
// expect(scope.variables[3].name).to.be.equal('d');
75-
// expect(scope.references).to.have.length(0);
67+
expect(scope.variables).to.have.length(4);
68+
expect(scope.variables[0].name).to.be.equal("a");
69+
expect(scope.variables[1].name).to.be.equal("b");
70+
expect(scope.variables[2].name).to.be.equal("c");
71+
expect(scope.variables[3].name).to.be.equal("d");
72+
expect(scope.references).to.have.length(0);
7673

7774
scope = scopeManager.scopes[3];
7875
expect(scope.type).to.be.equal("block");

0 commit comments

Comments
 (0)