diff --git a/rules/core/possible-errors.js b/rules/core/possible-errors.js index 1c9eb3c7..45b32419 100644 --- a/rules/core/possible-errors.js +++ b/rules/core/possible-errors.js @@ -37,7 +37,6 @@ module.exports = { "no-unsafe-negation": "error", "require-atomic-updates": "error", "use-isnan": "error", - "valid-jsdoc": "off", "valid-typeof": "error", }, }; diff --git a/rules/core/styles.js b/rules/core/styles.js index 34162fb4..61b254ca 100644 --- a/rules/core/styles.js +++ b/rules/core/styles.js @@ -57,7 +57,6 @@ module.exports = { "padding-line-between-statements": "off", "prefer-exponentiation-operator": "warn", "prefer-object-spread": "error", - "require-jsdoc": "off", "sort-keys": "off", "sort-vars": "off", "spaced-comment": "error", diff --git a/rules/core/variables.js b/rules/core/variables.js index 556d7763..b8b72d1a 100644 --- a/rules/core/variables.js +++ b/rules/core/variables.js @@ -3,7 +3,6 @@ const restrictedGlobals = require("eslint-restricted-globals"); module.exports = { rules: { "init-declarations": "off", - "no-catch-shadow": "error", "no-delete-var": "error", "no-label-var": "error", "no-restricted-globals": ["error", "isFinite", "isNaN", "alert"].concat(restrictedGlobals), diff --git a/test/check-rules.test.js b/test/check-rules.test.js new file mode 100644 index 00000000..1d37c850 --- /dev/null +++ b/test/check-rules.test.js @@ -0,0 +1,48 @@ +const { EOL } = require("os"); +const test = require("tape"); +const { $, lintConfigFiles } = require("./helper"); + +const checkRules = (file, option, env = {}) => { + try { + $("eslint-find-rules", option, file, { env }); + } catch (err) { + const { stdout, stderr } = err; + if (typeof stdout === "string" && stdout !== "") { + process.stderr.write(stdout + EOL); + } + if (typeof stderr === "string" && stderr !== "") { + process.stderr.write(stderr + EOL); + } + throw err; + } +}; + +test("no unused rules", t => { + lintConfigFiles.forEach(file => { + checkRules(file, "--unused"); + t.pass(file); + }); + t.end(); +}); + +test("deprecated rules", t => { + lintConfigFiles.forEach(file => { + try { + checkRules(file, "--deprecated", { ESLINT_CONFIG_PRETTIER_NO_DEPRECATED: "true" }); + } catch (err) { + if (typeof err.stdout === "string" && err.stdout.includes("jsx-a11y/label-has-for")) { + [ + "", + "NOTE: `jsx-a11y/label-has-for` rule is deprecated but included in the recommended config.", + "", + "See https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md", + "", + ].forEach(line => process.stdout.write(line + EOL)); + } else { + throw err; + } + } + t.pass(file); + }); + t.end(); +}); diff --git a/test/helper.js b/test/helper.js index 1a3b8e73..ba6855a9 100644 --- a/test/helper.js +++ b/test/helper.js @@ -13,9 +13,12 @@ const log = msg => { } }; +// eslint-disable-next-line max-statements const $ = (cmd, ...args) => { - log(`> ${cmd} '${args.join("' '")}'`); - const { stdout } = execa.sync(cmd, args); + const cmdArgs = args.filter(arg => typeof arg === "string"); + const options = args.find(arg => typeof arg === "object" && arg !== null) || {}; + log(`> ${cmd} '${cmdArgs.join("' '")}'`); + const { stdout } = execa.sync(cmd, cmdArgs, options); const maxLines = 20; const lines = stdout.split(EOL); if (lines.length < maxLines) { diff --git a/test/no-unused-rules.test.js b/test/no-unused-rules.test.js deleted file mode 100644 index a06ea0db..00000000 --- a/test/no-unused-rules.test.js +++ /dev/null @@ -1,10 +0,0 @@ -const test = require("tape"); -const { $, lintConfigFiles } = require("./helper"); - -test("no unused rules", t => { - lintConfigFiles.forEach(file => { - $("eslint-find-rules", "--unused", file); - t.pass(file); - }); - t.end(); -});