eslint-visitor-keys
Advanced tools
Comparing version 3.2.0 to 3.3.0
@@ -7,2 +7,6 @@ /** | ||
/** | ||
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys | ||
*/ | ||
// List to ignore keys. | ||
@@ -26,4 +30,4 @@ const KEY_BLACKLIST = new Set([ | ||
* Get visitor keys of a given node. | ||
* @param {Object} node The AST node to get keys. | ||
* @returns {string[]} Visitor keys of the node. | ||
* @param {object} node The AST node to get keys. | ||
* @returns {readonly string[]} Visitor keys of the node. | ||
*/ | ||
@@ -38,7 +42,9 @@ export function getKeys(node) { | ||
* Make the union set with `KEYS` and given keys. | ||
* @param {Object} additionalKeys The additional keys. | ||
* @returns {{ [type: string]: string[] | undefined }} The union set. | ||
* @param {VisitorKeys} additionalKeys The additional keys. | ||
* @returns {VisitorKeys} The union set. | ||
*/ | ||
export function unionWith(additionalKeys) { | ||
const retv = Object.assign({}, KEYS); | ||
const retv = /** @type {{ | ||
[type: string]: ReadonlyArray<string> | ||
}} */ (Object.assign({}, KEYS)); | ||
@@ -45,0 +51,0 @@ for (const type of Object.keys(additionalKeys)) { |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @typedef {import('./index.js').VisitorKeys} VisitorKeys | ||
*/ | ||
/** | ||
* @type {VisitorKeys} | ||
*/ | ||
const KEYS = { | ||
@@ -2,0 +9,0 @@ AssignmentExpression: [ |
{ | ||
"name": "eslint-visitor-keys", | ||
"version": "3.2.0", | ||
"version": "3.3.0", | ||
"description": "Constants and utilities about visitor keys to traverse AST.", | ||
"type": "module", | ||
"main": "dist/eslint-visitor-keys.cjs", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
@@ -18,2 +19,4 @@ ".": [ | ||
"files": [ | ||
"dist/index.d.ts", | ||
"dist/visitor-keys.d.ts", | ||
"dist/eslint-visitor-keys.cjs", | ||
@@ -34,9 +37,13 @@ "lib" | ||
"opener": "^1.5.2", | ||
"rollup": "^2.52.1" | ||
"rollup": "^2.52.1", | ||
"tsd": "^0.19.1", | ||
"typescript": "^4.5.5" | ||
}, | ||
"scripts": { | ||
"prepare": "npm run build", | ||
"build": "rollup -c", | ||
"build": "rollup -c && npm run tsc", | ||
"lint": "eslint .", | ||
"test": "mocha tests/lib/**/*.cjs && c8 mocha tests/lib/**/*.js", | ||
"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", | ||
@@ -43,0 +50,0 @@ "generate-release": "eslint-generate-release", |
Sorry, the diff of this file is not supported yet
31089
8
755
11