Socket
Socket
Sign inDemoInstall

@typescript-eslint/parser

Package Overview
Dependencies
122
Maintainers
2
Versions
3427
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @typescript-eslint/parser

An ESLint custom parser which leverages TypeScript ESTree


Version published
Weekly downloads
31M
decreased by-0.96%
Maintainers
2
Install size
3.30 MB
Created
Weekly downloads
 

Package description

What is @typescript-eslint/parser?

The @typescript-eslint/parser is an ESLint parser that allows for the analysis and linting of TypeScript code. It is part of the TypeScript-ESLint project, which aims to bring ESLint's powerful static analysis capabilities to TypeScript codebases. The parser converts TypeScript source code into an ESTree-compatible form so that it can be used by ESLint for linting and other code analysis tasks.

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

Parsing TypeScript code

This feature allows the parser to read TypeScript files and produce an abstract syntax tree (AST) that is compatible with ESLint, enabling it to understand and lint TypeScript syntax.

const { ESLint } = require('eslint');

async function main() {
  const eslint = new ESLint({
    parser: '@typescript-eslint/parser',
    parserOptions: {
      ecmaVersion: 2020,
      sourceType: 'module',
      project: './tsconfig.json'
    }
  });

  const results = await eslint.lintFiles(['src/**/*.ts']);
  // Handle the results
}

main();

Integration with ESLint rules

The parser can be used in conjunction with ESLint rules, including those specifically designed for TypeScript, to enforce code quality and style guidelines.

module.exports = {
  parser: '@typescript-eslint/parser',
  extends: [
    'plugin:@typescript-eslint/recommended'
  ],
  rules: {
    '@typescript-eslint/no-unused-vars': 'error',
    '@typescript-eslint/explicit-function-return-type': 'warn'
  }
};

Other packages similar to @typescript-eslint/parser

Changelog

Source

7.4.0 (2024-03-25)

🚀 Features

  • eslint-plugin: [consistent-type-imports] ignore files with decorators, experimentalDecorators, and emitDecoratorMetadata (#8335)
  • eslint-plugin: [no-unnecessary-type-arguments] handle tagged templates (#8708)
  • eslint-plugin: deprecate no-throw-literal and add a renamed only-throw-error (#8701)

🩹 Fixes

  • eslint-plugin: [prefer-optional-chain] address multipart nullish checks false positive (#8678)
  • eslint-plugin: [prefer-optional-chain] properly disambiguate between boolean and false (#8685)
  • eslint-plugin: [no-unnecessary-type-assertion] avoid remove const casting on template literals with expressions inside (#8740)
  • typescript-eslint: declare peer dependency on utils to ensure npm correctly installs dependencies (#8738)
  • website: visual Editor is not scrolled (#8709)
  • website: make 404 page good again (#8750)

❤️ Thank You

  • Abraham Guo
  • Brad Zacher @bradzacher
  • Josh Goldberg ✨
  • Kim Sang Du @developer-bandi
  • Kirk Waiblinger @kirkwaiblinger
  • Marco Pasqualetti @marcalexiei
  • YeonJuan @yeonjuan

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

Readme

Source

@typescript-eslint/parser

An ESLint parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.

NPM Version NPM Downloads

👉 See https://typescript-eslint.io/packages/parser 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 25 Mar 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