Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typescript-eslint

Package Overview
Dependencies
Maintainers
1
Versions
659
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-eslint

Tooling which enables you to use TypeScript with ESLint

  • 8.16.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.8M
increased by12.13%
Maintainers
1
Weekly downloads
 
Created

What is typescript-eslint?

typescript-eslint is a set of tools that allows you to use ESLint to lint TypeScript code. It provides a parser that can read TypeScript code and a set of rules that are specific to TypeScript, enabling you to enforce coding standards and catch potential issues in your TypeScript projects.

What are typescript-eslint's main functionalities?

Linting TypeScript Code

This configuration file sets up ESLint to use the TypeScript parser and includes recommended rules from the @typescript-eslint plugin. It also adds a custom rule to error on unused variables.

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

Type-Aware Rules

This configuration enables type-aware linting rules by specifying a TypeScript project. The rule '@typescript-eslint/no-floating-promises' ensures that promises are properly handled.

module.exports = {
  parser: '@typescript-eslint/parser',
  parserOptions: {
    project: './tsconfig.json'
  },
  plugins: ['@typescript-eslint'],
  extends: [
    'plugin:@typescript-eslint/recommended-requiring-type-checking'
  ],
  rules: {
    '@typescript-eslint/no-floating-promises': 'error'
  }
};

Custom Rules

This configuration enforces explicit return types on functions, but allows expressions to omit the return type. This helps in maintaining clear and predictable function signatures.

module.exports = {
  parser: '@typescript-eslint/parser',
  plugins: ['@typescript-eslint'],
  rules: {
    '@typescript-eslint/explicit-function-return-type': ['error', {
      allowExpressions: true
    }]
  }
};

Other packages similar to typescript-eslint

Keywords

FAQs

Package last updated on 25 Nov 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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc