eslint-plugin-deprecation
Advanced tools
Comparing version 1.4.1 to 1.5.0
import * as rules from './rules'; | ||
export { rules }; | ||
import * as configs from './configs'; | ||
export { configs, rules }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.rules = void 0; | ||
exports.rules = exports.configs = void 0; | ||
const rules = require("./rules"); | ||
exports.rules = rules; | ||
const configs = require("./configs"); | ||
exports.configs = configs; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "eslint-plugin-deprecation", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "ESLint rule that reports usage of deprecated code", | ||
@@ -5,0 +5,0 @@ "author": "Alex Malkevich <malkevich.alex@gmail.com>", |
@@ -9,18 +9,24 @@ # eslint-plugin-deprecation | ||
![Size](https://badgen.net/bundlephobia/minzip/eslint-plugin-deprecation) | ||
[![Licence](https://img.shields.io/npm/l/eslint-plugin-deprecation.svg?maxAge=2592000)](https://github.com/gund/eslint-plugin-deprecation/blob/master/LICENSE) | ||
[![License](https://img.shields.io/npm/l/eslint-plugin-deprecation.svg?maxAge=2592000)](https://github.com/gund/eslint-plugin-deprecation/blob/master/LICENSE) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
> ESLint rule that reports usage of deprecated code | ||
> An [ESLint](https://eslint.org/) rule that reports usage of deprecated code. | ||
## Prerequisites | ||
This plugin only works with `@typescript-eslint/parser`. | ||
If you already use [TypeScript](https://www.typescriptlang.org/) and one or more rules from the [`typescript-eslint`](https://typescript-eslint.io/) 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.) | ||
Which means that you should install dev deps: | ||
Otherwise, in order for you to use this plugin, you must also install the following dependencies: | ||
- `typescript` | ||
- `@typescript-eslint/parser` | ||
- `typescript` | ||
Then configure ESLint to parse TypeScript and include type information: | ||
For example, if you use the `npm` package manager, then you would run the following command in the root of your project: | ||
```sh | ||
npm install --save-dev typescript @typescript-eslint/parser | ||
``` | ||
Next, you must configure ESLint to parse TypeScript and include type information: | ||
```jsonc | ||
@@ -32,3 +38,3 @@ { | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" // <-- Point to your project's tsconfig.json or create new one | ||
"project": "./tsconfig.json" // <-- Point to your project's "tsconfig.json" or create a new one. | ||
} | ||
@@ -40,26 +46,42 @@ } | ||
Install the plugin | ||
For example, if you use the `npm` package manager, then you would run the following command in the root of your project: | ||
```sh | ||
npm install --save-dev eslint-plugin-deprecation | ||
``` | ||
npm i -D eslint-plugin-deprecation | ||
``` | ||
## Setup | ||
Now add deprecation plugin and rule to your `.eslintrc`: | ||
### Using the `recommended` Config | ||
The easiest way to use this plugin is to extend from the `recommended` config, like this: | ||
```jsonc | ||
{ | ||
"plugins": ["deprecation", ...], | ||
"extends": [ | ||
"plugin:deprecation/recommended", | ||
], | ||
} | ||
``` | ||
The `recommended` config will enable the plugin and enable the 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: | ||
```jsonc | ||
{ | ||
"plugins": [ | ||
"deprecation", | ||
], | ||
"rules": { | ||
"deprecation/deprecation": "warn", // or "error" to have stricter rule | ||
... | ||
} | ||
"deprecation/deprecation": "error", | ||
}, | ||
} | ||
``` | ||
Now eslint will report all deprecated code that you use! | ||
## Credits | ||
--- | ||
_NOTE:_ This rule was ported from https://github.com/SonarSource/SonarJS repository. | ||
This rule was originally ported from [SonarJS repository](https://github.com/SonarSource/SonarJS). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47632
22
358
85