Bump packages to fix linter

This commit is contained in:
Henry Mercer 2023-01-18 20:50:03 +00:00
parent ed9506bbaf
commit 0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions

View file

@ -1,25 +0,0 @@
v1.3.0 - June 19, 2020
* [`c92dd7f`](https://github.com/eslint/eslint-visitor-keys/commit/c92dd7ff96f0044dba12d681406a025b92b4c437) Update: add `ChainExpression` node (#12) (Toru Nagashima)
v1.2.0 - June 4, 2020
* [`21f28bf`](https://github.com/eslint/eslint-visitor-keys/commit/21f28bf11be5329d740a8bf6bdbcd0ef13bbf1a2) Update: added exported in exportAllDeclaration key (#10) (Anix)
v1.1.0 - August 13, 2019
* [`9331cc0`](https://github.com/eslint/eslint-visitor-keys/commit/9331cc09e756e65b9044c9186445a474b037fac6) Update: add ImportExpression (#8) (Toru Nagashima)
* [`5967f58`](https://github.com/eslint/eslint-visitor-keys/commit/5967f583b04f17fba9226aaa394e45d476d2b8af) Chore: add supported Node.js versions to CI (#7) (Kai Cataldo)
* [`6f7c60f`](https://github.com/eslint/eslint-visitor-keys/commit/6f7c60fef2ceec9f6323202df718321cec45cab0) Upgrade: eslint-release@1.0.0 (#5) (Teddy Katz)
v1.0.0 - December 18, 2017
* 1f6bd38 Breaking: update keys (#4) (Toru Nagashima)
v0.1.0 - November 17, 2017
* 17b4a88 Chore: update `repository` field in package.json (#3) (Toru Nagashima)
* a5a026b New: eslint-visitor-keys (#1) (Toru Nagashima)
* a1a48b8 Update: Change license to Apache 2 (#2) (Ilya Volodin)
* 2204715 Initial commit (Toru Nagashima)

View file

@ -17,10 +17,19 @@ $ npm install eslint-visitor-keys
### Requirements
- [Node.js] 4.0.0 or later.
- [Node.js] `^12.22.0`, `^14.17.0`, or `>=16.0.0`
## 📖 Usage
To use in an ESM file:
```js
import * as evk from "eslint-visitor-keys"
```
To use in a CommonJS file:
```js
const evk = require("eslint-visitor-keys")
```
@ -51,7 +60,7 @@ This will be used to traverse unknown nodes.
For example:
```
```js
const node = {
type: "AssignmentExpression",
left: { type: "Identifier", name: "foo" },
@ -71,7 +80,7 @@ Make the union set with `evk.KEYS` and the given keys.
For example:
```
```js
console.log(evk.unionWith({
MethodDefinition: ["decorators"]
})) // → { ..., MethodDefinition: ["decorators", "key", "value"], ... }
@ -94,5 +103,5 @@ Welcome. See [ESLint contribution guidelines](https://eslint.org/docs/developer-
[npm]: https://www.npmjs.com/
[Node.js]: https://nodejs.org/en/
[Node.js]: https://nodejs.org/
[ESTree]: https://github.com/estree/estree

View file

@ -0,0 +1,382 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
/**
* @typedef {import('./index.js').VisitorKeys} VisitorKeys
*/
/**
* @type {VisitorKeys}
*/
const KEYS = {
AssignmentExpression: [
"left",
"right"
],
AssignmentPattern: [
"left",
"right"
],
ArrayExpression: [
"elements"
],
ArrayPattern: [
"elements"
],
ArrowFunctionExpression: [
"params",
"body"
],
AwaitExpression: [
"argument"
],
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"
],
ConditionalExpression: [
"test",
"consequent",
"alternate"
],
ContinueStatement: [
"label"
],
DebuggerStatement: [],
DoWhileStatement: [
"body",
"test"
],
EmptyStatement: [],
ExportAllDeclaration: [
"exported",
"source"
],
ExportDefaultDeclaration: [
"declaration"
],
ExportNamedDeclaration: [
"declaration",
"specifiers",
"source"
],
ExportSpecifier: [
"exported",
"local"
],
ExpressionStatement: [
"expression"
],
ExperimentalRestProperty: [
"argument"
],
ExperimentalSpreadProperty: [
"argument"
],
ForStatement: [
"init",
"test",
"update",
"body"
],
ForInStatement: [
"left",
"right",
"body"
],
ForOfStatement: [
"left",
"right",
"body"
],
FunctionDeclaration: [
"id",
"params",
"body"
],
FunctionExpression: [
"id",
"params",
"body"
],
Identifier: [],
IfStatement: [
"test",
"consequent",
"alternate"
],
ImportDeclaration: [
"specifiers",
"source"
],
ImportDefaultSpecifier: [
"local"
],
ImportExpression: [
"source"
],
ImportNamespaceSpecifier: [
"local"
],
ImportSpecifier: [
"imported",
"local"
],
JSXAttribute: [
"name",
"value"
],
JSXClosingElement: [
"name"
],
JSXElement: [
"openingElement",
"children",
"closingElement"
],
JSXEmptyExpression: [],
JSXExpressionContainer: [
"expression"
],
JSXIdentifier: [],
JSXMemberExpression: [
"object",
"property"
],
JSXNamespacedName: [
"namespace",
"name"
],
JSXOpeningElement: [
"name",
"attributes"
],
JSXSpreadAttribute: [
"argument"
],
JSXText: [],
JSXFragment: [
"openingFragment",
"children",
"closingFragment"
],
JSXClosingFragment: [],
JSXOpeningFragment: [],
Literal: [],
LabeledStatement: [
"label",
"body"
],
LogicalExpression: [
"left",
"right"
],
MemberExpression: [
"object",
"property"
],
MetaProperty: [
"meta",
"property"
],
MethodDefinition: [
"key",
"value"
],
NewExpression: [
"callee",
"arguments"
],
ObjectExpression: [
"properties"
],
ObjectPattern: [
"properties"
],
PrivateIdentifier: [],
Program: [
"body"
],
Property: [
"key",
"value"
],
PropertyDefinition: [
"key",
"value"
],
RestElement: [
"argument"
],
ReturnStatement: [
"argument"
],
SequenceExpression: [
"expressions"
],
SpreadElement: [
"argument"
],
StaticBlock: [
"body"
],
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"
]
};
// Types.
const NODE_TYPES = Object.keys(KEYS);
// Freeze the keys.
for (const type of NODE_TYPES) {
Object.freeze(KEYS[type]);
}
Object.freeze(KEYS);
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
/**
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
*/
// List to ignore keys.
const KEY_BLACKLIST = new Set([
"parent",
"leadingComments",
"trailingComments"
]);
/**
* Check whether a given key should be used or not.
* @param {string} key The key to check.
* @returns {boolean} `true` if the key should be used.
*/
function filterKey(key) {
return !KEY_BLACKLIST.has(key) && key[0] !== "_";
}
/**
* Get visitor keys of a given node.
* @param {object} node The AST node to get keys.
* @returns {readonly string[]} Visitor keys of the node.
*/
function getKeys(node) {
return Object.keys(node).filter(filterKey);
}
// Disable valid-jsdoc rule because it reports syntax error on the type of @returns.
// eslint-disable-next-line valid-jsdoc
/**
* Make the union set with `KEYS` and given keys.
* @param {VisitorKeys} additionalKeys The additional keys.
* @returns {VisitorKeys} The union set.
*/
function unionWith(additionalKeys) {
const retv = /** @type {{
[type: string]: ReadonlyArray<string>
}} */ (Object.assign({}, KEYS));
for (const type of Object.keys(additionalKeys)) {
if (Object.prototype.hasOwnProperty.call(retv, type)) {
const keys = new Set(additionalKeys[type]);
for (const key of retv[type]) {
keys.add(key);
}
retv[type] = Object.freeze(Array.from(keys));
} else {
retv[type] = Object.freeze(Array.from(additionalKeys[type]));
}
}
return Object.freeze(retv);
}
exports.KEYS = KEYS;
exports.getKeys = getKeys;
exports.unionWith = unionWith;
//# sourceMappingURL=eslint-visitor-keys.cjs.map

View file

@ -0,0 +1,18 @@
/**
* Get visitor keys of a given node.
* @param {object} node The AST node to get keys.
* @returns {readonly string[]} Visitor keys of the node.
*/
export function getKeys(node: object): readonly string[];
/**
* Make the union set with `KEYS` and given keys.
* @param {VisitorKeys} additionalKeys The additional keys.
* @returns {VisitorKeys} The union set.
*/
export function unionWith(additionalKeys: VisitorKeys): VisitorKeys;
export { KEYS };
export type VisitorKeys = {
readonly [type: string]: readonly string[];
};
import KEYS from "./visitor-keys.js";
//# sourceMappingURL=index.d.ts.map

View file

@ -0,0 +1,10 @@
export default KEYS;
export type VisitorKeys = import('./index.js').VisitorKeys;
/**
* @typedef {import('./index.js').VisitorKeys} VisitorKeys
*/
/**
* @type {VisitorKeys}
*/
declare const KEYS: VisitorKeys;
//# sourceMappingURL=visitor-keys.d.ts.map

View file

@ -2,18 +2,11 @@
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict";
import KEYS from "./visitor-keys.js";
const KEYS = require("./visitor-keys.json");
// Types.
const NODE_TYPES = Object.freeze(Object.keys(KEYS));
// Freeze the keys.
for (const type of NODE_TYPES) {
Object.freeze(KEYS[type]);
}
Object.freeze(KEYS);
/**
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
*/
// List to ignore keys.
const KEY_BLACKLIST = new Set([
@ -31,51 +24,42 @@ function filterKey(key) {
return !KEY_BLACKLIST.has(key) && key[0] !== "_";
}
//------------------------------------------------------------------------------
// Public interfaces
//------------------------------------------------------------------------------
/**
* Get visitor keys of a given node.
* @param {object} node The AST node to get keys.
* @returns {readonly string[]} Visitor keys of the node.
*/
export function getKeys(node) {
return Object.keys(node).filter(filterKey);
}
module.exports = Object.freeze({
// Disable valid-jsdoc rule because it reports syntax error on the type of @returns.
// eslint-disable-next-line valid-jsdoc
/**
* Make the union set with `KEYS` and given keys.
* @param {VisitorKeys} additionalKeys The additional keys.
* @returns {VisitorKeys} The union set.
*/
export function unionWith(additionalKeys) {
const retv = /** @type {{
[type: string]: ReadonlyArray<string>
}} */ (Object.assign({}, KEYS));
/**
* Visitor keys.
* @type {{ [type: string]: string[] | undefined }}
*/
KEYS,
for (const type of Object.keys(additionalKeys)) {
if (Object.prototype.hasOwnProperty.call(retv, type)) {
const keys = new Set(additionalKeys[type]);
/**
* Get visitor keys of a given node.
* @param {Object} node The AST node to get keys.
* @returns {string[]} Visitor keys of the node.
*/
getKeys(node) {
return Object.keys(node).filter(filterKey);
},
// Disable valid-jsdoc rule because it reports syntax error on the type of @returns.
// eslint-disable-next-line valid-jsdoc
/**
* Make the union set with `KEYS` and given keys.
* @param {Object} additionalKeys The additional keys.
* @returns {{ [type: string]: string[] | undefined }} The union set.
*/
unionWith(additionalKeys) {
const retv = Object.assign({}, KEYS);
for (const type of Object.keys(additionalKeys)) {
if (retv.hasOwnProperty(type)) {
const keys = new Set(additionalKeys[type]);
for (const key of retv[type]) {
keys.add(key);
}
retv[type] = Object.freeze(Array.from(keys));
} else {
retv[type] = Object.freeze(Array.from(additionalKeys[type]));
for (const key of retv[type]) {
keys.add(key);
}
}
return Object.freeze(retv);
retv[type] = Object.freeze(Array.from(keys));
} else {
retv[type] = Object.freeze(Array.from(additionalKeys[type]));
}
}
});
return Object.freeze(retv);
}
export { KEYS };

View file

@ -1,284 +1,312 @@
{
"AssignmentExpression": [
/**
* @typedef {import('./index.js').VisitorKeys} VisitorKeys
*/
/**
* @type {VisitorKeys}
*/
const KEYS = {
AssignmentExpression: [
"left",
"right"
],
"AssignmentPattern": [
AssignmentPattern: [
"left",
"right"
],
"ArrayExpression": [
ArrayExpression: [
"elements"
],
"ArrayPattern": [
ArrayPattern: [
"elements"
],
"ArrowFunctionExpression": [
ArrowFunctionExpression: [
"params",
"body"
],
"AwaitExpression": [
AwaitExpression: [
"argument"
],
"BlockStatement": [
BlockStatement: [
"body"
],
"BinaryExpression": [
BinaryExpression: [
"left",
"right"
],
"BreakStatement": [
BreakStatement: [
"label"
],
"CallExpression": [
CallExpression: [
"callee",
"arguments"
],
"CatchClause": [
CatchClause: [
"param",
"body"
],
"ChainExpression": [
ChainExpression: [
"expression"
],
"ClassBody": [
ClassBody: [
"body"
],
"ClassDeclaration": [
ClassDeclaration: [
"id",
"superClass",
"body"
],
"ClassExpression": [
ClassExpression: [
"id",
"superClass",
"body"
],
"ConditionalExpression": [
ConditionalExpression: [
"test",
"consequent",
"alternate"
],
"ContinueStatement": [
ContinueStatement: [
"label"
],
"DebuggerStatement": [],
"DoWhileStatement": [
DebuggerStatement: [],
DoWhileStatement: [
"body",
"test"
],
"EmptyStatement": [],
"ExportAllDeclaration": [
EmptyStatement: [],
ExportAllDeclaration: [
"exported",
"source"
],
"ExportDefaultDeclaration": [
ExportDefaultDeclaration: [
"declaration"
],
"ExportNamedDeclaration": [
ExportNamedDeclaration: [
"declaration",
"specifiers",
"source"
],
"ExportSpecifier": [
ExportSpecifier: [
"exported",
"local"
],
"ExpressionStatement": [
ExpressionStatement: [
"expression"
],
"ExperimentalRestProperty": [
ExperimentalRestProperty: [
"argument"
],
"ExperimentalSpreadProperty": [
ExperimentalSpreadProperty: [
"argument"
],
"ForStatement": [
ForStatement: [
"init",
"test",
"update",
"body"
],
"ForInStatement": [
ForInStatement: [
"left",
"right",
"body"
],
"ForOfStatement": [
ForOfStatement: [
"left",
"right",
"body"
],
"FunctionDeclaration": [
FunctionDeclaration: [
"id",
"params",
"body"
],
"FunctionExpression": [
FunctionExpression: [
"id",
"params",
"body"
],
"Identifier": [],
"IfStatement": [
Identifier: [],
IfStatement: [
"test",
"consequent",
"alternate"
],
"ImportDeclaration": [
ImportDeclaration: [
"specifiers",
"source"
],
"ImportDefaultSpecifier": [
ImportDefaultSpecifier: [
"local"
],
"ImportExpression": [
ImportExpression: [
"source"
],
"ImportNamespaceSpecifier": [
ImportNamespaceSpecifier: [
"local"
],
"ImportSpecifier": [
ImportSpecifier: [
"imported",
"local"
],
"JSXAttribute": [
JSXAttribute: [
"name",
"value"
],
"JSXClosingElement": [
JSXClosingElement: [
"name"
],
"JSXElement": [
JSXElement: [
"openingElement",
"children",
"closingElement"
],
"JSXEmptyExpression": [],
"JSXExpressionContainer": [
JSXEmptyExpression: [],
JSXExpressionContainer: [
"expression"
],
"JSXIdentifier": [],
"JSXMemberExpression": [
JSXIdentifier: [],
JSXMemberExpression: [
"object",
"property"
],
"JSXNamespacedName": [
JSXNamespacedName: [
"namespace",
"name"
],
"JSXOpeningElement": [
JSXOpeningElement: [
"name",
"attributes"
],
"JSXSpreadAttribute": [
JSXSpreadAttribute: [
"argument"
],
"JSXText": [],
"JSXFragment": [
JSXText: [],
JSXFragment: [
"openingFragment",
"children",
"closingFragment"
],
"Literal": [],
"LabeledStatement": [
JSXClosingFragment: [],
JSXOpeningFragment: [],
Literal: [],
LabeledStatement: [
"label",
"body"
],
"LogicalExpression": [
LogicalExpression: [
"left",
"right"
],
"MemberExpression": [
MemberExpression: [
"object",
"property"
],
"MetaProperty": [
MetaProperty: [
"meta",
"property"
],
"MethodDefinition": [
MethodDefinition: [
"key",
"value"
],
"NewExpression": [
NewExpression: [
"callee",
"arguments"
],
"ObjectExpression": [
ObjectExpression: [
"properties"
],
"ObjectPattern": [
ObjectPattern: [
"properties"
],
"Program": [
PrivateIdentifier: [],
Program: [
"body"
],
"Property": [
Property: [
"key",
"value"
],
"RestElement": [
PropertyDefinition: [
"key",
"value"
],
RestElement: [
"argument"
],
"ReturnStatement": [
ReturnStatement: [
"argument"
],
"SequenceExpression": [
SequenceExpression: [
"expressions"
],
"SpreadElement": [
SpreadElement: [
"argument"
],
"Super": [],
"SwitchStatement": [
StaticBlock: [
"body"
],
Super: [],
SwitchStatement: [
"discriminant",
"cases"
],
"SwitchCase": [
SwitchCase: [
"test",
"consequent"
],
"TaggedTemplateExpression": [
TaggedTemplateExpression: [
"tag",
"quasi"
],
"TemplateElement": [],
"TemplateLiteral": [
TemplateElement: [],
TemplateLiteral: [
"quasis",
"expressions"
],
"ThisExpression": [],
"ThrowStatement": [
ThisExpression: [],
ThrowStatement: [
"argument"
],
"TryStatement": [
TryStatement: [
"block",
"handler",
"finalizer"
],
"UnaryExpression": [
UnaryExpression: [
"argument"
],
"UpdateExpression": [
UpdateExpression: [
"argument"
],
"VariableDeclaration": [
VariableDeclaration: [
"declarations"
],
"VariableDeclarator": [
VariableDeclarator: [
"id",
"init"
],
"WhileStatement": [
WhileStatement: [
"test",
"body"
],
"WithStatement": [
WithStatement: [
"object",
"body"
],
"YieldExpression": [
YieldExpression: [
"argument"
]
};
// Types.
const NODE_TYPES = Object.keys(KEYS);
// Freeze the keys.
for (const type of NODE_TYPES) {
Object.freeze(KEYS[type]);
}
Object.freeze(KEYS);
export default KEYS;

View file

@ -1,28 +1,50 @@
{
"name": "eslint-visitor-keys",
"version": "1.3.0",
"version": "3.3.0",
"description": "Constants and utilities about visitor keys to traverse AST.",
"main": "lib/index.js",
"type": "module",
"main": "dist/eslint-visitor-keys.cjs",
"types": "./dist/index.d.ts",
"exports": {
".": [
{
"import": "./lib/index.js",
"require": "./dist/eslint-visitor-keys.cjs"
},
"./dist/eslint-visitor-keys.cjs"
],
"./package.json": "./package.json"
},
"files": [
"dist/index.d.ts",
"dist/visitor-keys.d.ts",
"dist/eslint-visitor-keys.cjs",
"lib"
],
"engines": {
"node": ">=4"
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"dependencies": {},
"devDependencies": {
"eslint": "^4.7.2",
"eslint-config-eslint": "^4.0.0",
"eslint-release": "^1.0.0",
"mocha": "^3.5.3",
"nyc": "^11.2.1",
"opener": "^1.4.3"
"c8": "^7.7.3",
"eslint": "^7.29.0",
"eslint-config-eslint": "^7.0.0",
"eslint-plugin-jsdoc": "^35.4.0",
"eslint-plugin-node": "^11.1.0",
"eslint-release": "^3.2.0",
"mocha": "^9.0.1",
"opener": "^1.5.2",
"rollup": "^2.52.1",
"tsd": "^0.19.1",
"typescript": "^4.5.5"
},
"scripts": {
"lint": "eslint lib tests/lib",
"pretest": "npm run -s lint",
"test": "nyc mocha tests/lib",
"coverage": "nyc report --reporter lcov && opener coverage/lcov-report/index.html",
"prepare": "npm run build",
"build": "rollup -c && npm run tsc",
"lint": "eslint .",
"tsc": "tsc",
"tsd": "tsd",
"test": "mocha tests/lib/**/*.cjs && c8 mocha tests/lib/**/*.js && npm run tsd",
"coverage": "c8 report --reporter lcov && opener coverage/lcov-report/index.html",
"generate-release": "eslint-generate-release",
"generate-alpharelease": "eslint-generate-prerelease alpha",
"generate-betarelease": "eslint-generate-prerelease beta",