From 4490d7af529d4ecc18b6874f1d838869656da58a Mon Sep 17 00:00:00 2001 From: Teddy Katz Date: Fri, 7 Dec 2018 16:21:27 -0500 Subject: [PATCH] Update: deprecate valid-jsdoc and require-jsdoc (#11145) Also see: https://eslint.org/blog/2018/11/jsdoc-end-of-life This deprecates the `valid-jsdoc` and `require-jsdoc` rules. We are currently still using them to lint the ESLint codebase -- at some point we should probably switch to `eslint-plugin-jsdoc` to dogfood the process. --- lib/rules/require-jsdoc.js | 5 ++++- lib/rules/valid-jsdoc.js | 5 ++++- lib/util/source-code.js | 1 + tests/lib/cli-engine.js | 12 +++++++++--- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/rules/require-jsdoc.js b/lib/rules/require-jsdoc.js index 949314993b6..389bfb692bb 100644 --- a/lib/rules/require-jsdoc.js +++ b/lib/rules/require-jsdoc.js @@ -43,7 +43,10 @@ module.exports = { }, additionalProperties: false } - ] + ], + + deprecated: true, + replacedBy: [] }, create(context) { diff --git a/lib/rules/valid-jsdoc.js b/lib/rules/valid-jsdoc.js index b434491bfad..b40a20f6b4b 100644 --- a/lib/rules/valid-jsdoc.js +++ b/lib/rules/valid-jsdoc.js @@ -64,7 +64,10 @@ module.exports = { } ], - fixable: "code" + fixable: "code", + + deprecated: true, + replacedBy: [] }, create(context) { diff --git a/lib/util/source-code.js b/lib/util/source-code.js index 765fde72598..4e90ac1aa92 100644 --- a/lib/util/source-code.js +++ b/lib/util/source-code.js @@ -316,6 +316,7 @@ class SourceCode extends TokenStore { * @returns {Token|null} The Block comment token containing the JSDoc comment * for the given node or null if not found. * @public + * @deprecated */ getJSDocComment(node) { diff --git a/tests/lib/cli-engine.js b/tests/lib/cli-engine.js index d5b0b3728aa..9a57e86dfd1 100644 --- a/tests/lib/cli-engine.js +++ b/tests/lib/cli-engine.js @@ -733,6 +733,7 @@ describe("CLIEngine", () => { it("should warn when deprecated rules are found in a config", () => { engine = new CLIEngine({ cwd: originalDir, + useEslintrc: false, configFile: "tests/fixtures/cli-engine/deprecated-rule-config/.eslintrc.yml" }); @@ -1530,7 +1531,11 @@ describe("CLIEngine", () => { assert.deepStrictEqual( report.usedDeprecatedRules, - [{ ruleId: "indent-legacy", replacedBy: ["indent"] }] + [ + { ruleId: "indent-legacy", replacedBy: ["indent"] }, + { ruleId: "require-jsdoc", replacedBy: [] }, + { ruleId: "valid-jsdoc", replacedBy: [] } + ] ); }); @@ -1538,7 +1543,7 @@ describe("CLIEngine", () => { engine = new CLIEngine({ cwd: originalDir, configFile: ".eslintrc.js", - rules: { indent: 1 } + rules: { indent: 1, "valid-jsdoc": 0, "require-jsdoc": 0 } }); const report = engine.executeOnFiles(["lib/cli*.js"]); @@ -1549,7 +1554,8 @@ describe("CLIEngine", () => { it("should warn when deprecated rules are found in a config", () => { engine = new CLIEngine({ cwd: originalDir, - configFile: "tests/fixtures/cli-engine/deprecated-rule-config/.eslintrc.yml" + configFile: "tests/fixtures/cli-engine/deprecated-rule-config/.eslintrc.yml", + useEslintrc: false }); const report = engine.executeOnFiles(["lib/cli*.js"]);