Bump the npm group with 2 updates (#1819)
* Bump the npm group with 2 updates Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import). Updates `eslint` from 8.45.0 to 8.46.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.45.0...v8.46.0) Updates `eslint-plugin-import` from 2.27.5 to 2.28.0 - [Release notes](https://github.com/import-js/eslint-plugin-import/releases) - [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md) - [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.27.5...v2.28.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: eslint-plugin-import dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
a6b0ced86b
commit
e7e35baaf0
1408 changed files with 27215 additions and 9910 deletions
22
node_modules/eslint/node_modules/eslint-scope/LICENSE
generated
vendored
22
node_modules/eslint/node_modules/eslint-scope/LICENSE
generated
vendored
|
|
@ -1,22 +0,0 @@
|
|||
Copyright JS Foundation and other contributors, https://js.foundation
|
||||
Copyright (C) 2012-2013 Yusuke Suzuki (twitter: @Constellation) and other contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
70
node_modules/eslint/node_modules/eslint-scope/README.md
generated
vendored
70
node_modules/eslint/node_modules/eslint-scope/README.md
generated
vendored
|
|
@ -1,70 +0,0 @@
|
|||
[](https://www.npmjs.com/package/eslint-scope)
|
||||
[](https://www.npmjs.com/package/eslint-scope)
|
||||
[](https://github.com/eslint/eslint-scope/actions)
|
||||
|
||||
# ESLint Scope
|
||||
|
||||
ESLint Scope is the [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) scope analyzer used in ESLint. It is a fork of [escope](http://github.com/estools/escope).
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm i eslint-scope --save
|
||||
```
|
||||
|
||||
## 📖 Usage
|
||||
|
||||
To use in an ESM file:
|
||||
|
||||
```js
|
||||
import * as eslintScope from 'eslint-scope';
|
||||
```
|
||||
|
||||
To use in a CommonJS file:
|
||||
|
||||
```js
|
||||
const eslintScope = require('eslint-scope');
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
import * as eslintScope from 'eslint-scope';
|
||||
import * as espree from 'espree';
|
||||
import estraverse from 'estraverse';
|
||||
|
||||
const ast = espree.parse(code, { range: true });
|
||||
const scopeManager = eslintScope.analyze(ast);
|
||||
|
||||
const currentScope = scopeManager.acquire(ast); // global scope
|
||||
|
||||
estraverse.traverse(ast, {
|
||||
enter (node, parent) {
|
||||
// do stuff
|
||||
|
||||
if (/Function/.test(node.type)) {
|
||||
currentScope = scopeManager.acquire(node); // get current function scope
|
||||
}
|
||||
},
|
||||
leave(node, parent) {
|
||||
if (/Function/.test(node.type)) {
|
||||
currentScope = currentScope.upper; // set to parent scope
|
||||
}
|
||||
|
||||
// do stuff
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/eslint-scope/issues).
|
||||
|
||||
## Build Commands
|
||||
|
||||
* `npm test` - run all linting and tests
|
||||
* `npm run lint` - run all linting
|
||||
|
||||
## License
|
||||
|
||||
ESLint Scope is licensed under a permissive BSD 2-clause license.
|
||||
2240
node_modules/eslint/node_modules/eslint-scope/dist/eslint-scope.cjs
generated
vendored
2240
node_modules/eslint/node_modules/eslint-scope/dist/eslint-scope.cjs
generated
vendored
File diff suppressed because it is too large
Load diff
85
node_modules/eslint/node_modules/eslint-scope/lib/definition.js
generated
vendored
85
node_modules/eslint/node_modules/eslint-scope/lib/definition.js
generated
vendored
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import Variable from "./variable.js";
|
||||
|
||||
/**
|
||||
* @constructor Definition
|
||||
*/
|
||||
class Definition {
|
||||
constructor(type, name, node, parent, index, kind) {
|
||||
|
||||
/**
|
||||
* @member {string} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...).
|
||||
*/
|
||||
this.type = type;
|
||||
|
||||
/**
|
||||
* @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence.
|
||||
*/
|
||||
this.name = name;
|
||||
|
||||
/**
|
||||
* @member {espree.Node} Definition#node - the enclosing node of the identifier.
|
||||
*/
|
||||
this.node = node;
|
||||
|
||||
/**
|
||||
* @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier.
|
||||
*/
|
||||
this.parent = parent;
|
||||
|
||||
/**
|
||||
* @member {number?} Definition#index - the index in the declaration statement.
|
||||
*/
|
||||
this.index = index;
|
||||
|
||||
/**
|
||||
* @member {string?} Definition#kind - the kind of the declaration statement.
|
||||
*/
|
||||
this.kind = kind;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor ParameterDefinition
|
||||
*/
|
||||
class ParameterDefinition extends Definition {
|
||||
constructor(name, node, index, rest) {
|
||||
super(Variable.Parameter, name, node, null, index, null);
|
||||
|
||||
/**
|
||||
* Whether the parameter definition is a part of a rest parameter.
|
||||
* @member {boolean} ParameterDefinition#rest
|
||||
*/
|
||||
this.rest = rest;
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
ParameterDefinition,
|
||||
Definition
|
||||
};
|
||||
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
172
node_modules/eslint/node_modules/eslint-scope/lib/index.js
generated
vendored
172
node_modules/eslint/node_modules/eslint-scope/lib/index.js
generated
vendored
|
|
@ -1,172 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2012-2014 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
Copyright (C) 2013 Alex Seville <hi@alexanderseville.com>
|
||||
Copyright (C) 2014 Thiago de Arruda <tpadilha84@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Escope (<a href="http://github.com/estools/escope">escope</a>) is an <a
|
||||
* href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript</a>
|
||||
* scope analyzer extracted from the <a
|
||||
* href="http://github.com/estools/esmangle">esmangle project</a/>.
|
||||
* <p>
|
||||
* <em>escope</em> finds lexical scopes in a source program, i.e. areas of that
|
||||
* program where different occurrences of the same identifier refer to the same
|
||||
* variable. With each scope the contained variables are collected, and each
|
||||
* identifier reference in code is linked to its corresponding variable (if
|
||||
* possible).
|
||||
* <p>
|
||||
* <em>escope</em> works on a syntax tree of the parsed source code which has
|
||||
* to adhere to the <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API">
|
||||
* Mozilla Parser API</a>. E.g. <a href="https://github.com/eslint/espree">espree</a> is a parser
|
||||
* that produces such syntax trees.
|
||||
* <p>
|
||||
* The main interface is the {@link analyze} function.
|
||||
* @module escope
|
||||
*/
|
||||
/* eslint no-underscore-dangle: ["error", { "allow": ["__currentScope"] }] */
|
||||
|
||||
import assert from "assert";
|
||||
|
||||
import ScopeManager from "./scope-manager.js";
|
||||
import Referencer from "./referencer.js";
|
||||
import Reference from "./reference.js";
|
||||
import Variable from "./variable.js";
|
||||
|
||||
import eslintScopeVersion from "./version.js";
|
||||
|
||||
/**
|
||||
* Set the default options
|
||||
* @returns {Object} options
|
||||
*/
|
||||
function defaultOptions() {
|
||||
return {
|
||||
optimistic: false,
|
||||
directive: false,
|
||||
nodejsScope: false,
|
||||
impliedStrict: false,
|
||||
sourceType: "script", // one of ['script', 'module', 'commonjs']
|
||||
ecmaVersion: 5,
|
||||
childVisitorKeys: null,
|
||||
fallback: "iteration"
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Preform deep update on option object
|
||||
* @param {Object} target Options
|
||||
* @param {Object} override Updates
|
||||
* @returns {Object} Updated options
|
||||
*/
|
||||
function updateDeeply(target, override) {
|
||||
|
||||
/**
|
||||
* Is hash object
|
||||
* @param {Object} value Test value
|
||||
* @returns {boolean} Result
|
||||
*/
|
||||
function isHashObject(value) {
|
||||
return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp);
|
||||
}
|
||||
|
||||
for (const key in override) {
|
||||
if (Object.prototype.hasOwnProperty.call(override, key)) {
|
||||
const val = override[key];
|
||||
|
||||
if (isHashObject(val)) {
|
||||
if (isHashObject(target[key])) {
|
||||
updateDeeply(target[key], val);
|
||||
} else {
|
||||
target[key] = updateDeeply({}, val);
|
||||
}
|
||||
} else {
|
||||
target[key] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main interface function. Takes an Espree syntax tree and returns the
|
||||
* analyzed scopes.
|
||||
* @function analyze
|
||||
* @param {espree.Tree} tree Abstract Syntax Tree
|
||||
* @param {Object} providedOptions Options that tailor the scope analysis
|
||||
* @param {boolean} [providedOptions.optimistic=false] the optimistic flag
|
||||
* @param {boolean} [providedOptions.directive=false] the directive flag
|
||||
* @param {boolean} [providedOptions.ignoreEval=false] whether to check 'eval()' calls
|
||||
* @param {boolean} [providedOptions.nodejsScope=false] whether the whole
|
||||
* script is executed under node.js environment. When enabled, escope adds
|
||||
* a function scope immediately following the global scope.
|
||||
* @param {boolean} [providedOptions.impliedStrict=false] implied strict mode
|
||||
* (if ecmaVersion >= 5).
|
||||
* @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script', 'module', and 'commonjs'
|
||||
* @param {number} [providedOptions.ecmaVersion=5] which ECMAScript version is considered
|
||||
* @param {Object} [providedOptions.childVisitorKeys=null] Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option.
|
||||
* @param {string} [providedOptions.fallback='iteration'] A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option.
|
||||
* @returns {ScopeManager} ScopeManager
|
||||
*/
|
||||
function analyze(tree, providedOptions) {
|
||||
const options = updateDeeply(defaultOptions(), providedOptions);
|
||||
const scopeManager = new ScopeManager(options);
|
||||
const referencer = new Referencer(options, scopeManager);
|
||||
|
||||
referencer.visit(tree);
|
||||
|
||||
assert(scopeManager.__currentScope === null, "currentScope should be null.");
|
||||
|
||||
return scopeManager;
|
||||
}
|
||||
|
||||
export {
|
||||
|
||||
/** @name module:escope.version */
|
||||
eslintScopeVersion as version,
|
||||
|
||||
/** @name module:escope.Reference */
|
||||
Reference,
|
||||
|
||||
/** @name module:escope.Variable */
|
||||
Variable,
|
||||
|
||||
/** @name module:escope.ScopeManager */
|
||||
ScopeManager,
|
||||
|
||||
/** @name module:escope.Referencer */
|
||||
Referencer,
|
||||
|
||||
analyze
|
||||
};
|
||||
|
||||
/** @name module:escope.Definition */
|
||||
export { Definition } from "./definition.js";
|
||||
|
||||
/** @name module:escope.PatternVisitor */
|
||||
export { default as PatternVisitor } from "./pattern-visitor.js";
|
||||
|
||||
/** @name module:escope.Scope */
|
||||
export { Scope } from "./scope.js";
|
||||
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
153
node_modules/eslint/node_modules/eslint-scope/lib/pattern-visitor.js
generated
vendored
153
node_modules/eslint/node_modules/eslint-scope/lib/pattern-visitor.js
generated
vendored
|
|
@ -1,153 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* eslint-disable no-undefined */
|
||||
|
||||
import estraverse from "estraverse";
|
||||
import esrecurse from "esrecurse";
|
||||
|
||||
const { Syntax } = estraverse;
|
||||
|
||||
/**
|
||||
* Get last array element
|
||||
* @param {Array} xs array
|
||||
* @returns {any} Last elment
|
||||
*/
|
||||
function getLast(xs) {
|
||||
return xs[xs.length - 1] || null;
|
||||
}
|
||||
|
||||
class PatternVisitor extends esrecurse.Visitor {
|
||||
static isPattern(node) {
|
||||
const nodeType = node.type;
|
||||
|
||||
return (
|
||||
nodeType === Syntax.Identifier ||
|
||||
nodeType === Syntax.ObjectPattern ||
|
||||
nodeType === Syntax.ArrayPattern ||
|
||||
nodeType === Syntax.SpreadElement ||
|
||||
nodeType === Syntax.RestElement ||
|
||||
nodeType === Syntax.AssignmentPattern
|
||||
);
|
||||
}
|
||||
|
||||
constructor(options, rootPattern, callback) {
|
||||
super(null, options);
|
||||
this.rootPattern = rootPattern;
|
||||
this.callback = callback;
|
||||
this.assignments = [];
|
||||
this.rightHandNodes = [];
|
||||
this.restElements = [];
|
||||
}
|
||||
|
||||
Identifier(pattern) {
|
||||
const lastRestElement = getLast(this.restElements);
|
||||
|
||||
this.callback(pattern, {
|
||||
topLevel: pattern === this.rootPattern,
|
||||
rest: lastRestElement !== null && lastRestElement !== undefined && lastRestElement.argument === pattern,
|
||||
assignments: this.assignments
|
||||
});
|
||||
}
|
||||
|
||||
Property(property) {
|
||||
|
||||
// Computed property's key is a right hand node.
|
||||
if (property.computed) {
|
||||
this.rightHandNodes.push(property.key);
|
||||
}
|
||||
|
||||
// If it's shorthand, its key is same as its value.
|
||||
// If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern).
|
||||
// If it's not shorthand, the name of new variable is its value's.
|
||||
this.visit(property.value);
|
||||
}
|
||||
|
||||
ArrayPattern(pattern) {
|
||||
for (let i = 0, iz = pattern.elements.length; i < iz; ++i) {
|
||||
const element = pattern.elements[i];
|
||||
|
||||
this.visit(element);
|
||||
}
|
||||
}
|
||||
|
||||
AssignmentPattern(pattern) {
|
||||
this.assignments.push(pattern);
|
||||
this.visit(pattern.left);
|
||||
this.rightHandNodes.push(pattern.right);
|
||||
this.assignments.pop();
|
||||
}
|
||||
|
||||
RestElement(pattern) {
|
||||
this.restElements.push(pattern);
|
||||
this.visit(pattern.argument);
|
||||
this.restElements.pop();
|
||||
}
|
||||
|
||||
MemberExpression(node) {
|
||||
|
||||
// Computed property's key is a right hand node.
|
||||
if (node.computed) {
|
||||
this.rightHandNodes.push(node.property);
|
||||
}
|
||||
|
||||
// the object is only read, write to its property.
|
||||
this.rightHandNodes.push(node.object);
|
||||
}
|
||||
|
||||
//
|
||||
// ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression.
|
||||
// By spec, LeftHandSideExpression is Pattern or MemberExpression.
|
||||
// (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758)
|
||||
// But espree 2.0 parses to ArrayExpression, ObjectExpression, etc...
|
||||
//
|
||||
|
||||
SpreadElement(node) {
|
||||
this.visit(node.argument);
|
||||
}
|
||||
|
||||
ArrayExpression(node) {
|
||||
node.elements.forEach(this.visit, this);
|
||||
}
|
||||
|
||||
AssignmentExpression(node) {
|
||||
this.assignments.push(node);
|
||||
this.visit(node.left);
|
||||
this.rightHandNodes.push(node.right);
|
||||
this.assignments.pop();
|
||||
}
|
||||
|
||||
CallExpression(node) {
|
||||
|
||||
// arguments are right hand nodes.
|
||||
node.arguments.forEach(a => {
|
||||
this.rightHandNodes.push(a);
|
||||
});
|
||||
this.visit(node.callee);
|
||||
}
|
||||
}
|
||||
|
||||
export default PatternVisitor;
|
||||
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
166
node_modules/eslint/node_modules/eslint-scope/lib/reference.js
generated
vendored
166
node_modules/eslint/node_modules/eslint-scope/lib/reference.js
generated
vendored
|
|
@ -1,166 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
const READ = 0x1;
|
||||
const WRITE = 0x2;
|
||||
const RW = READ | WRITE;
|
||||
|
||||
/**
|
||||
* A Reference represents a single occurrence of an identifier in code.
|
||||
* @constructor Reference
|
||||
*/
|
||||
class Reference {
|
||||
constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) {
|
||||
|
||||
/**
|
||||
* Identifier syntax node.
|
||||
* @member {espreeIdentifier} Reference#identifier
|
||||
*/
|
||||
this.identifier = ident;
|
||||
|
||||
/**
|
||||
* Reference to the enclosing Scope.
|
||||
* @member {Scope} Reference#from
|
||||
*/
|
||||
this.from = scope;
|
||||
|
||||
/**
|
||||
* Whether the reference comes from a dynamic scope (such as 'eval',
|
||||
* 'with', etc.), and may be trapped by dynamic scopes.
|
||||
* @member {boolean} Reference#tainted
|
||||
*/
|
||||
this.tainted = false;
|
||||
|
||||
/**
|
||||
* The variable this reference is resolved with.
|
||||
* @member {Variable} Reference#resolved
|
||||
*/
|
||||
this.resolved = null;
|
||||
|
||||
/**
|
||||
* The read-write mode of the reference. (Value is one of {@link
|
||||
* Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}).
|
||||
* @member {number} Reference#flag
|
||||
* @private
|
||||
*/
|
||||
this.flag = flag;
|
||||
if (this.isWrite()) {
|
||||
|
||||
/**
|
||||
* If reference is writeable, this is the tree being written to it.
|
||||
* @member {espreeNode} Reference#writeExpr
|
||||
*/
|
||||
this.writeExpr = writeExpr;
|
||||
|
||||
/**
|
||||
* Whether the Reference might refer to a partial value of writeExpr.
|
||||
* @member {boolean} Reference#partial
|
||||
*/
|
||||
this.partial = partial;
|
||||
|
||||
/**
|
||||
* Whether the Reference is to write of initialization.
|
||||
* @member {boolean} Reference#init
|
||||
*/
|
||||
this.init = init;
|
||||
}
|
||||
this.__maybeImplicitGlobal = maybeImplicitGlobal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the reference is static.
|
||||
* @function Reference#isStatic
|
||||
* @returns {boolean} static
|
||||
*/
|
||||
isStatic() {
|
||||
return !this.tainted && this.resolved && this.resolved.scope.isStatic();
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the reference is writeable.
|
||||
* @function Reference#isWrite
|
||||
* @returns {boolean} write
|
||||
*/
|
||||
isWrite() {
|
||||
return !!(this.flag & Reference.WRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the reference is readable.
|
||||
* @function Reference#isRead
|
||||
* @returns {boolean} read
|
||||
*/
|
||||
isRead() {
|
||||
return !!(this.flag & Reference.READ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the reference is read-only.
|
||||
* @function Reference#isReadOnly
|
||||
* @returns {boolean} read only
|
||||
*/
|
||||
isReadOnly() {
|
||||
return this.flag === Reference.READ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the reference is write-only.
|
||||
* @function Reference#isWriteOnly
|
||||
* @returns {boolean} write only
|
||||
*/
|
||||
isWriteOnly() {
|
||||
return this.flag === Reference.WRITE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the reference is read-write.
|
||||
* @function Reference#isReadWrite
|
||||
* @returns {boolean} read write
|
||||
*/
|
||||
isReadWrite() {
|
||||
return this.flag === Reference.RW;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @constant Reference.READ
|
||||
* @private
|
||||
*/
|
||||
Reference.READ = READ;
|
||||
|
||||
/**
|
||||
* @constant Reference.WRITE
|
||||
* @private
|
||||
*/
|
||||
Reference.WRITE = WRITE;
|
||||
|
||||
/**
|
||||
* @constant Reference.RW
|
||||
* @private
|
||||
*/
|
||||
Reference.RW = RW;
|
||||
|
||||
export default Reference;
|
||||
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
654
node_modules/eslint/node_modules/eslint-scope/lib/referencer.js
generated
vendored
654
node_modules/eslint/node_modules/eslint-scope/lib/referencer.js
generated
vendored
|
|
@ -1,654 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
/* eslint-disable no-undefined */
|
||||
|
||||
import estraverse from "estraverse";
|
||||
import esrecurse from "esrecurse";
|
||||
import Reference from "./reference.js";
|
||||
import Variable from "./variable.js";
|
||||
import PatternVisitor from "./pattern-visitor.js";
|
||||
import { Definition, ParameterDefinition } from "./definition.js";
|
||||
import assert from "assert";
|
||||
|
||||
const { Syntax } = estraverse;
|
||||
|
||||
/**
|
||||
* Traverse identifier in pattern
|
||||
* @param {Object} options options
|
||||
* @param {pattern} rootPattern root pattern
|
||||
* @param {Refencer} referencer referencer
|
||||
* @param {callback} callback callback
|
||||
* @returns {void}
|
||||
*/
|
||||
function traverseIdentifierInPattern(options, rootPattern, referencer, callback) {
|
||||
|
||||
// Call the callback at left hand identifier nodes, and Collect right hand nodes.
|
||||
const visitor = new PatternVisitor(options, rootPattern, callback);
|
||||
|
||||
visitor.visit(rootPattern);
|
||||
|
||||
// Process the right hand nodes recursively.
|
||||
if (referencer !== null && referencer !== undefined) {
|
||||
visitor.rightHandNodes.forEach(referencer.visit, referencer);
|
||||
}
|
||||
}
|
||||
|
||||
// Importing ImportDeclaration.
|
||||
// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation
|
||||
// https://github.com/estree/estree/blob/master/es6.md#importdeclaration
|
||||
// FIXME: Now, we don't create module environment, because the context is
|
||||
// implementation dependent.
|
||||
|
||||
class Importer extends esrecurse.Visitor {
|
||||
constructor(declaration, referencer) {
|
||||
super(null, referencer.options);
|
||||
this.declaration = declaration;
|
||||
this.referencer = referencer;
|
||||
}
|
||||
|
||||
visitImport(id, specifier) {
|
||||
this.referencer.visitPattern(id, pattern => {
|
||||
this.referencer.currentScope().__define(pattern,
|
||||
new Definition(
|
||||
Variable.ImportBinding,
|
||||
pattern,
|
||||
specifier,
|
||||
this.declaration,
|
||||
null,
|
||||
null
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
ImportNamespaceSpecifier(node) {
|
||||
const local = (node.local || node.id);
|
||||
|
||||
if (local) {
|
||||
this.visitImport(local, node);
|
||||
}
|
||||
}
|
||||
|
||||
ImportDefaultSpecifier(node) {
|
||||
const local = (node.local || node.id);
|
||||
|
||||
this.visitImport(local, node);
|
||||
}
|
||||
|
||||
ImportSpecifier(node) {
|
||||
const local = (node.local || node.id);
|
||||
|
||||
if (node.name) {
|
||||
this.visitImport(node.name, node);
|
||||
} else {
|
||||
this.visitImport(local, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Referencing variables and creating bindings.
|
||||
class Referencer extends esrecurse.Visitor {
|
||||
constructor(options, scopeManager) {
|
||||
super(null, options);
|
||||
this.options = options;
|
||||
this.scopeManager = scopeManager;
|
||||
this.parent = null;
|
||||
this.isInnerMethodDefinition = false;
|
||||
}
|
||||
|
||||
currentScope() {
|
||||
return this.scopeManager.__currentScope;
|
||||
}
|
||||
|
||||
close(node) {
|
||||
while (this.currentScope() && node === this.currentScope().block) {
|
||||
this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager);
|
||||
}
|
||||
}
|
||||
|
||||
pushInnerMethodDefinition(isInnerMethodDefinition) {
|
||||
const previous = this.isInnerMethodDefinition;
|
||||
|
||||
this.isInnerMethodDefinition = isInnerMethodDefinition;
|
||||
return previous;
|
||||
}
|
||||
|
||||
popInnerMethodDefinition(isInnerMethodDefinition) {
|
||||
this.isInnerMethodDefinition = isInnerMethodDefinition;
|
||||
}
|
||||
|
||||
referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) {
|
||||
const scope = this.currentScope();
|
||||
|
||||
assignments.forEach(assignment => {
|
||||
scope.__referencing(
|
||||
pattern,
|
||||
Reference.WRITE,
|
||||
assignment.right,
|
||||
maybeImplicitGlobal,
|
||||
pattern !== assignment.left,
|
||||
init
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
visitPattern(node, options, callback) {
|
||||
let visitPatternOptions = options;
|
||||
let visitPatternCallback = callback;
|
||||
|
||||
if (typeof options === "function") {
|
||||
visitPatternCallback = options;
|
||||
visitPatternOptions = { processRightHandNodes: false };
|
||||
}
|
||||
|
||||
traverseIdentifierInPattern(
|
||||
this.options,
|
||||
node,
|
||||
visitPatternOptions.processRightHandNodes ? this : null,
|
||||
visitPatternCallback
|
||||
);
|
||||
}
|
||||
|
||||
visitFunction(node) {
|
||||
let i, iz;
|
||||
|
||||
// FunctionDeclaration name is defined in upper scope
|
||||
// NOTE: Not referring variableScope. It is intended.
|
||||
// Since
|
||||
// in ES5, FunctionDeclaration should be in FunctionBody.
|
||||
// in ES6, FunctionDeclaration should be block scoped.
|
||||
|
||||
if (node.type === Syntax.FunctionDeclaration) {
|
||||
|
||||
// id is defined in upper scope
|
||||
this.currentScope().__define(node.id,
|
||||
new Definition(
|
||||
Variable.FunctionName,
|
||||
node.id,
|
||||
node,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
));
|
||||
}
|
||||
|
||||
// FunctionExpression with name creates its special scope;
|
||||
// FunctionExpressionNameScope.
|
||||
if (node.type === Syntax.FunctionExpression && node.id) {
|
||||
this.scopeManager.__nestFunctionExpressionNameScope(node);
|
||||
}
|
||||
|
||||
// Consider this function is in the MethodDefinition.
|
||||
this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition);
|
||||
|
||||
const that = this;
|
||||
|
||||
/**
|
||||
* Visit pattern callback
|
||||
* @param {pattern} pattern pattern
|
||||
* @param {Object} info info
|
||||
* @returns {void}
|
||||
*/
|
||||
function visitPatternCallback(pattern, info) {
|
||||
that.currentScope().__define(pattern,
|
||||
new ParameterDefinition(
|
||||
pattern,
|
||||
node,
|
||||
i,
|
||||
info.rest
|
||||
));
|
||||
|
||||
that.referencingDefaultValue(pattern, info.assignments, null, true);
|
||||
}
|
||||
|
||||
// Process parameter declarations.
|
||||
for (i = 0, iz = node.params.length; i < iz; ++i) {
|
||||
this.visitPattern(node.params[i], { processRightHandNodes: true }, visitPatternCallback);
|
||||
}
|
||||
|
||||
// if there's a rest argument, add that
|
||||
if (node.rest) {
|
||||
this.visitPattern({
|
||||
type: "RestElement",
|
||||
argument: node.rest
|
||||
}, pattern => {
|
||||
this.currentScope().__define(pattern,
|
||||
new ParameterDefinition(
|
||||
pattern,
|
||||
node,
|
||||
node.params.length,
|
||||
true
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
// In TypeScript there are a number of function-like constructs which have no body,
|
||||
// so check it exists before traversing
|
||||
if (node.body) {
|
||||
|
||||
// Skip BlockStatement to prevent creating BlockStatement scope.
|
||||
if (node.body.type === Syntax.BlockStatement) {
|
||||
this.visitChildren(node.body);
|
||||
} else {
|
||||
this.visit(node.body);
|
||||
}
|
||||
}
|
||||
|
||||
this.close(node);
|
||||
}
|
||||
|
||||
visitClass(node) {
|
||||
if (node.type === Syntax.ClassDeclaration) {
|
||||
this.currentScope().__define(node.id,
|
||||
new Definition(
|
||||
Variable.ClassName,
|
||||
node.id,
|
||||
node,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
));
|
||||
}
|
||||
|
||||
this.visit(node.superClass);
|
||||
|
||||
this.scopeManager.__nestClassScope(node);
|
||||
|
||||
if (node.id) {
|
||||
this.currentScope().__define(node.id,
|
||||
new Definition(
|
||||
Variable.ClassName,
|
||||
node.id,
|
||||
node
|
||||
));
|
||||
}
|
||||
this.visit(node.body);
|
||||
|
||||
this.close(node);
|
||||
}
|
||||
|
||||
visitProperty(node) {
|
||||
let previous;
|
||||
|
||||
if (node.computed) {
|
||||
this.visit(node.key);
|
||||
}
|
||||
|
||||
const isMethodDefinition = node.type === Syntax.MethodDefinition;
|
||||
|
||||
if (isMethodDefinition) {
|
||||
previous = this.pushInnerMethodDefinition(true);
|
||||
}
|
||||
this.visit(node.value);
|
||||
if (isMethodDefinition) {
|
||||
this.popInnerMethodDefinition(previous);
|
||||
}
|
||||
}
|
||||
|
||||
visitForIn(node) {
|
||||
if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== "var") {
|
||||
this.scopeManager.__nestForScope(node);
|
||||
}
|
||||
|
||||
if (node.left.type === Syntax.VariableDeclaration) {
|
||||
this.visit(node.left);
|
||||
this.visitPattern(node.left.declarations[0].id, pattern => {
|
||||
this.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true, true);
|
||||
});
|
||||
} else {
|
||||
this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => {
|
||||
let maybeImplicitGlobal = null;
|
||||
|
||||
if (!this.currentScope().isStrict) {
|
||||
maybeImplicitGlobal = {
|
||||
pattern,
|
||||
node
|
||||
};
|
||||
}
|
||||
this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false);
|
||||
this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true, false);
|
||||
});
|
||||
}
|
||||
this.visit(node.right);
|
||||
this.visit(node.body);
|
||||
|
||||
this.close(node);
|
||||
}
|
||||
|
||||
visitVariableDeclaration(variableTargetScope, type, node, index) {
|
||||
|
||||
const decl = node.declarations[index];
|
||||
const init = decl.init;
|
||||
|
||||
this.visitPattern(decl.id, { processRightHandNodes: true }, (pattern, info) => {
|
||||
variableTargetScope.__define(
|
||||
pattern,
|
||||
new Definition(
|
||||
type,
|
||||
pattern,
|
||||
decl,
|
||||
node,
|
||||
index,
|
||||
node.kind
|
||||
)
|
||||
);
|
||||
|
||||
this.referencingDefaultValue(pattern, info.assignments, null, true);
|
||||
if (init) {
|
||||
this.currentScope().__referencing(pattern, Reference.WRITE, init, null, !info.topLevel, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
AssignmentExpression(node) {
|
||||
if (PatternVisitor.isPattern(node.left)) {
|
||||
if (node.operator === "=") {
|
||||
this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => {
|
||||
let maybeImplicitGlobal = null;
|
||||
|
||||
if (!this.currentScope().isStrict) {
|
||||
maybeImplicitGlobal = {
|
||||
pattern,
|
||||
node
|
||||
};
|
||||
}
|
||||
this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false);
|
||||
this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false);
|
||||
});
|
||||
} else {
|
||||
this.currentScope().__referencing(node.left, Reference.RW, node.right);
|
||||
}
|
||||
} else {
|
||||
this.visit(node.left);
|
||||
}
|
||||
this.visit(node.right);
|
||||
}
|
||||
|
||||
CatchClause(node) {
|
||||
this.scopeManager.__nestCatchScope(node);
|
||||
|
||||
this.visitPattern(node.param, { processRightHandNodes: true }, (pattern, info) => {
|
||||
this.currentScope().__define(pattern,
|
||||
new Definition(
|
||||
Variable.CatchClause,
|
||||
node.param,
|
||||
node,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
));
|
||||
this.referencingDefaultValue(pattern, info.assignments, null, true);
|
||||
});
|
||||
this.visit(node.body);
|
||||
|
||||
this.close(node);
|
||||
}
|
||||
|
||||
Program(node) {
|
||||
this.scopeManager.__nestGlobalScope(node);
|
||||
|
||||
if (this.scopeManager.isGlobalReturn()) {
|
||||
|
||||
// Force strictness of GlobalScope to false when using node.js scope.
|
||||
this.currentScope().isStrict = false;
|
||||
this.scopeManager.__nestFunctionScope(node, false);
|
||||
}
|
||||
|
||||
if (this.scopeManager.__isES6() && this.scopeManager.isModule()) {
|
||||
this.scopeManager.__nestModuleScope(node);
|
||||
}
|
||||
|
||||
if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) {
|
||||
this.currentScope().isStrict = true;
|
||||
}
|
||||
|
||||
this.visitChildren(node);
|
||||
this.close(node);
|
||||
}
|
||||
|
||||
Identifier(node) {
|
||||
this.currentScope().__referencing(node);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
PrivateIdentifier() {
|
||||
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
UpdateExpression(node) {
|
||||
if (PatternVisitor.isPattern(node.argument)) {
|
||||
this.currentScope().__referencing(node.argument, Reference.RW, null);
|
||||
} else {
|
||||
this.visitChildren(node);
|
||||
}
|
||||
}
|
||||
|
||||
MemberExpression(node) {
|
||||
this.visit(node.object);
|
||||
if (node.computed) {
|
||||
this.visit(node.property);
|
||||
}
|
||||
}
|
||||
|
||||
Property(node) {
|
||||
this.visitProperty(node);
|
||||
}
|
||||
|
||||
PropertyDefinition(node) {
|
||||
const { computed, key, value } = node;
|
||||
|
||||
if (computed) {
|
||||
this.visit(key);
|
||||
}
|
||||
if (value) {
|
||||
this.scopeManager.__nestClassFieldInitializerScope(value);
|
||||
this.visit(value);
|
||||
this.close(value);
|
||||
}
|
||||
}
|
||||
|
||||
StaticBlock(node) {
|
||||
this.scopeManager.__nestClassStaticBlockScope(node);
|
||||
|
||||
this.visitChildren(node);
|
||||
|
||||
this.close(node);
|
||||
}
|
||||
|
||||
MethodDefinition(node) {
|
||||
this.visitProperty(node);
|
||||
}
|
||||
|
||||
BreakStatement() {} // eslint-disable-line class-methods-use-this
|
||||
|
||||
ContinueStatement() {} // eslint-disable-line class-methods-use-this
|
||||
|
||||
LabeledStatement(node) {
|
||||
this.visit(node.body);
|
||||
}
|
||||
|
||||
ForStatement(node) {
|
||||
|
||||
// Create ForStatement declaration.
|
||||
// NOTE: In ES6, ForStatement dynamically generates
|
||||
// per iteration environment. However, escope is
|
||||
// a static analyzer, we only generate one scope for ForStatement.
|
||||
if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== "var") {
|
||||
this.scopeManager.__nestForScope(node);
|
||||
}
|
||||
|
||||
this.visitChildren(node);
|
||||
|
||||
this.close(node);
|
||||
}
|
||||
|
||||
ClassExpression(node) {
|
||||
this.visitClass(node);
|
||||
}
|
||||
|
||||
ClassDeclaration(node) {
|
||||
this.visitClass(node);
|
||||
}
|
||||
|
||||
CallExpression(node) {
|
||||
|
||||
// Check this is direct call to eval
|
||||
if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") {
|
||||
|
||||
// NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and
|
||||
// let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment.
|
||||
this.currentScope().variableScope.__detectEval();
|
||||
}
|
||||
this.visitChildren(node);
|
||||
}
|
||||
|
||||
BlockStatement(node) {
|
||||
if (this.scopeManager.__isES6()) {
|
||||
this.scopeManager.__nestBlockScope(node);
|
||||
}
|
||||
|
||||
this.visitChildren(node);
|
||||
|
||||
this.close(node);
|
||||
}
|
||||
|
||||
ThisExpression() {
|
||||
this.currentScope().variableScope.__detectThis();
|
||||
}
|
||||
|
||||
WithStatement(node) {
|
||||
this.visit(node.object);
|
||||
|
||||
// Then nest scope for WithStatement.
|
||||
this.scopeManager.__nestWithScope(node);
|
||||
|
||||
this.visit(node.body);
|
||||
|
||||
this.close(node);
|
||||
}
|
||||
|
||||
VariableDeclaration(node) {
|
||||
const variableTargetScope = (node.kind === "var") ? this.currentScope().variableScope : this.currentScope();
|
||||
|
||||
for (let i = 0, iz = node.declarations.length; i < iz; ++i) {
|
||||
const decl = node.declarations[i];
|
||||
|
||||
this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i);
|
||||
if (decl.init) {
|
||||
this.visit(decl.init);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sec 13.11.8
|
||||
SwitchStatement(node) {
|
||||
this.visit(node.discriminant);
|
||||
|
||||
if (this.scopeManager.__isES6()) {
|
||||
this.scopeManager.__nestSwitchScope(node);
|
||||
}
|
||||
|
||||
for (let i = 0, iz = node.cases.length; i < iz; ++i) {
|
||||
this.visit(node.cases[i]);
|
||||
}
|
||||
|
||||
this.close(node);
|
||||
}
|
||||
|
||||
FunctionDeclaration(node) {
|
||||
this.visitFunction(node);
|
||||
}
|
||||
|
||||
FunctionExpression(node) {
|
||||
this.visitFunction(node);
|
||||
}
|
||||
|
||||
ForOfStatement(node) {
|
||||
this.visitForIn(node);
|
||||
}
|
||||
|
||||
ForInStatement(node) {
|
||||
this.visitForIn(node);
|
||||
}
|
||||
|
||||
ArrowFunctionExpression(node) {
|
||||
this.visitFunction(node);
|
||||
}
|
||||
|
||||
ImportDeclaration(node) {
|
||||
assert(this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context.");
|
||||
|
||||
const importer = new Importer(node, this);
|
||||
|
||||
importer.visit(node);
|
||||
}
|
||||
|
||||
visitExportDeclaration(node) {
|
||||
if (node.source) {
|
||||
return;
|
||||
}
|
||||
if (node.declaration) {
|
||||
this.visit(node.declaration);
|
||||
return;
|
||||
}
|
||||
|
||||
this.visitChildren(node);
|
||||
}
|
||||
|
||||
// TODO: ExportDeclaration doesn't exist. for bc?
|
||||
ExportDeclaration(node) {
|
||||
this.visitExportDeclaration(node);
|
||||
}
|
||||
|
||||
ExportAllDeclaration(node) {
|
||||
this.visitExportDeclaration(node);
|
||||
}
|
||||
|
||||
ExportDefaultDeclaration(node) {
|
||||
this.visitExportDeclaration(node);
|
||||
}
|
||||
|
||||
ExportNamedDeclaration(node) {
|
||||
this.visitExportDeclaration(node);
|
||||
}
|
||||
|
||||
ExportSpecifier(node) {
|
||||
|
||||
// TODO: `node.id` doesn't exist. for bc?
|
||||
const local = (node.id || node.local);
|
||||
|
||||
this.visit(local);
|
||||
}
|
||||
|
||||
MetaProperty() { // eslint-disable-line class-methods-use-this
|
||||
|
||||
// do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
export default Referencer;
|
||||
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
255
node_modules/eslint/node_modules/eslint-scope/lib/scope-manager.js
generated
vendored
255
node_modules/eslint/node_modules/eslint-scope/lib/scope-manager.js
generated
vendored
|
|
@ -1,255 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
|
||||
import {
|
||||
BlockScope,
|
||||
CatchScope,
|
||||
ClassFieldInitializerScope,
|
||||
ClassStaticBlockScope,
|
||||
ClassScope,
|
||||
ForScope,
|
||||
FunctionExpressionNameScope,
|
||||
FunctionScope,
|
||||
GlobalScope,
|
||||
ModuleScope,
|
||||
SwitchScope,
|
||||
WithScope
|
||||
} from "./scope.js";
|
||||
import assert from "assert";
|
||||
|
||||
/**
|
||||
* @constructor ScopeManager
|
||||
*/
|
||||
class ScopeManager {
|
||||
constructor(options) {
|
||||
this.scopes = [];
|
||||
this.globalScope = null;
|
||||
this.__nodeToScope = new WeakMap();
|
||||
this.__currentScope = null;
|
||||
this.__options = options;
|
||||
this.__declaredVariables = new WeakMap();
|
||||
}
|
||||
|
||||
__useDirective() {
|
||||
return this.__options.directive;
|
||||
}
|
||||
|
||||
__isOptimistic() {
|
||||
return this.__options.optimistic;
|
||||
}
|
||||
|
||||
__ignoreEval() {
|
||||
return this.__options.ignoreEval;
|
||||
}
|
||||
|
||||
isGlobalReturn() {
|
||||
return this.__options.nodejsScope || this.__options.sourceType === "commonjs";
|
||||
}
|
||||
|
||||
isModule() {
|
||||
return this.__options.sourceType === "module";
|
||||
}
|
||||
|
||||
isImpliedStrict() {
|
||||
return this.__options.impliedStrict;
|
||||
}
|
||||
|
||||
isStrictModeSupported() {
|
||||
return this.__options.ecmaVersion >= 5;
|
||||
}
|
||||
|
||||
// Returns appropriate scope for this node.
|
||||
__get(node) {
|
||||
return this.__nodeToScope.get(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get variables that are declared by the node.
|
||||
*
|
||||
* "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`.
|
||||
* If the node declares nothing, this method returns an empty array.
|
||||
* CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details.
|
||||
* @param {Espree.Node} node a node to get.
|
||||
* @returns {Variable[]} variables that declared by the node.
|
||||
*/
|
||||
getDeclaredVariables(node) {
|
||||
return this.__declaredVariables.get(node) || [];
|
||||
}
|
||||
|
||||
/**
|
||||
* acquire scope from node.
|
||||
* @function ScopeManager#acquire
|
||||
* @param {Espree.Node} node node for the acquired scope.
|
||||
* @param {?boolean} [inner=false] look up the most inner scope, default value is false.
|
||||
* @returns {Scope?} Scope from node
|
||||
*/
|
||||
acquire(node, inner) {
|
||||
|
||||
/**
|
||||
* predicate
|
||||
* @param {Scope} testScope scope to test
|
||||
* @returns {boolean} predicate
|
||||
*/
|
||||
function predicate(testScope) {
|
||||
if (testScope.type === "function" && testScope.functionExpressionScope) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const scopes = this.__get(node);
|
||||
|
||||
if (!scopes || scopes.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Heuristic selection from all scopes.
|
||||
// If you would like to get all scopes, please use ScopeManager#acquireAll.
|
||||
if (scopes.length === 1) {
|
||||
return scopes[0];
|
||||
}
|
||||
|
||||
if (inner) {
|
||||
for (let i = scopes.length - 1; i >= 0; --i) {
|
||||
const scope = scopes[i];
|
||||
|
||||
if (predicate(scope)) {
|
||||
return scope;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i = 0, iz = scopes.length; i < iz; ++i) {
|
||||
const scope = scopes[i];
|
||||
|
||||
if (predicate(scope)) {
|
||||
return scope;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* acquire all scopes from node.
|
||||
* @function ScopeManager#acquireAll
|
||||
* @param {Espree.Node} node node for the acquired scope.
|
||||
* @returns {Scopes?} Scope array
|
||||
*/
|
||||
acquireAll(node) {
|
||||
return this.__get(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* release the node.
|
||||
* @function ScopeManager#release
|
||||
* @param {Espree.Node} node releasing node.
|
||||
* @param {?boolean} [inner=false] look up the most inner scope, default value is false.
|
||||
* @returns {Scope?} upper scope for the node.
|
||||
*/
|
||||
release(node, inner) {
|
||||
const scopes = this.__get(node);
|
||||
|
||||
if (scopes && scopes.length) {
|
||||
const scope = scopes[0].upper;
|
||||
|
||||
if (!scope) {
|
||||
return null;
|
||||
}
|
||||
return this.acquire(scope.block, inner);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
attach() { } // eslint-disable-line class-methods-use-this
|
||||
|
||||
detach() { } // eslint-disable-line class-methods-use-this
|
||||
|
||||
__nestScope(scope) {
|
||||
if (scope instanceof GlobalScope) {
|
||||
assert(this.__currentScope === null);
|
||||
this.globalScope = scope;
|
||||
}
|
||||
this.__currentScope = scope;
|
||||
return scope;
|
||||
}
|
||||
|
||||
__nestGlobalScope(node) {
|
||||
return this.__nestScope(new GlobalScope(this, node));
|
||||
}
|
||||
|
||||
__nestBlockScope(node) {
|
||||
return this.__nestScope(new BlockScope(this, this.__currentScope, node));
|
||||
}
|
||||
|
||||
__nestFunctionScope(node, isMethodDefinition) {
|
||||
return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition));
|
||||
}
|
||||
|
||||
__nestForScope(node) {
|
||||
return this.__nestScope(new ForScope(this, this.__currentScope, node));
|
||||
}
|
||||
|
||||
__nestCatchScope(node) {
|
||||
return this.__nestScope(new CatchScope(this, this.__currentScope, node));
|
||||
}
|
||||
|
||||
__nestWithScope(node) {
|
||||
return this.__nestScope(new WithScope(this, this.__currentScope, node));
|
||||
}
|
||||
|
||||
__nestClassScope(node) {
|
||||
return this.__nestScope(new ClassScope(this, this.__currentScope, node));
|
||||
}
|
||||
|
||||
__nestClassFieldInitializerScope(node) {
|
||||
return this.__nestScope(new ClassFieldInitializerScope(this, this.__currentScope, node));
|
||||
}
|
||||
|
||||
__nestClassStaticBlockScope(node) {
|
||||
return this.__nestScope(new ClassStaticBlockScope(this, this.__currentScope, node));
|
||||
}
|
||||
|
||||
__nestSwitchScope(node) {
|
||||
return this.__nestScope(new SwitchScope(this, this.__currentScope, node));
|
||||
}
|
||||
|
||||
__nestModuleScope(node) {
|
||||
return this.__nestScope(new ModuleScope(this, this.__currentScope, node));
|
||||
}
|
||||
|
||||
__nestFunctionExpressionNameScope(node) {
|
||||
return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node));
|
||||
}
|
||||
|
||||
__isES6() {
|
||||
return this.__options.ecmaVersion >= 6;
|
||||
}
|
||||
}
|
||||
|
||||
export default ScopeManager;
|
||||
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
772
node_modules/eslint/node_modules/eslint-scope/lib/scope.js
generated
vendored
772
node_modules/eslint/node_modules/eslint-scope/lib/scope.js
generated
vendored
|
|
@ -1,772 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
/* eslint-disable no-undefined */
|
||||
|
||||
import estraverse from "estraverse";
|
||||
|
||||
import Reference from "./reference.js";
|
||||
import Variable from "./variable.js";
|
||||
import { Definition } from "./definition.js";
|
||||
import assert from "assert";
|
||||
|
||||
const { Syntax } = estraverse;
|
||||
|
||||
/**
|
||||
* Test if scope is struct
|
||||
* @param {Scope} scope scope
|
||||
* @param {Block} block block
|
||||
* @param {boolean} isMethodDefinition is method definition
|
||||
* @param {boolean} useDirective use directive
|
||||
* @returns {boolean} is strict scope
|
||||
*/
|
||||
function isStrictScope(scope, block, isMethodDefinition, useDirective) {
|
||||
let body;
|
||||
|
||||
// When upper scope is exists and strict, inner scope is also strict.
|
||||
if (scope.upper && scope.upper.isStrict) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isMethodDefinition) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (scope.type === "class" || scope.type === "module") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (scope.type === "block" || scope.type === "switch") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (scope.type === "function") {
|
||||
if (block.type === Syntax.ArrowFunctionExpression && block.body.type !== Syntax.BlockStatement) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (block.type === Syntax.Program) {
|
||||
body = block;
|
||||
} else {
|
||||
body = block.body;
|
||||
}
|
||||
|
||||
if (!body) {
|
||||
return false;
|
||||
}
|
||||
} else if (scope.type === "global") {
|
||||
body = block;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Search 'use strict' directive.
|
||||
if (useDirective) {
|
||||
for (let i = 0, iz = body.body.length; i < iz; ++i) {
|
||||
const stmt = body.body[i];
|
||||
|
||||
if (stmt.type !== Syntax.DirectiveStatement) {
|
||||
break;
|
||||
}
|
||||
if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i = 0, iz = body.body.length; i < iz; ++i) {
|
||||
const stmt = body.body[i];
|
||||
|
||||
if (stmt.type !== Syntax.ExpressionStatement) {
|
||||
break;
|
||||
}
|
||||
const expr = stmt.expression;
|
||||
|
||||
if (expr.type !== Syntax.Literal || typeof expr.value !== "string") {
|
||||
break;
|
||||
}
|
||||
if (expr.raw !== null && expr.raw !== undefined) {
|
||||
if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (expr.value === "use strict") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register scope
|
||||
* @param {ScopeManager} scopeManager scope manager
|
||||
* @param {Scope} scope scope
|
||||
* @returns {void}
|
||||
*/
|
||||
function registerScope(scopeManager, scope) {
|
||||
scopeManager.scopes.push(scope);
|
||||
|
||||
const scopes = scopeManager.__nodeToScope.get(scope.block);
|
||||
|
||||
if (scopes) {
|
||||
scopes.push(scope);
|
||||
} else {
|
||||
scopeManager.__nodeToScope.set(scope.block, [scope]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be statically
|
||||
* @param {Object} def def
|
||||
* @returns {boolean} should be statically
|
||||
*/
|
||||
function shouldBeStatically(def) {
|
||||
return (
|
||||
(def.type === Variable.ClassName) ||
|
||||
(def.type === Variable.Variable && def.parent.kind !== "var")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor Scope
|
||||
*/
|
||||
class Scope {
|
||||
constructor(scopeManager, type, upperScope, block, isMethodDefinition) {
|
||||
|
||||
/**
|
||||
* One of "global", "module", "function", "function-expression-name", "block", "switch", "catch", "with", "for",
|
||||
* "class", "class-field-initializer", "class-static-block".
|
||||
* @member {string} Scope#type
|
||||
*/
|
||||
this.type = type;
|
||||
|
||||
/**
|
||||
* The scoped {@link Variable}s of this scope, as <code>{ Variable.name
|
||||
* : Variable }</code>.
|
||||
* @member {Map} Scope#set
|
||||
*/
|
||||
this.set = new Map();
|
||||
|
||||
/**
|
||||
* The tainted variables of this scope, as <code>{ Variable.name :
|
||||
* boolean }</code>.
|
||||
* @member {Map} Scope#taints */
|
||||
this.taints = new Map();
|
||||
|
||||
/**
|
||||
* Generally, through the lexical scoping of JS you can always know
|
||||
* which variable an identifier in the source code refers to. There are
|
||||
* a few exceptions to this rule. With 'global' and 'with' scopes you
|
||||
* can only decide at runtime which variable a reference refers to.
|
||||
* Moreover, if 'eval()' is used in a scope, it might introduce new
|
||||
* bindings in this or its parent scopes.
|
||||
* All those scopes are considered 'dynamic'.
|
||||
* @member {boolean} Scope#dynamic
|
||||
*/
|
||||
this.dynamic = this.type === "global" || this.type === "with";
|
||||
|
||||
/**
|
||||
* A reference to the scope-defining syntax node.
|
||||
* @member {espree.Node} Scope#block
|
||||
*/
|
||||
this.block = block;
|
||||
|
||||
/**
|
||||
* The {@link Reference|references} that are not resolved with this scope.
|
||||
* @member {Reference[]} Scope#through
|
||||
*/
|
||||
this.through = [];
|
||||
|
||||
/**
|
||||
* The scoped {@link Variable}s of this scope. In the case of a
|
||||
* 'function' scope this includes the automatic argument <em>arguments</em> as
|
||||
* its first element, as well as all further formal arguments.
|
||||
* @member {Variable[]} Scope#variables
|
||||
*/
|
||||
this.variables = [];
|
||||
|
||||
/**
|
||||
* Any variable {@link Reference|reference} found in this scope. This
|
||||
* includes occurrences of local variables as well as variables from
|
||||
* parent scopes (including the global scope). For local variables
|
||||
* this also includes defining occurrences (like in a 'var' statement).
|
||||
* In a 'function' scope this does not include the occurrences of the
|
||||
* formal parameter in the parameter list.
|
||||
* @member {Reference[]} Scope#references
|
||||
*/
|
||||
this.references = [];
|
||||
|
||||
/**
|
||||
* For 'global' and 'function' scopes, this is a self-reference. For
|
||||
* other scope types this is the <em>variableScope</em> value of the
|
||||
* parent scope.
|
||||
* @member {Scope} Scope#variableScope
|
||||
*/
|
||||
this.variableScope =
|
||||
this.type === "global" ||
|
||||
this.type === "module" ||
|
||||
this.type === "function" ||
|
||||
this.type === "class-field-initializer" ||
|
||||
this.type === "class-static-block"
|
||||
? this
|
||||
: upperScope.variableScope;
|
||||
|
||||
/**
|
||||
* Whether this scope is created by a FunctionExpression.
|
||||
* @member {boolean} Scope#functionExpressionScope
|
||||
*/
|
||||
this.functionExpressionScope = false;
|
||||
|
||||
/**
|
||||
* Whether this is a scope that contains an 'eval()' invocation.
|
||||
* @member {boolean} Scope#directCallToEvalScope
|
||||
*/
|
||||
this.directCallToEvalScope = false;
|
||||
|
||||
/**
|
||||
* @member {boolean} Scope#thisFound
|
||||
*/
|
||||
this.thisFound = false;
|
||||
|
||||
this.__left = [];
|
||||
|
||||
/**
|
||||
* Reference to the parent {@link Scope|scope}.
|
||||
* @member {Scope} Scope#upper
|
||||
*/
|
||||
this.upper = upperScope;
|
||||
|
||||
/**
|
||||
* Whether 'use strict' is in effect in this scope.
|
||||
* @member {boolean} Scope#isStrict
|
||||
*/
|
||||
this.isStrict = scopeManager.isStrictModeSupported()
|
||||
? isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective())
|
||||
: false;
|
||||
|
||||
/**
|
||||
* List of nested {@link Scope}s.
|
||||
* @member {Scope[]} Scope#childScopes
|
||||
*/
|
||||
this.childScopes = [];
|
||||
if (this.upper) {
|
||||
this.upper.childScopes.push(this);
|
||||
}
|
||||
|
||||
this.__declaredVariables = scopeManager.__declaredVariables;
|
||||
|
||||
registerScope(scopeManager, this);
|
||||
}
|
||||
|
||||
__shouldStaticallyClose(scopeManager) {
|
||||
return (!this.dynamic || scopeManager.__isOptimistic());
|
||||
}
|
||||
|
||||
__shouldStaticallyCloseForGlobal(ref) {
|
||||
|
||||
// On global scope, let/const/class declarations should be resolved statically.
|
||||
const name = ref.identifier.name;
|
||||
|
||||
if (!this.set.has(name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const variable = this.set.get(name);
|
||||
const defs = variable.defs;
|
||||
|
||||
return defs.length > 0 && defs.every(shouldBeStatically);
|
||||
}
|
||||
|
||||
__staticCloseRef(ref) {
|
||||
if (!this.__resolve(ref)) {
|
||||
this.__delegateToUpperScope(ref);
|
||||
}
|
||||
}
|
||||
|
||||
__dynamicCloseRef(ref) {
|
||||
|
||||
// notify all names are through to global
|
||||
let current = this;
|
||||
|
||||
do {
|
||||
current.through.push(ref);
|
||||
current = current.upper;
|
||||
} while (current);
|
||||
}
|
||||
|
||||
__globalCloseRef(ref) {
|
||||
|
||||
// let/const/class declarations should be resolved statically.
|
||||
// others should be resolved dynamically.
|
||||
if (this.__shouldStaticallyCloseForGlobal(ref)) {
|
||||
this.__staticCloseRef(ref);
|
||||
} else {
|
||||
this.__dynamicCloseRef(ref);
|
||||
}
|
||||
}
|
||||
|
||||
__close(scopeManager) {
|
||||
let closeRef;
|
||||
|
||||
if (this.__shouldStaticallyClose(scopeManager)) {
|
||||
closeRef = this.__staticCloseRef;
|
||||
} else if (this.type !== "global") {
|
||||
closeRef = this.__dynamicCloseRef;
|
||||
} else {
|
||||
closeRef = this.__globalCloseRef;
|
||||
}
|
||||
|
||||
// Try Resolving all references in this scope.
|
||||
for (let i = 0, iz = this.__left.length; i < iz; ++i) {
|
||||
const ref = this.__left[i];
|
||||
|
||||
closeRef.call(this, ref);
|
||||
}
|
||||
this.__left = null;
|
||||
|
||||
return this.upper;
|
||||
}
|
||||
|
||||
// To override by function scopes.
|
||||
// References in default parameters isn't resolved to variables which are in their function body.
|
||||
__isValidResolution(ref, variable) { // eslint-disable-line class-methods-use-this, no-unused-vars
|
||||
return true;
|
||||
}
|
||||
|
||||
__resolve(ref) {
|
||||
const name = ref.identifier.name;
|
||||
|
||||
if (!this.set.has(name)) {
|
||||
return false;
|
||||
}
|
||||
const variable = this.set.get(name);
|
||||
|
||||
if (!this.__isValidResolution(ref, variable)) {
|
||||
return false;
|
||||
}
|
||||
variable.references.push(ref);
|
||||
variable.stack = variable.stack && ref.from.variableScope === this.variableScope;
|
||||
if (ref.tainted) {
|
||||
variable.tainted = true;
|
||||
this.taints.set(variable.name, true);
|
||||
}
|
||||
ref.resolved = variable;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
__delegateToUpperScope(ref) {
|
||||
if (this.upper) {
|
||||
this.upper.__left.push(ref);
|
||||
}
|
||||
this.through.push(ref);
|
||||
}
|
||||
|
||||
__addDeclaredVariablesOfNode(variable, node) {
|
||||
if (node === null || node === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
let variables = this.__declaredVariables.get(node);
|
||||
|
||||
if (variables === null || variables === undefined) {
|
||||
variables = [];
|
||||
this.__declaredVariables.set(node, variables);
|
||||
}
|
||||
if (variables.indexOf(variable) === -1) {
|
||||
variables.push(variable);
|
||||
}
|
||||
}
|
||||
|
||||
__defineGeneric(name, set, variables, node, def) {
|
||||
let variable;
|
||||
|
||||
variable = set.get(name);
|
||||
if (!variable) {
|
||||
variable = new Variable(name, this);
|
||||
set.set(name, variable);
|
||||
variables.push(variable);
|
||||
}
|
||||
|
||||
if (def) {
|
||||
variable.defs.push(def);
|
||||
this.__addDeclaredVariablesOfNode(variable, def.node);
|
||||
this.__addDeclaredVariablesOfNode(variable, def.parent);
|
||||
}
|
||||
if (node) {
|
||||
variable.identifiers.push(node);
|
||||
}
|
||||
}
|
||||
|
||||
__define(node, def) {
|
||||
if (node && node.type === Syntax.Identifier) {
|
||||
this.__defineGeneric(
|
||||
node.name,
|
||||
this.set,
|
||||
this.variables,
|
||||
node,
|
||||
def
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
__referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) {
|
||||
|
||||
// because Array element may be null
|
||||
if (!node || node.type !== Syntax.Identifier) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Specially handle like `this`.
|
||||
if (node.name === "super") {
|
||||
return;
|
||||
}
|
||||
|
||||
const ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init);
|
||||
|
||||
this.references.push(ref);
|
||||
this.__left.push(ref);
|
||||
}
|
||||
|
||||
__detectEval() {
|
||||
let current = this;
|
||||
|
||||
this.directCallToEvalScope = true;
|
||||
do {
|
||||
current.dynamic = true;
|
||||
current = current.upper;
|
||||
} while (current);
|
||||
}
|
||||
|
||||
__detectThis() {
|
||||
this.thisFound = true;
|
||||
}
|
||||
|
||||
__isClosed() {
|
||||
return this.__left === null;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns resolved {Reference}
|
||||
* @function Scope#resolve
|
||||
* @param {Espree.Identifier} ident identifier to be resolved.
|
||||
* @returns {Reference} reference
|
||||
*/
|
||||
resolve(ident) {
|
||||
let ref, i, iz;
|
||||
|
||||
assert(this.__isClosed(), "Scope should be closed.");
|
||||
assert(ident.type === Syntax.Identifier, "Target should be identifier.");
|
||||
for (i = 0, iz = this.references.length; i < iz; ++i) {
|
||||
ref = this.references[i];
|
||||
if (ref.identifier === ident) {
|
||||
return ref;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns this scope is static
|
||||
* @function Scope#isStatic
|
||||
* @returns {boolean} static
|
||||
*/
|
||||
isStatic() {
|
||||
return !this.dynamic;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns this scope has materialized arguments
|
||||
* @function Scope#isArgumentsMaterialized
|
||||
* @returns {boolean} arguemnts materialized
|
||||
*/
|
||||
isArgumentsMaterialized() { // eslint-disable-line class-methods-use-this
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns this scope has materialized `this` reference
|
||||
* @function Scope#isThisMaterialized
|
||||
* @returns {boolean} this materialized
|
||||
*/
|
||||
isThisMaterialized() { // eslint-disable-line class-methods-use-this
|
||||
return true;
|
||||
}
|
||||
|
||||
isUsedName(name) {
|
||||
if (this.set.has(name)) {
|
||||
return true;
|
||||
}
|
||||
for (let i = 0, iz = this.through.length; i < iz; ++i) {
|
||||
if (this.through[i].identifier.name === name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class GlobalScope extends Scope {
|
||||
constructor(scopeManager, block) {
|
||||
super(scopeManager, "global", null, block, false);
|
||||
this.implicit = {
|
||||
set: new Map(),
|
||||
variables: [],
|
||||
|
||||
/**
|
||||
* List of {@link Reference}s that are left to be resolved (i.e. which
|
||||
* need to be linked to the variable they refer to).
|
||||
* @member {Reference[]} Scope#implicit#left
|
||||
*/
|
||||
left: []
|
||||
};
|
||||
}
|
||||
|
||||
__close(scopeManager) {
|
||||
const implicit = [];
|
||||
|
||||
for (let i = 0, iz = this.__left.length; i < iz; ++i) {
|
||||
const ref = this.__left[i];
|
||||
|
||||
if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) {
|
||||
implicit.push(ref.__maybeImplicitGlobal);
|
||||
}
|
||||
}
|
||||
|
||||
// create an implicit global variable from assignment expression
|
||||
for (let i = 0, iz = implicit.length; i < iz; ++i) {
|
||||
const info = implicit[i];
|
||||
|
||||
this.__defineImplicit(info.pattern,
|
||||
new Definition(
|
||||
Variable.ImplicitGlobalVariable,
|
||||
info.pattern,
|
||||
info.node,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
this.implicit.left = this.__left;
|
||||
|
||||
return super.__close(scopeManager);
|
||||
}
|
||||
|
||||
__defineImplicit(node, def) {
|
||||
if (node && node.type === Syntax.Identifier) {
|
||||
this.__defineGeneric(
|
||||
node.name,
|
||||
this.implicit.set,
|
||||
this.implicit.variables,
|
||||
node,
|
||||
def
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleScope extends Scope {
|
||||
constructor(scopeManager, upperScope, block) {
|
||||
super(scopeManager, "module", upperScope, block, false);
|
||||
}
|
||||
}
|
||||
|
||||
class FunctionExpressionNameScope extends Scope {
|
||||
constructor(scopeManager, upperScope, block) {
|
||||
super(scopeManager, "function-expression-name", upperScope, block, false);
|
||||
this.__define(block.id,
|
||||
new Definition(
|
||||
Variable.FunctionName,
|
||||
block.id,
|
||||
block,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
));
|
||||
this.functionExpressionScope = true;
|
||||
}
|
||||
}
|
||||
|
||||
class CatchScope extends Scope {
|
||||
constructor(scopeManager, upperScope, block) {
|
||||
super(scopeManager, "catch", upperScope, block, false);
|
||||
}
|
||||
}
|
||||
|
||||
class WithScope extends Scope {
|
||||
constructor(scopeManager, upperScope, block) {
|
||||
super(scopeManager, "with", upperScope, block, false);
|
||||
}
|
||||
|
||||
__close(scopeManager) {
|
||||
if (this.__shouldStaticallyClose(scopeManager)) {
|
||||
return super.__close(scopeManager);
|
||||
}
|
||||
|
||||
for (let i = 0, iz = this.__left.length; i < iz; ++i) {
|
||||
const ref = this.__left[i];
|
||||
|
||||
ref.tainted = true;
|
||||
this.__delegateToUpperScope(ref);
|
||||
}
|
||||
this.__left = null;
|
||||
|
||||
return this.upper;
|
||||
}
|
||||
}
|
||||
|
||||
class BlockScope extends Scope {
|
||||
constructor(scopeManager, upperScope, block) {
|
||||
super(scopeManager, "block", upperScope, block, false);
|
||||
}
|
||||
}
|
||||
|
||||
class SwitchScope extends Scope {
|
||||
constructor(scopeManager, upperScope, block) {
|
||||
super(scopeManager, "switch", upperScope, block, false);
|
||||
}
|
||||
}
|
||||
|
||||
class FunctionScope extends Scope {
|
||||
constructor(scopeManager, upperScope, block, isMethodDefinition) {
|
||||
super(scopeManager, "function", upperScope, block, isMethodDefinition);
|
||||
|
||||
// section 9.2.13, FunctionDeclarationInstantiation.
|
||||
// NOTE Arrow functions never have an arguments objects.
|
||||
if (this.block.type !== Syntax.ArrowFunctionExpression) {
|
||||
this.__defineArguments();
|
||||
}
|
||||
}
|
||||
|
||||
isArgumentsMaterialized() {
|
||||
|
||||
// TODO(Constellation)
|
||||
// We can more aggressive on this condition like this.
|
||||
//
|
||||
// function t() {
|
||||
// // arguments of t is always hidden.
|
||||
// function arguments() {
|
||||
// }
|
||||
// }
|
||||
if (this.block.type === Syntax.ArrowFunctionExpression) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.isStatic()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const variable = this.set.get("arguments");
|
||||
|
||||
assert(variable, "Always have arguments variable.");
|
||||
return variable.tainted || variable.references.length !== 0;
|
||||
}
|
||||
|
||||
isThisMaterialized() {
|
||||
if (!this.isStatic()) {
|
||||
return true;
|
||||
}
|
||||
return this.thisFound;
|
||||
}
|
||||
|
||||
__defineArguments() {
|
||||
this.__defineGeneric(
|
||||
"arguments",
|
||||
this.set,
|
||||
this.variables,
|
||||
null,
|
||||
null
|
||||
);
|
||||
this.taints.set("arguments", true);
|
||||
}
|
||||
|
||||
// References in default parameters isn't resolved to variables which are in their function body.
|
||||
// const x = 1
|
||||
// function f(a = x) { // This `x` is resolved to the `x` in the outer scope.
|
||||
// const x = 2
|
||||
// console.log(a)
|
||||
// }
|
||||
__isValidResolution(ref, variable) {
|
||||
|
||||
// If `options.nodejsScope` is true, `this.block` becomes a Program node.
|
||||
if (this.block.type === "Program") {
|
||||
return true;
|
||||
}
|
||||
|
||||
const bodyStart = this.block.body.range[0];
|
||||
|
||||
// It's invalid resolution in the following case:
|
||||
return !(
|
||||
variable.scope === this &&
|
||||
ref.identifier.range[0] < bodyStart && // the reference is in the parameter part.
|
||||
variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body.
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ForScope extends Scope {
|
||||
constructor(scopeManager, upperScope, block) {
|
||||
super(scopeManager, "for", upperScope, block, false);
|
||||
}
|
||||
}
|
||||
|
||||
class ClassScope extends Scope {
|
||||
constructor(scopeManager, upperScope, block) {
|
||||
super(scopeManager, "class", upperScope, block, false);
|
||||
}
|
||||
}
|
||||
|
||||
class ClassFieldInitializerScope extends Scope {
|
||||
constructor(scopeManager, upperScope, block) {
|
||||
super(scopeManager, "class-field-initializer", upperScope, block, true);
|
||||
}
|
||||
}
|
||||
|
||||
class ClassStaticBlockScope extends Scope {
|
||||
constructor(scopeManager, upperScope, block) {
|
||||
super(scopeManager, "class-static-block", upperScope, block, true);
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
Scope,
|
||||
GlobalScope,
|
||||
ModuleScope,
|
||||
FunctionExpressionNameScope,
|
||||
CatchScope,
|
||||
WithScope,
|
||||
BlockScope,
|
||||
SwitchScope,
|
||||
FunctionScope,
|
||||
ForScope,
|
||||
ClassScope,
|
||||
ClassFieldInitializerScope,
|
||||
ClassStaticBlockScope
|
||||
};
|
||||
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
87
node_modules/eslint/node_modules/eslint-scope/lib/variable.js
generated
vendored
87
node_modules/eslint/node_modules/eslint-scope/lib/variable.js
generated
vendored
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A Variable represents a locally scoped identifier. These include arguments to
|
||||
* functions.
|
||||
* @constructor Variable
|
||||
*/
|
||||
class Variable {
|
||||
constructor(name, scope) {
|
||||
|
||||
/**
|
||||
* The variable name, as given in the source code.
|
||||
* @member {string} Variable#name
|
||||
*/
|
||||
this.name = name;
|
||||
|
||||
/**
|
||||
* List of defining occurrences of this variable (like in 'var ...'
|
||||
* statements or as parameter), as AST nodes.
|
||||
* @member {espree.Identifier[]} Variable#identifiers
|
||||
*/
|
||||
this.identifiers = [];
|
||||
|
||||
/**
|
||||
* List of {@link Reference|references} of this variable (excluding parameter entries)
|
||||
* in its defining scope and all nested scopes. For defining
|
||||
* occurrences only see {@link Variable#defs}.
|
||||
* @member {Reference[]} Variable#references
|
||||
*/
|
||||
this.references = [];
|
||||
|
||||
/**
|
||||
* List of defining occurrences of this variable (like in 'var ...'
|
||||
* statements or as parameter), as custom objects.
|
||||
* @member {Definition[]} Variable#defs
|
||||
*/
|
||||
this.defs = [];
|
||||
|
||||
this.tainted = false;
|
||||
|
||||
/**
|
||||
* Whether this is a stack variable.
|
||||
* @member {boolean} Variable#stack
|
||||
*/
|
||||
this.stack = true;
|
||||
|
||||
/**
|
||||
* Reference to the enclosing Scope.
|
||||
* @member {Scope} Variable#scope
|
||||
*/
|
||||
this.scope = scope;
|
||||
}
|
||||
}
|
||||
|
||||
Variable.CatchClause = "CatchClause";
|
||||
Variable.Parameter = "Parameter";
|
||||
Variable.FunctionName = "FunctionName";
|
||||
Variable.ClassName = "ClassName";
|
||||
Variable.Variable = "Variable";
|
||||
Variable.ImportBinding = "ImportBinding";
|
||||
Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable";
|
||||
|
||||
export default Variable;
|
||||
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
3
node_modules/eslint/node_modules/eslint-scope/lib/version.js
generated
vendored
3
node_modules/eslint/node_modules/eslint-scope/lib/version.js
generated
vendored
|
|
@ -1,3 +0,0 @@
|
|||
const version = "7.2.0";
|
||||
|
||||
export default version;
|
||||
63
node_modules/eslint/node_modules/eslint-scope/package.json
generated
vendored
63
node_modules/eslint/node_modules/eslint-scope/package.json
generated
vendored
|
|
@ -1,63 +0,0 @@
|
|||
{
|
||||
"name": "eslint-scope",
|
||||
"description": "ECMAScript scope analyzer for ESLint",
|
||||
"homepage": "http://github.com/eslint/eslint-scope",
|
||||
"main": "./dist/eslint-scope.cjs",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./lib/index.js",
|
||||
"require": "./dist/eslint-scope.cjs"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"version": "7.2.0",
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"repository": "eslint/eslint-scope",
|
||||
"funding": "https://opencollective.com/eslint",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/eslint-scope/issues"
|
||||
},
|
||||
"license": "BSD-2-Clause",
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"lint": "npm run build && node Makefile.js lint",
|
||||
"update-version": "node tools/update-version.js",
|
||||
"test": "npm run build && node Makefile.js test",
|
||||
"prepublishOnly": "npm run update-version && npm run build",
|
||||
"generate-release": "eslint-generate-release",
|
||||
"generate-alpharelease": "eslint-generate-prerelease alpha",
|
||||
"generate-betarelease": "eslint-generate-prerelease beta",
|
||||
"generate-rcrelease": "eslint-generate-prerelease rc",
|
||||
"publish-release": "eslint-publish-release"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"lib",
|
||||
"dist/eslint-scope.cjs"
|
||||
],
|
||||
"dependencies": {
|
||||
"esrecurse": "^4.3.0",
|
||||
"estraverse": "^5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/parser": "^4.28.1",
|
||||
"c8": "^7.7.3",
|
||||
"chai": "^4.3.4",
|
||||
"eslint": "^7.29.0",
|
||||
"eslint-config-eslint": "^7.0.0",
|
||||
"eslint-plugin-jsdoc": "^35.4.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-release": "^3.2.0",
|
||||
"eslint-visitor-keys": "^3.3.0",
|
||||
"espree": "^9.3.1",
|
||||
"mocha": "^9.0.1",
|
||||
"npm-license": "^0.3.3",
|
||||
"rollup": "^2.52.7",
|
||||
"shelljs": "^0.8.4",
|
||||
"typescript": "^4.3.5"
|
||||
}
|
||||
}
|
||||
16
node_modules/eslint/node_modules/estraverse/.jshintrc
generated
vendored
16
node_modules/eslint/node_modules/estraverse/.jshintrc
generated
vendored
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"immed": true,
|
||||
"eqnull": true,
|
||||
"latedef": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"quotmark": "single",
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"strict": true,
|
||||
"trailing": true,
|
||||
|
||||
"node": true
|
||||
}
|
||||
19
node_modules/eslint/node_modules/estraverse/LICENSE.BSD
generated
vendored
19
node_modules/eslint/node_modules/estraverse/LICENSE.BSD
generated
vendored
|
|
@ -1,19 +0,0 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
153
node_modules/eslint/node_modules/estraverse/README.md
generated
vendored
153
node_modules/eslint/node_modules/estraverse/README.md
generated
vendored
|
|
@ -1,153 +0,0 @@
|
|||
### Estraverse [](http://travis-ci.org/estools/estraverse)
|
||||
|
||||
Estraverse ([estraverse](http://github.com/estools/estraverse)) is
|
||||
[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)
|
||||
traversal functions from [esmangle project](http://github.com/estools/esmangle).
|
||||
|
||||
### Documentation
|
||||
|
||||
You can find usage docs at [wiki page](https://github.com/estools/estraverse/wiki/Usage).
|
||||
|
||||
### Example Usage
|
||||
|
||||
The following code will output all variables declared at the root of a file.
|
||||
|
||||
```javascript
|
||||
estraverse.traverse(ast, {
|
||||
enter: function (node, parent) {
|
||||
if (node.type == 'FunctionExpression' || node.type == 'FunctionDeclaration')
|
||||
return estraverse.VisitorOption.Skip;
|
||||
},
|
||||
leave: function (node, parent) {
|
||||
if (node.type == 'VariableDeclarator')
|
||||
console.log(node.id.name);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
We can use `this.skip`, `this.remove` and `this.break` functions instead of using Skip, Remove and Break.
|
||||
|
||||
```javascript
|
||||
estraverse.traverse(ast, {
|
||||
enter: function (node) {
|
||||
this.break();
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
And estraverse provides `estraverse.replace` function. When returning node from `enter`/`leave`, current node is replaced with it.
|
||||
|
||||
```javascript
|
||||
result = estraverse.replace(tree, {
|
||||
enter: function (node) {
|
||||
// Replace it with replaced.
|
||||
if (node.type === 'Literal')
|
||||
return replaced;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
By passing `visitor.keys` mapping, we can extend estraverse traversing functionality.
|
||||
|
||||
```javascript
|
||||
// This tree contains a user-defined `TestExpression` node.
|
||||
var tree = {
|
||||
type: 'TestExpression',
|
||||
|
||||
// This 'argument' is the property containing the other **node**.
|
||||
argument: {
|
||||
type: 'Literal',
|
||||
value: 20
|
||||
},
|
||||
|
||||
// This 'extended' is the property not containing the other **node**.
|
||||
extended: true
|
||||
};
|
||||
estraverse.traverse(tree, {
|
||||
enter: function (node) { },
|
||||
|
||||
// Extending the existing traversing rules.
|
||||
keys: {
|
||||
// TargetNodeName: [ 'keys', 'containing', 'the', 'other', '**node**' ]
|
||||
TestExpression: ['argument']
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
By passing `visitor.fallback` option, we can control the behavior when encountering unknown nodes.
|
||||
|
||||
```javascript
|
||||
// This tree contains a user-defined `TestExpression` node.
|
||||
var tree = {
|
||||
type: 'TestExpression',
|
||||
|
||||
// This 'argument' is the property containing the other **node**.
|
||||
argument: {
|
||||
type: 'Literal',
|
||||
value: 20
|
||||
},
|
||||
|
||||
// This 'extended' is the property not containing the other **node**.
|
||||
extended: true
|
||||
};
|
||||
estraverse.traverse(tree, {
|
||||
enter: function (node) { },
|
||||
|
||||
// Iterating the child **nodes** of unknown nodes.
|
||||
fallback: 'iteration'
|
||||
});
|
||||
```
|
||||
|
||||
When `visitor.fallback` is a function, we can determine which keys to visit on each node.
|
||||
|
||||
```javascript
|
||||
// This tree contains a user-defined `TestExpression` node.
|
||||
var tree = {
|
||||
type: 'TestExpression',
|
||||
|
||||
// This 'argument' is the property containing the other **node**.
|
||||
argument: {
|
||||
type: 'Literal',
|
||||
value: 20
|
||||
},
|
||||
|
||||
// This 'extended' is the property not containing the other **node**.
|
||||
extended: true
|
||||
};
|
||||
estraverse.traverse(tree, {
|
||||
enter: function (node) { },
|
||||
|
||||
// Skip the `argument` property of each node
|
||||
fallback: function(node) {
|
||||
return Object.keys(node).filter(function(key) {
|
||||
return key !== 'argument';
|
||||
});
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### License
|
||||
|
||||
Copyright (C) 2012-2016 [Yusuke Suzuki](http://github.com/Constellation)
|
||||
(twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
805
node_modules/eslint/node_modules/estraverse/estraverse.js
generated
vendored
805
node_modules/eslint/node_modules/estraverse/estraverse.js
generated
vendored
|
|
@ -1,805 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2012-2013 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*jslint vars:false, bitwise:true*/
|
||||
/*jshint indent:4*/
|
||||
/*global exports:true*/
|
||||
(function clone(exports) {
|
||||
'use strict';
|
||||
|
||||
var Syntax,
|
||||
VisitorOption,
|
||||
VisitorKeys,
|
||||
BREAK,
|
||||
SKIP,
|
||||
REMOVE;
|
||||
|
||||
function deepCopy(obj) {
|
||||
var ret = {}, key, val;
|
||||
for (key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
val = obj[key];
|
||||
if (typeof val === 'object' && val !== null) {
|
||||
ret[key] = deepCopy(val);
|
||||
} else {
|
||||
ret[key] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// based on LLVM libc++ upper_bound / lower_bound
|
||||
// MIT License
|
||||
|
||||
function upperBound(array, func) {
|
||||
var diff, len, i, current;
|
||||
|
||||
len = array.length;
|
||||
i = 0;
|
||||
|
||||
while (len) {
|
||||
diff = len >>> 1;
|
||||
current = i + diff;
|
||||
if (func(array[current])) {
|
||||
len = diff;
|
||||
} else {
|
||||
i = current + 1;
|
||||
len -= diff + 1;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
Syntax = {
|
||||
AssignmentExpression: 'AssignmentExpression',
|
||||
AssignmentPattern: 'AssignmentPattern',
|
||||
ArrayExpression: 'ArrayExpression',
|
||||
ArrayPattern: 'ArrayPattern',
|
||||
ArrowFunctionExpression: 'ArrowFunctionExpression',
|
||||
AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7.
|
||||
BlockStatement: 'BlockStatement',
|
||||
BinaryExpression: 'BinaryExpression',
|
||||
BreakStatement: 'BreakStatement',
|
||||
CallExpression: 'CallExpression',
|
||||
CatchClause: 'CatchClause',
|
||||
ChainExpression: 'ChainExpression',
|
||||
ClassBody: 'ClassBody',
|
||||
ClassDeclaration: 'ClassDeclaration',
|
||||
ClassExpression: 'ClassExpression',
|
||||
ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7.
|
||||
ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7.
|
||||
ConditionalExpression: 'ConditionalExpression',
|
||||
ContinueStatement: 'ContinueStatement',
|
||||
DebuggerStatement: 'DebuggerStatement',
|
||||
DirectiveStatement: 'DirectiveStatement',
|
||||
DoWhileStatement: 'DoWhileStatement',
|
||||
EmptyStatement: 'EmptyStatement',
|
||||
ExportAllDeclaration: 'ExportAllDeclaration',
|
||||
ExportDefaultDeclaration: 'ExportDefaultDeclaration',
|
||||
ExportNamedDeclaration: 'ExportNamedDeclaration',
|
||||
ExportSpecifier: 'ExportSpecifier',
|
||||
ExpressionStatement: 'ExpressionStatement',
|
||||
ForStatement: 'ForStatement',
|
||||
ForInStatement: 'ForInStatement',
|
||||
ForOfStatement: 'ForOfStatement',
|
||||
FunctionDeclaration: 'FunctionDeclaration',
|
||||
FunctionExpression: 'FunctionExpression',
|
||||
GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7.
|
||||
Identifier: 'Identifier',
|
||||
IfStatement: 'IfStatement',
|
||||
ImportExpression: 'ImportExpression',
|
||||
ImportDeclaration: 'ImportDeclaration',
|
||||
ImportDefaultSpecifier: 'ImportDefaultSpecifier',
|
||||
ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
|
||||
ImportSpecifier: 'ImportSpecifier',
|
||||
Literal: 'Literal',
|
||||
LabeledStatement: 'LabeledStatement',
|
||||
LogicalExpression: 'LogicalExpression',
|
||||
MemberExpression: 'MemberExpression',
|
||||
MetaProperty: 'MetaProperty',
|
||||
MethodDefinition: 'MethodDefinition',
|
||||
ModuleSpecifier: 'ModuleSpecifier',
|
||||
NewExpression: 'NewExpression',
|
||||
ObjectExpression: 'ObjectExpression',
|
||||
ObjectPattern: 'ObjectPattern',
|
||||
PrivateIdentifier: 'PrivateIdentifier',
|
||||
Program: 'Program',
|
||||
Property: 'Property',
|
||||
PropertyDefinition: 'PropertyDefinition',
|
||||
RestElement: 'RestElement',
|
||||
ReturnStatement: 'ReturnStatement',
|
||||
SequenceExpression: 'SequenceExpression',
|
||||
SpreadElement: 'SpreadElement',
|
||||
Super: 'Super',
|
||||
SwitchStatement: 'SwitchStatement',
|
||||
SwitchCase: 'SwitchCase',
|
||||
TaggedTemplateExpression: 'TaggedTemplateExpression',
|
||||
TemplateElement: 'TemplateElement',
|
||||
TemplateLiteral: 'TemplateLiteral',
|
||||
ThisExpression: 'ThisExpression',
|
||||
ThrowStatement: 'ThrowStatement',
|
||||
TryStatement: 'TryStatement',
|
||||
UnaryExpression: 'UnaryExpression',
|
||||
UpdateExpression: 'UpdateExpression',
|
||||
VariableDeclaration: 'VariableDeclaration',
|
||||
VariableDeclarator: 'VariableDeclarator',
|
||||
WhileStatement: 'WhileStatement',
|
||||
WithStatement: 'WithStatement',
|
||||
YieldExpression: 'YieldExpression'
|
||||
};
|
||||
|
||||
VisitorKeys = {
|
||||
AssignmentExpression: ['left', 'right'],
|
||||
AssignmentPattern: ['left', 'right'],
|
||||
ArrayExpression: ['elements'],
|
||||
ArrayPattern: ['elements'],
|
||||
ArrowFunctionExpression: ['params', 'body'],
|
||||
AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7.
|
||||
BlockStatement: ['body'],
|
||||
BinaryExpression: ['left', 'right'],
|
||||
BreakStatement: ['label'],
|
||||
CallExpression: ['callee', 'arguments'],
|
||||
CatchClause: ['param', 'body'],
|
||||
ChainExpression: ['expression'],
|
||||
ClassBody: ['body'],
|
||||
ClassDeclaration: ['id', 'superClass', 'body'],
|
||||
ClassExpression: ['id', 'superClass', 'body'],
|
||||
ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7.
|
||||
ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
|
||||
ConditionalExpression: ['test', 'consequent', 'alternate'],
|
||||
ContinueStatement: ['label'],
|
||||
DebuggerStatement: [],
|
||||
DirectiveStatement: [],
|
||||
DoWhileStatement: ['body', 'test'],
|
||||
EmptyStatement: [],
|
||||
ExportAllDeclaration: ['source'],
|
||||
ExportDefaultDeclaration: ['declaration'],
|
||||
ExportNamedDeclaration: ['declaration', 'specifiers', 'source'],
|
||||
ExportSpecifier: ['exported', 'local'],
|
||||
ExpressionStatement: ['expression'],
|
||||
ForStatement: ['init', 'test', 'update', 'body'],
|
||||
ForInStatement: ['left', 'right', 'body'],
|
||||
ForOfStatement: ['left', 'right', 'body'],
|
||||
FunctionDeclaration: ['id', 'params', 'body'],
|
||||
FunctionExpression: ['id', 'params', 'body'],
|
||||
GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
|
||||
Identifier: [],
|
||||
IfStatement: ['test', 'consequent', 'alternate'],
|
||||
ImportExpression: ['source'],
|
||||
ImportDeclaration: ['specifiers', 'source'],
|
||||
ImportDefaultSpecifier: ['local'],
|
||||
ImportNamespaceSpecifier: ['local'],
|
||||
ImportSpecifier: ['imported', 'local'],
|
||||
Literal: [],
|
||||
LabeledStatement: ['label', 'body'],
|
||||
LogicalExpression: ['left', 'right'],
|
||||
MemberExpression: ['object', 'property'],
|
||||
MetaProperty: ['meta', 'property'],
|
||||
MethodDefinition: ['key', 'value'],
|
||||
ModuleSpecifier: [],
|
||||
NewExpression: ['callee', 'arguments'],
|
||||
ObjectExpression: ['properties'],
|
||||
ObjectPattern: ['properties'],
|
||||
PrivateIdentifier: [],
|
||||
Program: ['body'],
|
||||
Property: ['key', 'value'],
|
||||
PropertyDefinition: ['key', 'value'],
|
||||
RestElement: [ 'argument' ],
|
||||
ReturnStatement: ['argument'],
|
||||
SequenceExpression: ['expressions'],
|
||||
SpreadElement: ['argument'],
|
||||
Super: [],
|
||||
SwitchStatement: ['discriminant', 'cases'],
|
||||
SwitchCase: ['test', 'consequent'],
|
||||
TaggedTemplateExpression: ['tag', 'quasi'],
|
||||
TemplateElement: [],
|
||||
TemplateLiteral: ['quasis', 'expressions'],
|
||||
ThisExpression: [],
|
||||
ThrowStatement: ['argument'],
|
||||
TryStatement: ['block', 'handler', 'finalizer'],
|
||||
UnaryExpression: ['argument'],
|
||||
UpdateExpression: ['argument'],
|
||||
VariableDeclaration: ['declarations'],
|
||||
VariableDeclarator: ['id', 'init'],
|
||||
WhileStatement: ['test', 'body'],
|
||||
WithStatement: ['object', 'body'],
|
||||
YieldExpression: ['argument']
|
||||
};
|
||||
|
||||
// unique id
|
||||
BREAK = {};
|
||||
SKIP = {};
|
||||
REMOVE = {};
|
||||
|
||||
VisitorOption = {
|
||||
Break: BREAK,
|
||||
Skip: SKIP,
|
||||
Remove: REMOVE
|
||||
};
|
||||
|
||||
function Reference(parent, key) {
|
||||
this.parent = parent;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
Reference.prototype.replace = function replace(node) {
|
||||
this.parent[this.key] = node;
|
||||
};
|
||||
|
||||
Reference.prototype.remove = function remove() {
|
||||
if (Array.isArray(this.parent)) {
|
||||
this.parent.splice(this.key, 1);
|
||||
return true;
|
||||
} else {
|
||||
this.replace(null);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function Element(node, path, wrap, ref) {
|
||||
this.node = node;
|
||||
this.path = path;
|
||||
this.wrap = wrap;
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
function Controller() { }
|
||||
|
||||
// API:
|
||||
// return property path array from root to current node
|
||||
Controller.prototype.path = function path() {
|
||||
var i, iz, j, jz, result, element;
|
||||
|
||||
function addToPath(result, path) {
|
||||
if (Array.isArray(path)) {
|
||||
for (j = 0, jz = path.length; j < jz; ++j) {
|
||||
result.push(path[j]);
|
||||
}
|
||||
} else {
|
||||
result.push(path);
|
||||
}
|
||||
}
|
||||
|
||||
// root node
|
||||
if (!this.__current.path) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// first node is sentinel, second node is root element
|
||||
result = [];
|
||||
for (i = 2, iz = this.__leavelist.length; i < iz; ++i) {
|
||||
element = this.__leavelist[i];
|
||||
addToPath(result, element.path);
|
||||
}
|
||||
addToPath(result, this.__current.path);
|
||||
return result;
|
||||
};
|
||||
|
||||
// API:
|
||||
// return type of current node
|
||||
Controller.prototype.type = function () {
|
||||
var node = this.current();
|
||||
return node.type || this.__current.wrap;
|
||||
};
|
||||
|
||||
// API:
|
||||
// return array of parent elements
|
||||
Controller.prototype.parents = function parents() {
|
||||
var i, iz, result;
|
||||
|
||||
// first node is sentinel
|
||||
result = [];
|
||||
for (i = 1, iz = this.__leavelist.length; i < iz; ++i) {
|
||||
result.push(this.__leavelist[i].node);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// API:
|
||||
// return current node
|
||||
Controller.prototype.current = function current() {
|
||||
return this.__current.node;
|
||||
};
|
||||
|
||||
Controller.prototype.__execute = function __execute(callback, element) {
|
||||
var previous, result;
|
||||
|
||||
result = undefined;
|
||||
|
||||
previous = this.__current;
|
||||
this.__current = element;
|
||||
this.__state = null;
|
||||
if (callback) {
|
||||
result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node);
|
||||
}
|
||||
this.__current = previous;
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// API:
|
||||
// notify control skip / break
|
||||
Controller.prototype.notify = function notify(flag) {
|
||||
this.__state = flag;
|
||||
};
|
||||
|
||||
// API:
|
||||
// skip child nodes of current node
|
||||
Controller.prototype.skip = function () {
|
||||
this.notify(SKIP);
|
||||
};
|
||||
|
||||
// API:
|
||||
// break traversals
|
||||
Controller.prototype['break'] = function () {
|
||||
this.notify(BREAK);
|
||||
};
|
||||
|
||||
// API:
|
||||
// remove node
|
||||
Controller.prototype.remove = function () {
|
||||
this.notify(REMOVE);
|
||||
};
|
||||
|
||||
Controller.prototype.__initialize = function(root, visitor) {
|
||||
this.visitor = visitor;
|
||||
this.root = root;
|
||||
this.__worklist = [];
|
||||
this.__leavelist = [];
|
||||
this.__current = null;
|
||||
this.__state = null;
|
||||
this.__fallback = null;
|
||||
if (visitor.fallback === 'iteration') {
|
||||
this.__fallback = Object.keys;
|
||||
} else if (typeof visitor.fallback === 'function') {
|
||||
this.__fallback = visitor.fallback;
|
||||
}
|
||||
|
||||
this.__keys = VisitorKeys;
|
||||
if (visitor.keys) {
|
||||
this.__keys = Object.assign(Object.create(this.__keys), visitor.keys);
|
||||
}
|
||||
};
|
||||
|
||||
function isNode(node) {
|
||||
if (node == null) {
|
||||
return false;
|
||||
}
|
||||
return typeof node === 'object' && typeof node.type === 'string';
|
||||
}
|
||||
|
||||
function isProperty(nodeType, key) {
|
||||
return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key;
|
||||
}
|
||||
|
||||
function candidateExistsInLeaveList(leavelist, candidate) {
|
||||
for (var i = leavelist.length - 1; i >= 0; --i) {
|
||||
if (leavelist[i].node === candidate) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Controller.prototype.traverse = function traverse(root, visitor) {
|
||||
var worklist,
|
||||
leavelist,
|
||||
element,
|
||||
node,
|
||||
nodeType,
|
||||
ret,
|
||||
key,
|
||||
current,
|
||||
current2,
|
||||
candidates,
|
||||
candidate,
|
||||
sentinel;
|
||||
|
||||
this.__initialize(root, visitor);
|
||||
|
||||
sentinel = {};
|
||||
|
||||
// reference
|
||||
worklist = this.__worklist;
|
||||
leavelist = this.__leavelist;
|
||||
|
||||
// initialize
|
||||
worklist.push(new Element(root, null, null, null));
|
||||
leavelist.push(new Element(null, null, null, null));
|
||||
|
||||
while (worklist.length) {
|
||||
element = worklist.pop();
|
||||
|
||||
if (element === sentinel) {
|
||||
element = leavelist.pop();
|
||||
|
||||
ret = this.__execute(visitor.leave, element);
|
||||
|
||||
if (this.__state === BREAK || ret === BREAK) {
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (element.node) {
|
||||
|
||||
ret = this.__execute(visitor.enter, element);
|
||||
|
||||
if (this.__state === BREAK || ret === BREAK) {
|
||||
return;
|
||||
}
|
||||
|
||||
worklist.push(sentinel);
|
||||
leavelist.push(element);
|
||||
|
||||
if (this.__state === SKIP || ret === SKIP) {
|
||||
continue;
|
||||
}
|
||||
|
||||
node = element.node;
|
||||
nodeType = node.type || element.wrap;
|
||||
candidates = this.__keys[nodeType];
|
||||
if (!candidates) {
|
||||
if (this.__fallback) {
|
||||
candidates = this.__fallback(node);
|
||||
} else {
|
||||
throw new Error('Unknown node type ' + nodeType + '.');
|
||||
}
|
||||
}
|
||||
|
||||
current = candidates.length;
|
||||
while ((current -= 1) >= 0) {
|
||||
key = candidates[current];
|
||||
candidate = node[key];
|
||||
if (!candidate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Array.isArray(candidate)) {
|
||||
current2 = candidate.length;
|
||||
while ((current2 -= 1) >= 0) {
|
||||
if (!candidate[current2]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (candidateExistsInLeaveList(leavelist, candidate[current2])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isProperty(nodeType, candidates[current])) {
|
||||
element = new Element(candidate[current2], [key, current2], 'Property', null);
|
||||
} else if (isNode(candidate[current2])) {
|
||||
element = new Element(candidate[current2], [key, current2], null, null);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
worklist.push(element);
|
||||
}
|
||||
} else if (isNode(candidate)) {
|
||||
if (candidateExistsInLeaveList(leavelist, candidate)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
worklist.push(new Element(candidate, key, null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Controller.prototype.replace = function replace(root, visitor) {
|
||||
var worklist,
|
||||
leavelist,
|
||||
node,
|
||||
nodeType,
|
||||
target,
|
||||
element,
|
||||
current,
|
||||
current2,
|
||||
candidates,
|
||||
candidate,
|
||||
sentinel,
|
||||
outer,
|
||||
key;
|
||||
|
||||
function removeElem(element) {
|
||||
var i,
|
||||
key,
|
||||
nextElem,
|
||||
parent;
|
||||
|
||||
if (element.ref.remove()) {
|
||||
// When the reference is an element of an array.
|
||||
key = element.ref.key;
|
||||
parent = element.ref.parent;
|
||||
|
||||
// If removed from array, then decrease following items' keys.
|
||||
i = worklist.length;
|
||||
while (i--) {
|
||||
nextElem = worklist[i];
|
||||
if (nextElem.ref && nextElem.ref.parent === parent) {
|
||||
if (nextElem.ref.key < key) {
|
||||
break;
|
||||
}
|
||||
--nextElem.ref.key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.__initialize(root, visitor);
|
||||
|
||||
sentinel = {};
|
||||
|
||||
// reference
|
||||
worklist = this.__worklist;
|
||||
leavelist = this.__leavelist;
|
||||
|
||||
// initialize
|
||||
outer = {
|
||||
root: root
|
||||
};
|
||||
element = new Element(root, null, null, new Reference(outer, 'root'));
|
||||
worklist.push(element);
|
||||
leavelist.push(element);
|
||||
|
||||
while (worklist.length) {
|
||||
element = worklist.pop();
|
||||
|
||||
if (element === sentinel) {
|
||||
element = leavelist.pop();
|
||||
|
||||
target = this.__execute(visitor.leave, element);
|
||||
|
||||
// node may be replaced with null,
|
||||
// so distinguish between undefined and null in this place
|
||||
if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {
|
||||
// replace
|
||||
element.ref.replace(target);
|
||||
}
|
||||
|
||||
if (this.__state === REMOVE || target === REMOVE) {
|
||||
removeElem(element);
|
||||
}
|
||||
|
||||
if (this.__state === BREAK || target === BREAK) {
|
||||
return outer.root;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
target = this.__execute(visitor.enter, element);
|
||||
|
||||
// node may be replaced with null,
|
||||
// so distinguish between undefined and null in this place
|
||||
if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {
|
||||
// replace
|
||||
element.ref.replace(target);
|
||||
element.node = target;
|
||||
}
|
||||
|
||||
if (this.__state === REMOVE || target === REMOVE) {
|
||||
removeElem(element);
|
||||
element.node = null;
|
||||
}
|
||||
|
||||
if (this.__state === BREAK || target === BREAK) {
|
||||
return outer.root;
|
||||
}
|
||||
|
||||
// node may be null
|
||||
node = element.node;
|
||||
if (!node) {
|
||||
continue;
|
||||
}
|
||||
|
||||
worklist.push(sentinel);
|
||||
leavelist.push(element);
|
||||
|
||||
if (this.__state === SKIP || target === SKIP) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nodeType = node.type || element.wrap;
|
||||
candidates = this.__keys[nodeType];
|
||||
if (!candidates) {
|
||||
if (this.__fallback) {
|
||||
candidates = this.__fallback(node);
|
||||
} else {
|
||||
throw new Error('Unknown node type ' + nodeType + '.');
|
||||
}
|
||||
}
|
||||
|
||||
current = candidates.length;
|
||||
while ((current -= 1) >= 0) {
|
||||
key = candidates[current];
|
||||
candidate = node[key];
|
||||
if (!candidate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Array.isArray(candidate)) {
|
||||
current2 = candidate.length;
|
||||
while ((current2 -= 1) >= 0) {
|
||||
if (!candidate[current2]) {
|
||||
continue;
|
||||
}
|
||||
if (isProperty(nodeType, candidates[current])) {
|
||||
element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2));
|
||||
} else if (isNode(candidate[current2])) {
|
||||
element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2));
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
worklist.push(element);
|
||||
}
|
||||
} else if (isNode(candidate)) {
|
||||
worklist.push(new Element(candidate, key, null, new Reference(node, key)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return outer.root;
|
||||
};
|
||||
|
||||
function traverse(root, visitor) {
|
||||
var controller = new Controller();
|
||||
return controller.traverse(root, visitor);
|
||||
}
|
||||
|
||||
function replace(root, visitor) {
|
||||
var controller = new Controller();
|
||||
return controller.replace(root, visitor);
|
||||
}
|
||||
|
||||
function extendCommentRange(comment, tokens) {
|
||||
var target;
|
||||
|
||||
target = upperBound(tokens, function search(token) {
|
||||
return token.range[0] > comment.range[0];
|
||||
});
|
||||
|
||||
comment.extendedRange = [comment.range[0], comment.range[1]];
|
||||
|
||||
if (target !== tokens.length) {
|
||||
comment.extendedRange[1] = tokens[target].range[0];
|
||||
}
|
||||
|
||||
target -= 1;
|
||||
if (target >= 0) {
|
||||
comment.extendedRange[0] = tokens[target].range[1];
|
||||
}
|
||||
|
||||
return comment;
|
||||
}
|
||||
|
||||
function attachComments(tree, providedComments, tokens) {
|
||||
// At first, we should calculate extended comment ranges.
|
||||
var comments = [], comment, len, i, cursor;
|
||||
|
||||
if (!tree.range) {
|
||||
throw new Error('attachComments needs range information');
|
||||
}
|
||||
|
||||
// tokens array is empty, we attach comments to tree as 'leadingComments'
|
||||
if (!tokens.length) {
|
||||
if (providedComments.length) {
|
||||
for (i = 0, len = providedComments.length; i < len; i += 1) {
|
||||
comment = deepCopy(providedComments[i]);
|
||||
comment.extendedRange = [0, tree.range[0]];
|
||||
comments.push(comment);
|
||||
}
|
||||
tree.leadingComments = comments;
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
for (i = 0, len = providedComments.length; i < len; i += 1) {
|
||||
comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens));
|
||||
}
|
||||
|
||||
// This is based on John Freeman's implementation.
|
||||
cursor = 0;
|
||||
traverse(tree, {
|
||||
enter: function (node) {
|
||||
var comment;
|
||||
|
||||
while (cursor < comments.length) {
|
||||
comment = comments[cursor];
|
||||
if (comment.extendedRange[1] > node.range[0]) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (comment.extendedRange[1] === node.range[0]) {
|
||||
if (!node.leadingComments) {
|
||||
node.leadingComments = [];
|
||||
}
|
||||
node.leadingComments.push(comment);
|
||||
comments.splice(cursor, 1);
|
||||
} else {
|
||||
cursor += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// already out of owned node
|
||||
if (cursor === comments.length) {
|
||||
return VisitorOption.Break;
|
||||
}
|
||||
|
||||
if (comments[cursor].extendedRange[0] > node.range[1]) {
|
||||
return VisitorOption.Skip;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cursor = 0;
|
||||
traverse(tree, {
|
||||
leave: function (node) {
|
||||
var comment;
|
||||
|
||||
while (cursor < comments.length) {
|
||||
comment = comments[cursor];
|
||||
if (node.range[1] < comment.extendedRange[0]) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (node.range[1] === comment.extendedRange[0]) {
|
||||
if (!node.trailingComments) {
|
||||
node.trailingComments = [];
|
||||
}
|
||||
node.trailingComments.push(comment);
|
||||
comments.splice(cursor, 1);
|
||||
} else {
|
||||
cursor += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// already out of owned node
|
||||
if (cursor === comments.length) {
|
||||
return VisitorOption.Break;
|
||||
}
|
||||
|
||||
if (comments[cursor].extendedRange[0] > node.range[1]) {
|
||||
return VisitorOption.Skip;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
exports.Syntax = Syntax;
|
||||
exports.traverse = traverse;
|
||||
exports.replace = replace;
|
||||
exports.attachComments = attachComments;
|
||||
exports.VisitorKeys = VisitorKeys;
|
||||
exports.VisitorOption = VisitorOption;
|
||||
exports.Controller = Controller;
|
||||
exports.cloneEnvironment = function () { return clone({}); };
|
||||
|
||||
return exports;
|
||||
}(exports));
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
70
node_modules/eslint/node_modules/estraverse/gulpfile.js
generated
vendored
70
node_modules/eslint/node_modules/estraverse/gulpfile.js
generated
vendored
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2014 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var gulp = require('gulp'),
|
||||
git = require('gulp-git'),
|
||||
bump = require('gulp-bump'),
|
||||
filter = require('gulp-filter'),
|
||||
tagVersion = require('gulp-tag-version');
|
||||
|
||||
var TEST = [ 'test/*.js' ];
|
||||
var POWERED = [ 'powered-test/*.js' ];
|
||||
var SOURCE = [ 'src/**/*.js' ];
|
||||
|
||||
/**
|
||||
* Bumping version number and tagging the repository with it.
|
||||
* Please read http://semver.org/
|
||||
*
|
||||
* You can use the commands
|
||||
*
|
||||
* gulp patch # makes v0.1.0 -> v0.1.1
|
||||
* gulp feature # makes v0.1.1 -> v0.2.0
|
||||
* gulp release # makes v0.2.1 -> v1.0.0
|
||||
*
|
||||
* To bump the version numbers accordingly after you did a patch,
|
||||
* introduced a feature or made a backwards-incompatible release.
|
||||
*/
|
||||
|
||||
function inc(importance) {
|
||||
// get all the files to bump version in
|
||||
return gulp.src(['./package.json'])
|
||||
// bump the version number in those files
|
||||
.pipe(bump({type: importance}))
|
||||
// save it back to filesystem
|
||||
.pipe(gulp.dest('./'))
|
||||
// commit the changed version number
|
||||
.pipe(git.commit('Bumps package version'))
|
||||
// read only one file to get the version number
|
||||
.pipe(filter('package.json'))
|
||||
// **tag it in the repository**
|
||||
.pipe(tagVersion({
|
||||
prefix: ''
|
||||
}));
|
||||
}
|
||||
|
||||
gulp.task('patch', [ ], function () { return inc('patch'); })
|
||||
gulp.task('minor', [ ], function () { return inc('minor'); })
|
||||
gulp.task('major', [ ], function () { return inc('major'); })
|
||||
40
node_modules/eslint/node_modules/estraverse/package.json
generated
vendored
40
node_modules/eslint/node_modules/estraverse/package.json
generated
vendored
|
|
@ -1,40 +0,0 @@
|
|||
{
|
||||
"name": "estraverse",
|
||||
"description": "ECMAScript JS AST traversal functions",
|
||||
"homepage": "https://github.com/estools/estraverse",
|
||||
"main": "estraverse.js",
|
||||
"version": "5.3.0",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Yusuke Suzuki",
|
||||
"email": "utatane.tea@gmail.com",
|
||||
"web": "http://github.com/Constellation"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/estools/estraverse.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-register": "^6.3.13",
|
||||
"chai": "^2.1.1",
|
||||
"espree": "^1.11.0",
|
||||
"gulp": "^3.8.10",
|
||||
"gulp-bump": "^0.2.2",
|
||||
"gulp-filter": "^2.0.0",
|
||||
"gulp-git": "^1.0.1",
|
||||
"gulp-tag-version": "^1.3.0",
|
||||
"jshint": "^2.5.6",
|
||||
"mocha": "^2.1.0"
|
||||
},
|
||||
"license": "BSD-2-Clause",
|
||||
"scripts": {
|
||||
"test": "npm run-script lint && npm run-script unit-test",
|
||||
"lint": "jshint estraverse.js",
|
||||
"unit-test": "mocha --compilers js:babel-register"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue