Navigation Menu

Skip to content

Commit

Permalink
Update: deprecate valid-jsdoc and require-jsdoc (#11145)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
not-an-aardvark committed Dec 7, 2018
1 parent 60dfb6c commit 4490d7a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
5 changes: 4 additions & 1 deletion lib/rules/require-jsdoc.js
Expand Up @@ -43,7 +43,10 @@ module.exports = {
},
additionalProperties: false
}
]
],

deprecated: true,
replacedBy: []
},

create(context) {
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/valid-jsdoc.js
Expand Up @@ -64,7 +64,10 @@ module.exports = {
}
],

fixable: "code"
fixable: "code",

deprecated: true,
replacedBy: []
},

create(context) {
Expand Down
1 change: 1 addition & 0 deletions lib/util/source-code.js
Expand Up @@ -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) {

Expand Down
12 changes: 9 additions & 3 deletions tests/lib/cli-engine.js
Expand Up @@ -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"
});

Expand Down Expand Up @@ -1530,15 +1531,19 @@ describe("CLIEngine", () => {

assert.deepStrictEqual(
report.usedDeprecatedRules,
[{ ruleId: "indent-legacy", replacedBy: ["indent"] }]
[
{ ruleId: "indent-legacy", replacedBy: ["indent"] },
{ ruleId: "require-jsdoc", replacedBy: [] },
{ ruleId: "valid-jsdoc", replacedBy: [] }
]
);
});

it("should not warn when deprecated rules are not configured", () => {
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"]);
Expand All @@ -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"]);
Expand Down

0 comments on commit 4490d7a

Please sign in to comment.