Skip to content

chore: adopt deprecated: DeprecatedInfo meta rule option #446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/rules/shebang.md
Original file line number Diff line number Diff line change
@@ -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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just hold it -- wait for it to be supported in `eslint-doc-generator'.


🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
6 changes: 5 additions & 1 deletion lib/rules/no-hide-core-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
17 changes: 15 additions & 2 deletions lib/rules/shebang.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/rules/shebang.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})