Socket
Socket
Sign inDemoInstall

@typescript-eslint/parser

Package Overview
Dependencies
5
Maintainers
2
Versions
3645
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
Maintainers
2
Created

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.12.0 (2024-06-03)

šŸš€ Features

  • eslint-plugin: [no-useless-template-literals] rename to no-useless-template-expression (deprecate no-useless-template-literals) (#8821)
  • eslint-plugin: [no-floating-promises] add option 'allowForKnownSafePromises' (#9186)
  • rule-tester: check for parsing errors in suggestion fixes (#9052)
  • rule-tester: port checkDuplicateTestCases from ESLint (#9026)

šŸ©¹ Fixes

  • no-useless-template-expression -> no-unnecessary-template-expression (#9174)
  • eslint-plugin: [no-unnecessary-type-assertion] combine template literal check with const variable check (#8820)
  • eslint-plugin: [dot-notation] fix false positive when accessing private/protected property with optional chaining (#8851)
  • eslint-plugin: [explicit-member-accessibility] refine report locations (#8869)
  • eslint-plugin: [no-unnecessary-type-assertion] declares are always defined, so always check declares (#8901)
  • eslint-plugin: [prefer-literal-enum-member] allow using member it self on allowBitwiseExpressions (#9114)
  • eslint-plugin: [return-await] clean up in-try-catch detection and make autofixes safe (#9031)
  • eslint-plugin: [member-ordering] also TSMethodSignature can be get/set (#9193)
  • types: correct typing ParserOptions (#9202)

ā¤ļø Thank You

  • Abraham Guo
  • Han Yeong-woo @nix6839
  • Joshua Chen
  • Kim Sang Du @developer-bandi
  • Kirk Waiblinger
  • 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 03 Jun 2024

Did you know?

Socket

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc