1. eslint-plugin-deprecation
ESLint rule that reports usage of deprecated code
eslint-plugin-deprecation
Package: eslint-plugin-deprecation
Created by: gund
Last modified: Wed, 13 Sep 2023 13:02:00 GMT
Version: 2.0.0
License: LGPL-3.0-or-later
Downloads: 2,135,658
Repository: https://github.com/gund/eslint-plugin-deprecation

Install

npm install eslint-plugin-deprecation
yarn add eslint-plugin-deprecation

eslint-plugin-deprecation

Test Workflow
Release Workflow
Maintainability
Npm
Npm Downloads
Size
License
semantic-release

An ESLint rule that reports usage of deprecated code.

Prerequisites

If you already use TypeScript and one or more rules from the typescript-eslint plugin, then eslint-plugin-deprecation will work out of the box without any additional dependencies or special configuration specified in this section. (This is because @typescript-eslint/plugin automatically contains @typescript-eslint/parser and your ESLint should already be configured with the parserOptions to work properly with TypeScript.)

Otherwise, in order for you to use this plugin, you must also install the following dependencies:

  • typescript
  • @typescript-eslint/parser

For example, if you use the npm package manager, then you would run the following command in the root of your project:

 npm install --save-dev typescript @typescript-eslint/parser

Next, you must configure ESLint to parse TypeScript and include type information:

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 2020,
    "sourceType": "module",
    "project": "./tsconfig.json" // <-- Point to your project's "tsconfig.json" or create a new one.
  }
}

Install

For example, if you use the npm package manager, then you would run the following command in the root of your project:

 npm install --save-dev eslint-plugin-deprecation

Setup

Using the recommended Config

The easiest way to use this plugin is to extend from the recommended config, like this:

{
  "extends": [
    "plugin:deprecation/recommended",
  ],
}

The recommended config will enable the plugin and enable the deprecation/deprecation rule with a value of error.

Manually Enable the Plugin and Rule

If you don't want to use the recommended config for some reason, you can accomplish the same thing by specifying the following config:

{
  "plugins": [
    "deprecation",
  ],

  "rules": {
    "deprecation/deprecation": "error",
  },
}

Credits

This rule was originally ported from the SonarJS repository.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code