npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eslint-plugin-deprecated

v0.3.0

Published

ESLint deprecation rules plugin, based on API blacklist.

Downloads

296

Readme

eslint-plugin-deprecated

npm version Downloads/month Build Status Coverage Status Dependency Status

ESLint ~~@deprecation~~ rules plugin, based on API blacklist.

:sparkles: Features

  • [x] Modules and globals API options support. @v0.0.1
  • [x] MessageTemplate option supports. @v0.2.0
  • [x] Specific messageTemplates option (noReplacedBy, noSince and either) supports. @v0.3.0 (Breaking Change involved: Do not support MessageTemplate option any more, use messageTemplates instead.)
  • [ ] File level deprecation. @next-version

💿 Installation

$ npm install --save-dev eslint eslint-plugin-deprecated
  • Requires Node.js >=6.0.0

🔧 Configs

package.json (An example)

{
    "name": "your-module",
    "version": "1.0.0",
    "engines": {
        "node": ">=6.0.0"
    }
}

.eslintrc.json (An example)

{
  "plugins": [
    "deprecated"
  ],
  "rules": {
    "deprecated/no-deprecated-api": ["error", {
      "modules": {},
      "globals": {
        "eval": {
          "[CALL]": {
            "replacedBy": "DO NOT use it.",
            "since": "1.0.0"
          }
        },
        "name": {
          "[READ]": {
            "replacedBy": "Use 'window.name' instead.",
            "since": "1.2.0"
          }
        },
        "Function": {
          "[CONSSTRUCT]": {
            "replacedBy": "DO NOT use it.",
            "since": "1.0.3"
          }
        }
      },
      "messageTemplate": {
        "normal": "{{name}} was DEPRECATED since {{version}\n{{replace}}.",
        "noReplacedBy": "{{name}} was DEPRECATED since {{version}\nNo plans to support.",
        "noSince": "{{name}} was DEPRECATED\n{{replace}}.",
        "neither": "{{name}} was DEPRECATED.",
      }
    }]
  }
}

Examples of :-1: incorrect code for this rule:

// example.js
(function() {
  name;
})();
eval('1 + 2');
new Function('a', 'b', 'return a + b')(1, 2);

ESLint output:

path/to/example.js
  2:3  error  'name' was DEPRECATED
Use 'window.name' instead  deprecated/no-deprecated-api
  4:1  error  'eval()' was DEPRECATED
DO NOT use it            deprecated/no-deprecated-api
  5:1  error  'new Function()' was DEPRECATED
DO NOT use it    deprecated/no-deprecated-api

📖 Rules

  • ⭐️ - the mark of recommended rules.
  • ✒️ - the mark of fixable rules.

Best Practices

| Rule ID | Description | | |:--------|:------------|:--:| | no-deprecated-api | disallow deprecated APIs | ⭐️ |

👫 Known Limitations

This rule cannot report the following cases:

non-static properties

types of arguments

  • fs
    • fs.truncate() and fs.truncateSync() usage with a file descriptor has been deprecated.
  • url
    • url.format() with legacy urlObject has been deprecated.

dynamic things

require(foo).aDeprecatedProperty;
require("http")[A_DEPRECATED_PROPERTY]();

assignments to properties

var obj = {
    Buffer: require("buffer").Buffer
};
new obj.Buffer(); /* missing. */
var obj = {};
obj.Buffer = require("buffer").Buffer
new obj.Buffer(); /* missing. */

giving arguments

(function(Buffer) {
    new Buffer(); /* missing. */
})(require("buffer").Buffer);

reassignments

var Buffer = require("buffer").Buffer;
Buffer = require("another-buffer");
new Buffer(); /*ERROR: 'buffer.Buffer' constructor was deprecated.*/

🚥 Semantic Versioning Policy

eslint-plugin-deprecated follows semantic versioning and ESLint's Semantic Versioning Policy.

  • Patch release (intended to not break your lint build)
    • A bug fix in a rule that results in it reporting fewer errors.
    • Improvements to documentation.
    • Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage.
    • Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone).
  • Minor release (might break your lint build)
    • A bug fix in a rule that results in it reporting more errors.
    • A new rule is created.
    • A new option to an existing rule is created.
    • An existing rule is deprecated.
  • Major release (likely to break your lint build)
    • A support for old Node version is dropped.
    • A support for old ESLint version is dropped.
    • An existing rule is changed in it reporting more errors.
    • An existing rule is removed.
    • An existing option of a rule is removed.
    • An existing config is updated.

📰 Changelog

💎 Contributing

Welcome contributing!

Please use GitHub's Issues/PRs.

Development Tools

  • npm test runs tests and measures coverage.
  • npm run coverage shows the coverage result of npm test command.
  • npm run clean removes the coverage result of npm test command.