eslint-plugin-deprecation
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i eslint-plugin-deprecation

Weekly Downloads

551,726

Version

2.0.0

License

LGPL-3.0-or-later

Unpacked Size

48.1 kB

Total Files

22

Last publish

Collaborators

  • gund