From a63c90d89a8becb711ef4189a11d820d6a6479ef Mon Sep 17 00:00:00 2001 From: error-four-o-four Date: Sun, 8 Jun 2025 21:09:19 +0200 Subject: [PATCH] chore: adopt `deprecated: DeprecatedInfo` meta rule option --- docs/rules/shebang.md | 2 +- lib/rules/no-hide-core-modules.js | 6 +++++- lib/rules/shebang.js | 17 +++++++++++++++-- tests/lib/rules/shebang.js | 4 ++-- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/docs/rules/shebang.md b/docs/rules/shebang.md index 6623a354..efd25c64 100644 --- a/docs/rules/shebang.md +++ b/docs/rules/shebang.md @@ -1,6 +1,6 @@ # Require correct usage of hashbang (`n/shebang`) -❌ This rule is deprecated. It was replaced by [`n/hashbang`](hashbang.md). +❌ This rule is deprecated. 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). diff --git a/lib/rules/no-hide-core-modules.js b/lib/rules/no-hide-core-modules.js index f5e43514..52382de6 100644 --- a/lib/rules/no-hide-core-modules.js +++ b/lib/rules/no-hide-core-modules.js @@ -69,7 +69,11 @@ module.exports = { url: "https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-hide-core-modules.md", }, type: "problem", - deprecated: true, + deprecated: { + deprecatedSince: "4.2.0", + message: "This rule was based on an invalid assumption.", + url: "https://github.com/mysticatea/eslint-plugin-node/issues/69", + }, fixable: null, schema: [ { diff --git a/lib/rules/shebang.js b/lib/rules/shebang.js index 585947be..33235599 100644 --- a/lib/rules/shebang.js +++ b/lib/rules/shebang.js @@ -7,11 +7,24 @@ const hashbang = require("./hashbang.js") +/** @type {import('./rule-module').RuleModule<{}>} */ module.exports = { meta: { ...hashbang.meta, - deprecated: true, - replacedBy: ["n/hashbang"], + deprecated: { + deprecatedSince: "17.0.0", + message: + "This rule was deprecated in eslint-plugin-n v17.0.0. Please use 'n/hashbang'", + url: "https://github.com/eslint-community/eslint-plugin-n/issues/196", + replacedBy: [ + { + rule: { + name: "n/hashbang", + url: hashbang.meta?.docs?.url, + }, + }, + ], + }, docs: { ...hashbang.meta?.docs, recommended: false }, }, create: hashbang.create, diff --git a/tests/lib/rules/shebang.js b/tests/lib/rules/shebang.js index 7e096606..d35e5671 100644 --- a/tests/lib/rules/shebang.js +++ b/tests/lib/rules/shebang.js @@ -5,7 +5,7 @@ it("should export shebang as alias ", () => { const shebang = require("../../../lib/rules/shebang.js") const hashbang = require("../../../lib/rules/hashbang.js") - assert.strictEqual(shebang.meta.deprecated, true) - assert.deepStrictEqual(shebang.meta.replacedBy, ["n/hashbang"]) + assert.strictEqual(typeof shebang.meta.deprecated, "object") + assert.strictEqual(typeof shebang.meta.replacedBy, "undefined") assert.strictEqual(shebang.create, hashbang.create) })