Socket
Socket
Sign inDemoInstall

eslint-plugin-deprecation

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-deprecation - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

dist/eslint-plugin-deprecation-3.0.0.tgz

6

dist/index.d.ts
import * as rules from './rules';
import * as configs from './configs';
export { configs, rules };
declare const meta: {
name: string;
version: string;
};
export { configs, meta, rules };

5

dist/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.rules = exports.configs = void 0;
exports.rules = exports.meta = exports.configs = void 0;
const rules = require("./rules");

@@ -8,2 +8,5 @@ exports.rules = rules;

exports.configs = configs;
const packageData = require('../package.json');
const meta = { name: packageData.name, version: packageData.version };
exports.meta = meta;
//# sourceMappingURL=index.js.map

@@ -16,6 +16,6 @@ /**

*/
import { TSESLint } from '@typescript-eslint/utils';
import { ESLintUtils } from '@typescript-eslint/utils';
export type Options = unknown[];
export type MessageIds = 'deprecated';
declare const _default: TSESLint.RuleModule<"deprecated", Options, TSESLint.RuleListener>;
declare const _default: ESLintUtils.RuleModule<"deprecated", Options, ESLintUtils.RuleListener>;
export default _default;

@@ -19,3 +19,3 @@ "use strict";

const utils_1 = require("@typescript-eslint/utils");
const tsutils_1 = require("tsutils");
const ts_api_utils_1 = require("ts-api-utils");
const ts = require("typescript");

@@ -201,3 +201,3 @@ const stringifyJSDocTagInfoText_1 = require("../utils/stringifyJSDocTagInfoText");

parent.name === tsId &&
(0, tsutils_1.isReassignmentTarget)(tsId))) {
isReassignmentTarget(tsId))) {
try {

@@ -269,2 +269,5 @@ symbol = tc.getPropertySymbolOfDestructuringAssignment(tsId);

}
function isReassignmentTarget(node) {
return ((0, ts_api_utils_1.getAccessKind)(node) & ts_api_utils_1.AccessKind.Write) !== 0;
}
function isPropertyAssignment(node) {

@@ -271,0 +274,0 @@ return node.kind === ts.SyntaxKind.PropertyAssignment;

{
"name": "eslint-plugin-deprecation",
"version": "2.0.0",
"version": "3.0.0",
"description": "ESLint rule that reports usage of deprecated code",

@@ -27,8 +27,8 @@ "author": "Alex Malkevich <malkevich.alex@gmail.com>",

"dependencies": {
"@typescript-eslint/utils": "^6.0.0",
"@typescript-eslint/utils": "^7.0.0",
"tslib": "^2.3.1",
"tsutils": "^3.21.0"
"ts-api-utils": "^1.3.0"
},
"peerDependencies": {
"eslint": "^7.0.0 || ^8.0.0",
"eslint": "^8.0.0",
"typescript": "^4.2.4 || ^5.0.0"

@@ -47,5 +47,5 @@ },

"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/rule-tester": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/rule-tester": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"commitizen": "^4.2.4",

@@ -52,0 +52,0 @@ "cz-conventional-changelog": "^3.3.0",

@@ -12,3 +12,3 @@ # eslint-plugin-deprecation

> An [ESLint](https://eslint.org/) rule that reports usage of deprecated code.
> An [ESLint](https://eslint.org/) plugin with rules reporting usage of deprecated code

@@ -83,4 +83,48 @@ ## Prerequisites

## Rules
### Disallow usage of deprecated APIs (`deprecation/deprecation`)
Reports usage of any code marked with a [`@deprecated` JSDoc tag](https://jsdoc.app/tags-deprecated.html).
For example, this includes browser APIs, Node.js APIs, library APIs and any other code that is marked with this tag.
#### Rule Details
Examples of **incorrect** code for this rule:
```ts
import { parse } from 'node:url';
import cheerio from 'cheerio';
// Node.js API
const url = parse('/foo'); // ❌ 'parse' is deprecated. Use the WHATWG URL API instead. eslint(deprecation/deprecation)
// Browser API
console.log(event?.bubbles); // ❌ 'event' is deprecated. [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/event) eslint(deprecation/deprecation)
// Deprecated library API
cheerio('<h2 class="title">Hello world</h2>'); // ❌ 'cheerio' is deprecated. Use the function returned by `load` instead. eslint(deprecation/deprecation)
```
Examples of **correct** code for this rule:
```ts
import { load } from 'cheerio';
import { ChangeEvent } from 'react';
// Node.js API
const url2 = new URL('/foo', 'http://www.example.com'); // ✅ Modern Node.js API, uses `new URL()`
// Browser API
function onClick(event: ChangeEvent<HTMLInputElement>) {
console.log(event.bubbles); // ✅ Modern browser API, does not use global
}
// Library API
load('<h2 class="title">Hello world</h2>'); // ✅ Allowed library API, uses named `load` import
```
## Credits
This rule was originally ported from the [SonarJS repository](https://github.com/SonarSource/SonarJS).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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