
Product
Reachability for Ruby Now in Beta
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.
eslint-visitor-keys
Advanced tools
Constants and utilities about visitor keys to traverse AST.
Use npm to install.
$ npm install eslint-visitor-keys
^20.19.0, ^22.13.0, or >=24To use in an ESM file:
import * as evk from "eslint-visitor-keys"
To use in a CommonJS file:
const evk = require("eslint-visitor-keys")
type:
{ [type: string]: string[] | undefined }
Visitor keys. This keys are frozen.
This is an object. Keys are the type of ESTree nodes. Their values are an array of property names which have child nodes.
For example:
console.log(evk.KEYS.AssignmentExpression) // → ["left", "right"]
type:
(node: object) => string[]
Get the visitor keys of a given AST node.
This is similar to Object.keys(node) of ES Standard, but some keys are excluded: parent, leadingComments, trailingComments, and names which start with _.
This will be used to traverse unknown nodes.
For example:
const node = {
type: "AssignmentExpression",
left: { type: "Identifier", name: "foo" },
right: { type: "Literal", value: 0 }
}
console.log(evk.getKeys(node)) // → ["type", "left", "right"]
type:
(additionalKeys: object) => { [type: string]: string[] | undefined }
Make the union set with evk.KEYS and the given keys.
additionalKeys is at first, then evk.KEYS is concatenated after that.For example:
console.log(evk.unionWith({
MethodDefinition: ["decorators"]
})) // → { ..., MethodDefinition: ["decorators", "key", "value"], ... }
See GitHub releases.
Welcome. See ESLint contribution guidelines.
npm test runs tests and measures code coverage.npm run lint checks source codes with ESLint.npm run test:open-coverage opens the code coverage report of the previous test with your default browser.The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. Become a Sponsor to get your logo on our READMEs and website.
Estraverse is a package for traversing JavaScript ASTs. It provides similar functionality to eslint-visitor-keys by allowing the traversal of AST nodes. However, estraverse focuses more on the traversal mechanism itself, including entering and leaving nodes, whereas eslint-visitor-keys primarily provides a list of keys for traversal.
Acorn-walk is a syntax tree walker for the acorn AST format. Similar to eslint-visitor-keys, it aids in the navigation and analysis of ASTs. The key difference is that acorn-walk is tied to the acorn parser's AST format and provides walker functions for different node types, while eslint-visitor-keys offers a more generalized set of keys for any tool that works with JavaScript ASTs.
FAQs
Constants and utilities about visitor keys to traverse AST.
The npm package eslint-visitor-keys receives a total of 131,458,731 weekly downloads. As such, eslint-visitor-keys popularity was classified as popular.
We found that eslint-visitor-keys demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.