Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@typescript-eslint/utils
Advanced tools
The @typescript-eslint/utils package provides utility functions and types that are used across the TypeScript ESLint project. It's designed to help with the development of ESLint rules, parsers, and plugins by providing a consistent set of tools for working with TypeScript code. This package is particularly useful for those creating custom ESLint rules or integrating TypeScript more deeply into their ESLint configurations.
AST Utilities
AST Utilities provide functions to work with Abstract Syntax Tree (AST) nodes. These utilities can help in identifying node types, such as checking if a node is an identifier or a literal, which is useful when writing custom ESLint rules.
import { ASTUtils } from '@typescript-eslint/utils';
const { isIdentifier, isLiteral } = ASTUtils;
Type Checking
This feature allows rule developers to access TypeScript's type checker, enabling them to perform more sophisticated analyses, such as type inference or type checking, within their custom ESLint rules.
import { ESLintUtils } from '@typescript-eslint/utils';
const { getParserServices } = ESLintUtils;
const parserServices = getParserServices(context);
const checker = parserServices.program.getTypeChecker();
ESLint Rule Creation
Provides a utility for creating ESLint rules with a consistent structure and metadata. This is particularly useful for developers creating custom rules for projects that use TypeScript.
import { ESLintUtils } from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(name => `https://example.com/rule/${name}`);
const myRule = createRule({
name: 'my-custom-rule',
meta: { /* rule metadata */ },
defaultOptions: [],
create(context) { /* rule implementation */ }
});
This package provides a set of ESLint rules that help ensure proper import/export syntax and order. While it focuses on module syntax, it doesn't offer TypeScript-specific utilities or type checking capabilities like @typescript-eslint/utils.
Similar to @typescript-eslint/utils, eslint-utils provides utility functions for working with ESLint and AST nodes. However, it is not specifically tailored for TypeScript, lacking direct integrations with TypeScript's type system and parser.
Utilities for working with TypeScript + ESLint together.
Name | Description |
---|---|
ASTUtils | Tools for operating on the ESTree AST. Also includes the eslint-utils package, correctly typed to work with the types found in TSESTree |
ESLintUtils | Tools for creating ESLint rules with TypeScript. |
JSONSchema | Types from the @types/json-schema package, re-exported to save you having to manually import them. Also ensures you're using the same version of the types as this package. |
TSESLint | Types for ESLint, correctly typed to work with the types found in TSESTree . |
TSESLintScope | The eslint-scope package, correctly typed to work with the types found in both TSESTree and TSESLint |
TSESTree | Types for the TypeScript flavor of ESTree created by @typescript-eslint/typescript-estree . |
AST_NODE_TYPES | An enum with the names of every single node found in TSESTree . |
AST_TOKEN_TYPES | An enum with the names of every single token found in TSESTree . |
ParserServices | Typing for the parser services provided when parsing a file using @typescript-eslint/typescript-estree . |
5.26.0 (2022-05-23)
SpreadElement
to ArrayExpression.elements
(#5025) (9f3121b)delimiter: 'none'
(#5029) (ed7b5f6)delimiter: 'none'
(#5023) (9e97a11)FAQs
Utilities for working with TypeScript + ESLint together
The npm package @typescript-eslint/utils receives a total of 26,540,723 weekly downloads. As such, @typescript-eslint/utils popularity was classified as popular.
We found that @typescript-eslint/utils 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.