Socket
Socket
Sign inDemoInstall

@typescript-eslint/typescript-estree

Package Overview
Dependencies
35
Maintainers
2
Versions
3467
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
Maintainers
2
Install size
2.68 MB
Created

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

7.9.0 (2024-05-13)

🚀 Features

  • rule-tester: check for missing placeholder data in the message (#9039)

🩹 Fixes

  • do not pass tsconfig canonical file name to typescript API to get program details for config file (#9042)
  • eslint-plugin: [explicit-function-return-types] fix false positive on default parameters (#9045)

❤️ Thank You

  • Kirk Waiblinger
  • Sheetal Nandi
  • Vinccool96

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

Readme

Source

@typescript-eslint/typescript-estree

A parser that produces an ESTree-compatible AST for TypeScript code.

NPM Version NPM Downloads

Contributing

👉 See https://typescript-eslint.io/packages/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 13 May 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