Big news!Introducing Socket AI - ChatGPT-Powered Threat Analysis.Learn more
Socket
Socket

eslint-visitor-keys

Package Overview
Dependencies
0
Maintainers
2
Versions
13
Issues
File Explorer

Advanced tools

eslint-visitor-keys

Constants and utilities about visitor keys to traverse AST.

    3.4.1latest
    GitHub
    npm

Version published
Maintainers
2
Weekly downloads
66,121,429
increased by0.21%

Weekly downloads

Changelog

Source

3.4.1 (2023-05-05)

Bug Fixes

  • correct types for node16 resolution (#47) (7bd1fc1)

Chores

v3.4.0 - March 27, 2023

v3.3.0 - February 11, 2022

  • 7f10327 feat: Bundle JSDoc-built TypeScript declaration file (#34) (Brett Zamir)

v3.2.0 - January 15, 2022

  • 5c53218 feat: add missing JSXOpeningFragment and JSXClosingFragment (#33) (Richard Huang)
  • 2a5c9a6 docs: readme add syntax highlighting (#32) (coderaiser)

v3.1.0 - November 8, 2021

  • 5e3e687 build: upgrade eslint-release to v3.2.0 to support conventional commits (#31) (Milos Djermanovic)
  • 53d3939 Build: add node v17 (#30) (唯然)
  • 5f5b232 Update: add StaticBlock (#29) (Milos Djermanovic)
  • e89bff9 Chore: use actions/setup-node@v2 (薛定谔的猫)
  • 7b756cd Docs: Update the minimum Node.js version requirement (#26) (0uep)

v3.0.0 - June 24, 2021

  • 701b67d Breaking: drop node v10/v13/v15 (refs eslint/eslint#14023) (#23) (薛定谔的猫)
  • f584b12 Breaking: Switch to ESM (#24) (Brett Zamir)
  • 7279e73 Build: Update branch reference in CI (#25) (Milos Djermanovic)
  • c6846d6 Upgrade: eslint-release (#21) (Nicholas C. Zakas)

v2.1.0 - May 3, 2021

  • 908fdf8 Update: add PrivateIdentifier and PropertyDefinition (#20) (Toru Nagashima)
  • 2d7be11 Chore: No longer test in Node.js 13 (#17) (Michaël De Boey)
  • b41b509 Docs: Update required Node.js version (#15) (Michaël De Boey)

v2.0.0 - August 14, 2020

  • fb86ca3 Breaking: drop support for Node <10 (#13) (Kai Cataldo)
  • 69383b3 Chore: move to GitHub Actions (#14) (Kai Cataldo)

v1.3.0 - June 19, 2020

  • c92dd7f Update: add ChainExpression node (#12) (Toru Nagashima)

v1.2.0 - June 4, 2020

  • 21f28bf Update: added exported in exportAllDeclaration key (#10) (Anix)

v1.1.0 - August 13, 2019

  • 9331cc0 Update: add ImportExpression (#8) (Toru Nagashima)
  • 5967f58 Chore: add supported Node.js versions to CI (#7) (Kai Cataldo)
  • 6f7c60f 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)

Readme

Source

eslint-visitor-keys

npm version Downloads/month Build Status

Constants and utilities about visitor keys to traverse AST.

💿 Installation

Use npm to install.

$ npm install eslint-visitor-keys

Requirements

  • Node.js ^12.22.0, ^14.17.0, or >=16.0.0

📖 Usage

To use in an ESM file:

import * as evk from "eslint-visitor-keys"

To use in a CommonJS file:

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 ESTree nodes. Their values are an array of property names which have child nodes.

For example:

console.log(evk.KEYS.AssignmentExpression) // → ["left", "right"]

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:

const node = { type: "AssignmentExpression", left: { type: "Identifier", name: "foo" }, right: { type: "Literal", value: 0 } } console.log(evk.getKeys(node)) // → ["type", "left", "right"]

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:

console.log(evk.unionWith({ MethodDefinition: ["decorators"] })) // → { ..., MethodDefinition: ["decorators", "key", "value"], ... }

📰 Change log

See GitHub releases.

🍻 Contributing

Welcome. See ESLint contribution guidelines.

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 npm registory.

FAQs

Last updated on 05 May 2023

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
Socket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc