eslint-plugin-deprecated
ESLint @deprecation rules plugin, based on API blacklist.
✨ Features
- Modules and globals API options support. @v0.0.1
-
MessageTemplate
option supports. @v0.2.0 - Specific
messageTemplates
option (noReplacedBy
,noSince
andeither
) supports. @v0.3.0 (Breaking Change involved: Do not supportMessageTemplate
option any more, usemessageTemplates
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)
.eslintrc.json (An example)
Examples of 👎 incorrect code for this rule:
// example.js { name;};;'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
- async_hooks
- buffer
- cluster
- crypto
- http
- net
- repl
replServer.convertToContext
(undocumented)- replServer.turnOffEditorMode
- replServer.memory
types of arguments
- fs
fs.truncate()
andfs.truncateSync()
usage with a file descriptor has been deprecated.
- url
url.format()
with legacyurlObject
has been deprecated.
dynamic things
aDeprecatedProperty;A_DEPRECATED_PROPERTY;
assignments to properties
var obj = Buffer: Buffer;; /* missing. */
var obj = {};objBuffer = Buffer; /* missing. */
giving arguments
{ ; /* missing. */}Buffer;
reassignments
var Buffer = Buffer;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 ofnpm test
command.npm run clean
removes the coverage result ofnpm test
command.