Socket
Socket
Sign inDemoInstall

@typescript-eslint/visitor-keys

Package Overview
Dependencies
2
Maintainers
2
Versions
2909
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typescript-eslint/visitor-keys


Version published
Maintainers
2
Install size
273 kB
Created

Package description

What is @typescript-eslint/visitor-keys?

The @typescript-eslint/visitor-keys package provides an enumeration of TypeScript ESTree AST node types and their respective visitor keys. It is primarily used in the context of ESLint plugins and custom rules development to traverse the AST (Abstract Syntax Tree) of TypeScript code and analyze or manipulate the code structure.

What are @typescript-eslint/visitor-keys's main functionalities?

AST Node Traversal

This code demonstrates how to use the visitor keys from the package to traverse an AST node and its children recursively. The `traverseAST` function takes a node and a visitor object that contains methods corresponding to node types. It uses the visitor keys to determine which properties of a node to traverse.

const visitorKeys = require('@typescript-eslint/visitor-keys');

function traverseAST(node, visitor) {
  if (visitor[node.type]) {
    visitor[node.type](node);
  }

  const keys = visitorKeys[node.type] || [];
  keys.forEach((key) => {
    const value = node[key];
    if (Array.isArray(value)) {
      value.forEach(child => traverseAST(child, visitor));
    } else if (value && typeof value === 'object') {
      traverseAST(value, visitor);
    }
  });
}

Other packages similar to @typescript-eslint/visitor-keys

Changelog

Source

6.0.0 (2023-07-10)

Bug Fixes

  • ast-spec: remove more invalid properties (#6243) (aa20f63)
  • bumped ts-api-utils to 0.0.39 (#6497) (217c710)
  • correct handling of additionalProperties in object schemas (#6939) (489c7a5)
  • correct jest.mock path post merge (778d254)
  • correct lint error after merge (277fdb5)
  • eslint-plugin: [explicit-module-boundary-types] remove shouldTrackReferences option from schema (#5399) (6d32734)
  • eslint-plugin: allow parser@^6.0.0 (#6630) (92908bd)
  • eslint-plugin: remove valid-typeof disable in eslint-recommended (#5381) (b82df5e)
  • fix illegal decorator check (#6723) (c456f8c)
  • rename typeParameters to typeArguments where needed (#5384) (08d757b)
  • replace tsutils with ts-api-tools (#6428) (79327b4)
  • type-utils: checking of type aliases' type names by typeMatchesSpecifier (#6820) (7ca2c90)
  • type-utils: file variant of TypeOrValueSpecifier uses canonical filenames instead of lowercasing (#6781) (5095d05)
  • type-utils: fixed TypeOrValueSpecifier not accounting for scoped DT packages (#6780) (3350940)
  • type-utils: treat intrinsic types as if they are from lib and never match error types (#6869) (ecb57de)
  • typescript-estree: account for namespace nesting in AST conversion (#6272) (09e3877)
  • typescript-estree: allow writing to deprecated node properties (#6670) (6652ebe)
  • typescript-estree: fix error handling on ImportExpression (#6587) (e8cdd5c)
  • typescript-estree: forbid override on non-constructor function/methods (#6729) (2f3638f)
  • typescript-estree: wrap import = declaration in an export node (#5885) (1c3f470), closes #5036 #5834 #5882 #5864 #3076 #5834 #5882 #5864 #5889 #5834 #5882 #5864 #5883 #4863 #5381 #5256
  • update exports field in package.json files (#6550) (53776c2)
  • utils: removed TRuleListener generic from the createRule (#5036) (361f8bc), closes #5834 #5882 #5864

chore

Features

BREAKING CHANGES

  • Removes experimental-utils - we will no longer update this package and it will be forever frozen at v5.x
  • eslint-plugin: Adds an additional class of checks to the rule
  • drop support for ESLint v6
  • drops support for node v17
  • utils: Removes meta.docs.suggestion property
  • Bumps the minimum supported range and removes handling for old versions
  • drops support for node v12

You can read about our versioning strategy and releases on our website.

Readme

Source

@typescript-eslint/visitor-keys

Visitor keys used to help traverse the TypeScript-ESTree AST.

āœ‹ Internal Package

This is an internal package to the typescript-eslint monorepo. You likely don't want to use it directly.

šŸ‘‰ See https://typescript-eslint.io for docs on typescript-eslint.

Keywords

FAQs

Last updated on 10 Jul 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc