Socket
Socket
Sign inDemoInstall

@typescript-eslint/parser

Package Overview
Dependencies
6
Maintainers
2
Versions
3619
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typescript-eslint/parser


Version published
Weekly downloads
33M
increased by0.83%
Maintainers
2
Install size
2.42 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

6.0.0 (2023-07-10)

Bug Fixes

  • ast-spec: remove more invalid properties (#6243) (aa20f63)
  • bumped ts-api-utils to 0.0.39 (#6497) (217c710)
  • correct handling of additionalProperties in object schemas (#6939) (489c7a5)
  • correct jest.mock path post merge (778d254)
  • correct lint error after merge (277fdb5)
  • eslint-plugin: [explicit-module-boundary-types] remove shouldTrackReferences option from schema (#5399) (6d32734)
  • eslint-plugin: allow parser@^6.0.0 (#6630) (92908bd)
  • eslint-plugin: remove valid-typeof disable in eslint-recommended (#5381) (b82df5e)
  • fix illegal decorator check (#6723) (c456f8c)
  • rename typeParameters to typeArguments where needed (#5384) (08d757b)
  • replace tsutils with ts-api-tools (#6428) (79327b4)
  • type-utils: checking of type aliases' type names by typeMatchesSpecifier (#6820) (7ca2c90)
  • type-utils: file variant of TypeOrValueSpecifier uses canonical filenames instead of lowercasing (#6781) (5095d05)
  • type-utils: fixed TypeOrValueSpecifier not accounting for scoped DT packages (#6780) (3350940)
  • type-utils: treat intrinsic types as if they are from lib and never match error types (#6869) (ecb57de)
  • typescript-estree: account for namespace nesting in AST conversion (#6272) (09e3877)
  • typescript-estree: allow writing to deprecated node properties (#6670) (6652ebe)
  • typescript-estree: fix error handling on ImportExpression (#6587) (e8cdd5c)
  • typescript-estree: forbid override on non-constructor function/methods (#6729) (2f3638f)
  • typescript-estree: wrap import = declaration in an export node (#5885) (1c3f470), closes #5036 #5834 #5882 #5864 #3076 #5834 #5882 #5864 #5889 #5834 #5882 #5864 #5883 #4863 #5381 #5256
  • update exports field in package.json files (#6550) (53776c2)
  • utils: removed TRuleListener generic from the createRule (#5036) (361f8bc), closes #5834 #5882 #5864

chore

Features

BREAKING CHANGES

  • Removes experimental-utils - we will no longer update this package and it will be forever frozen at v5.x
  • eslint-plugin: Adds an additional class of checks to the rule
  • drop support for ESLint v6
  • drops support for node v17
  • utils: Removes meta.docs.suggestion property
  • Bumps the minimum supported range and removes handling for old versions
  • drops support for node v12

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 10 Jul 2023

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