Socket
Socket
Sign inDemoInstall

@typescript-eslint/utils

Package Overview
Dependencies
124
Maintainers
2
Versions
1712
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @typescript-eslint/utils

Utilities for working with TypeScript + ESLint together


Version published
Weekly downloads
34M
decreased by-0.32%
Maintainers
2
Install size
4.02 MB
Created
Weekly downloads
 

Package description

What is @typescript-eslint/utils?

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.

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

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 */ }
});

Other packages similar to @typescript-eslint/utils

Changelog

Source

7.7.1 (2024-04-22)

🩹 Fixes

  • eslint-plugin: [no-unsafe-assignment] handle shorthand property assignment (#8800)
  • eslint-plugin: [explicit-function-return-type] fix checking wrong ancestor's return type (#8809)
  • eslint-plugin: [prefer-optional-chain] only look at left operand for requireNullish (#8559)
  • eslint-plugin: [no-for-in-array] refine report location (#8874)
  • eslint-plugin: [no-unnecessary-type-assertion] allow non-null assertion for void type (#8912)

❤️ Thank You

  • Abraham Guo
  • Kirk Waiblinger @kirkwaiblinger
  • YeonJuan @yeonjuan

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

Readme

Source

@typescript-eslint/utils

Utilities for working with TypeScript + ESLint together.

NPM Version NPM Downloads

👉 See https://typescript-eslint.io/packages/utils for documentation on this package.

See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code.

Keywords

FAQs

Last updated on 22 Apr 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • 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