Socket
Socket
Sign inDemoInstall

@typescript-eslint/typescript-estree

Package Overview
Dependencies
35
Maintainers
2
Versions
3410
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @typescript-eslint/typescript-estree

A parser that converts TypeScript source code into an ESTree compatible form


Version published
Weekly downloads
40M
decreased by-14.54%
Maintainers
2
Install size
1.92 MB
Created
Weekly downloads
 

Package description

What is @typescript-eslint/typescript-estree?

The @typescript-eslint/typescript-estree package is a parser that converts TypeScript source code into an ESTree-compatible form. It is primarily used in the context of ESLint to enable linting of TypeScript code by converting TypeScript syntax into a format that ESLint can understand and work with.

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

Parsing TypeScript code to ESTree

This feature allows you to parse TypeScript code and get an Abstract Syntax Tree (AST) that is compatible with ESTree. This is useful for tools that need to analyze or manipulate the syntax of TypeScript code.

const tsEStree = require('@typescript-eslint/typescript-estree');
const code = 'let x: number = 1;';
const ast = tsEStree.parse(code, { jsx: false });
console.log(ast);

Parsing TypeScript code with JSX

This feature is similar to the previous one but includes support for JSX syntax, which is commonly used in React applications. It allows the parser to correctly interpret JSX elements within TypeScript code.

const tsEStree = require('@typescript-eslint/typescript-estree');
const code = '<div>Hello, TypeScript!</div>';
const ast = tsEStree.parse(code, { jsx: true });
console.log(ast);

Parsing a file

This feature allows you to parse the contents of a TypeScript file by reading the file and then parsing the code. It is useful when you want to analyze or lint a file directly.

const tsEStree = require('@typescript-eslint/typescript-estree');
const fs = require('fs');
const filePath = './example.ts';
const code = fs.readFileSync(filePath, 'utf8');
const ast = tsEStree.parse(code, { filePath });
console.log(ast);

Other packages similar to @typescript-eslint/typescript-estree

Changelog

Source

5.59.7 (2023-05-22)

Note: Version bump only for package @typescript-eslint/typescript-eslint

Readme

Source

@typescript-eslint/typescript-estree

NPM Version NPM Downloads

Contributing

👉 See https://typescript-eslint.io/architecture/typescript-estree 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 May 2023

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