githubEdit

eslint-visitor-keys

npm versionarrow-up-right Downloads/montharrow-up-right Build Statusarrow-up-right Dependency Statusarrow-up-right

Constants and utilities about visitor keys to traverse AST.

πŸ’Ώ Installation

Use npmarrow-up-right to install.

$ npm install eslint-visitor-keys

Requirements

πŸ“– Usage

const evk = require("eslint-visitor-keys")

evk.KEYS

type: { [type: string]: string[] | undefined }

Visitor keys. This keys are frozen.

This is an object. Keys are the type of ESTreearrow-up-right nodes. Their values are an array of property names which have child nodes.

For example:

evk.getKeys(node)

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:

evk.unionWith(additionalKeys)

type: (additionalKeys: object) => { [type: string]: string[] | undefined }

Make the union set with evk.KEYS and the given keys.

  • The order of keys is, additionalKeys is at first, then evk.KEYS is concatenated after that.

  • It removes duplicated keys as keeping the first one.

For example:

πŸ“° Change log

See GitHub releasesarrow-up-right.

🍻 Contributing

Welcome. See ESLint contribution guidelinesarrow-up-right.

Development commands

  • npm test runs tests and measures code coverage.

  • npm run lint checks source codes with ESLint.

  • npm run coverage opens the code coverage report of the previous test with your default browser.

  • npm run release publishes this package to npmarrow-up-right registory.

Last updated

Was this helpful?