From 354f7208f3f6a13b5bb1de5e4a70a3bed43479b0 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Sun, 6 Feb 2022 19:07:32 +0800 Subject: [PATCH] refactor: allow undefined keys (but not for keys argument or return value of `unionWith`) --- .eslintrc.json | 9 +++++++++ lib/index.js | 2 +- lib/visitor-keys.js | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 7bea33e..851ab42 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,6 +7,15 @@ "sourceType": "module", "ecmaVersion": 2020 }, + "settings": { + "jsdoc": { + "mode": "typescript", + "preferredTypes": { + "Object": "object", + "object<>": "Object" + } + } + }, "overrides": [ { "files": ["*.cjs"], diff --git a/lib/index.js b/lib/index.js index 747d024..93d22dc 100644 --- a/lib/index.js +++ b/lib/index.js @@ -22,7 +22,7 @@ function filterKey(key) { /** * Get visitor keys of a given node. - * @param {Object} node The AST node to get keys. + * @param {object} node The AST node to get keys. * @returns {readonly string[]} Visitor keys of the node. */ export function getKeys(node) { diff --git a/lib/visitor-keys.js b/lib/visitor-keys.js index c55d8f3..9b626dd 100644 --- a/lib/visitor-keys.js +++ b/lib/visitor-keys.js @@ -1,5 +1,5 @@ /** - * @type {{ readonly [type: string]: ReadonlyArray }} + * @type {{ readonly [type: string]: ReadonlyArray | undefined }} */ const KEYS = { AssignmentExpression: [