From 163d6494ba8d06cb3d264ea2d63ca1b7b2521aea Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Mon, 15 Jun 2020 14:21:58 +0100 Subject: [PATCH] Add meta.docs.description to all rules --- lib/rules/handle-done-callback.js | 5 ++++- lib/rules/max-top-level-suites.js | 3 +++ lib/rules/no-async-describe.js | 3 +++ lib/rules/no-exclusive-tests.js | 5 ++++- lib/rules/no-global-tests.js | 5 ++++- lib/rules/no-hooks-for-single-case.js | 3 +++ lib/rules/no-hooks.js | 3 +++ lib/rules/no-identical-title.js | 5 ++++- lib/rules/no-mocha-arrows.js | 3 +++ lib/rules/no-nested-tests.js | 5 ++++- lib/rules/no-pending-tests.js | 5 ++++- lib/rules/no-return-and-callback.js | 5 ++++- lib/rules/no-return-from-async.js | 5 ++++- lib/rules/no-setup-in-describe.js | 5 ++++- lib/rules/no-sibling-hooks.js | 5 ++++- lib/rules/no-skipped-tests.js | 3 +++ lib/rules/no-synchronous-tests.js | 3 +++ lib/rules/no-top-level-hooks.js | 5 ++++- lib/rules/prefer-arrow-callback.js | 2 +- lib/rules/valid-suite-description.js | 3 +++ lib/rules/valid-test-description.js | 3 +++ 21 files changed, 72 insertions(+), 12 deletions(-) diff --git a/lib/rules/handle-done-callback.js b/lib/rules/handle-done-callback.js index 670735f..7f8ed99 100644 --- a/lib/rules/handle-done-callback.js +++ b/lib/rules/handle-done-callback.js @@ -5,7 +5,10 @@ const astUtils = require('../util/ast'); module.exports = { meta: { - type: 'problem' + type: 'problem', + docs: { + description: 'Enforces handling of callbacks for async tests' + } }, create(context) { function isAsyncFunction(functionExpression) { diff --git a/lib/rules/max-top-level-suites.js b/lib/rules/max-top-level-suites.js index ce35b8f..88b1848 100644 --- a/lib/rules/max-top-level-suites.js +++ b/lib/rules/max-top-level-suites.js @@ -18,6 +18,9 @@ function isTopLevelScope(scope) { module.exports = { meta: { type: 'suggestion', + docs: { + description: 'Limit the number of top-level suites in a single file' + }, schema: [ { type: 'object', diff --git a/lib/rules/no-async-describe.js b/lib/rules/no-async-describe.js index da71cc1..9f9b9d5 100644 --- a/lib/rules/no-async-describe.js +++ b/lib/rules/no-async-describe.js @@ -12,6 +12,9 @@ const { additionalSuiteNames } = require('../util/settings'); module.exports = { meta: { type: 'problem', + docs: { + description: 'Disallow async functions passed to describe' + }, fixable: 'code' }, create(context) { diff --git a/lib/rules/no-exclusive-tests.js b/lib/rules/no-exclusive-tests.js index 83dcc90..c66276c 100644 --- a/lib/rules/no-exclusive-tests.js +++ b/lib/rules/no-exclusive-tests.js @@ -5,7 +5,10 @@ const astUtils = require('../util/ast'); module.exports = { meta: { - type: 'problem' + type: 'problem', + docs: { + description: 'Disallow exclusive tests' + } }, create(context) { let mochaTestFunctions = [ diff --git a/lib/rules/no-global-tests.js b/lib/rules/no-global-tests.js index f081cf2..441f006 100644 --- a/lib/rules/no-global-tests.js +++ b/lib/rules/no-global-tests.js @@ -4,7 +4,10 @@ const astUtils = require('../util/ast'); module.exports = { meta: { - type: 'suggestion' + type: 'suggestion', + docs: { + description: 'Disallow global tests' + } }, create(context) { function isGlobalScope(scope) { diff --git a/lib/rules/no-hooks-for-single-case.js b/lib/rules/no-hooks-for-single-case.js index f2a9792..ed6ed8a 100644 --- a/lib/rules/no-hooks-for-single-case.js +++ b/lib/rules/no-hooks-for-single-case.js @@ -14,6 +14,9 @@ function newDescribeLayer(describeNode) { module.exports = { meta: { type: 'suggestion', + docs: { + description: 'Disallow hooks for a single test or test suite' + }, schema: [ { type: 'object', diff --git a/lib/rules/no-hooks.js b/lib/rules/no-hooks.js index 15b88b1..02eff9c 100644 --- a/lib/rules/no-hooks.js +++ b/lib/rules/no-hooks.js @@ -5,6 +5,9 @@ const astUtil = require('../util/ast'); module.exports = { meta: { type: 'suggestion', + docs: { + description: 'Disallow hooks' + }, schema: [ { type: 'object', diff --git a/lib/rules/no-identical-title.js b/lib/rules/no-identical-title.js index e35c842..8871d23 100644 --- a/lib/rules/no-identical-title.js +++ b/lib/rules/no-identical-title.js @@ -43,7 +43,10 @@ function isFirstArgLiteral(node) { module.exports = { meta: { - type: 'suggestion' + type: 'suggestion', + docs: { + description: 'Disallow identical titles' + } }, create(context) { const titleLayers = [ newLayer() ]; diff --git a/lib/rules/no-mocha-arrows.js b/lib/rules/no-mocha-arrows.js index 30a7977..e6559fc 100644 --- a/lib/rules/no-mocha-arrows.js +++ b/lib/rules/no-mocha-arrows.js @@ -10,6 +10,9 @@ const astUtils = require('../util/ast'); module.exports = { meta: { type: 'suggestion', + docs: { + description: 'Disallow arrow functions as arguments to mocha functions' + }, fixable: 'code' }, create(context) { diff --git a/lib/rules/no-nested-tests.js b/lib/rules/no-nested-tests.js index eff4475..439e2f8 100644 --- a/lib/rules/no-nested-tests.js +++ b/lib/rules/no-nested-tests.js @@ -7,7 +7,10 @@ const { additionalSuiteNames } = require('../util/settings'); module.exports = { meta: { - type: 'problem' + type: 'problem', + docs: { + description: 'Disallow tests to be nested within other tests ' + } }, create(context) { const settings = context.settings; diff --git a/lib/rules/no-pending-tests.js b/lib/rules/no-pending-tests.js index b2d2db7..54b3248 100644 --- a/lib/rules/no-pending-tests.js +++ b/lib/rules/no-pending-tests.js @@ -4,7 +4,10 @@ const astUtils = require('../util/ast'); module.exports = { meta: { - type: 'suggestion' + type: 'suggestion', + docs: { + description: 'Disallow pending tests' + } }, create(context) { function isPendingMochaTest(node) { diff --git a/lib/rules/no-return-and-callback.js b/lib/rules/no-return-and-callback.js index 8c4822f..453d7cf 100644 --- a/lib/rules/no-return-and-callback.js +++ b/lib/rules/no-return-and-callback.js @@ -41,7 +41,10 @@ function reportIfFunctionWithBlock(context, node, doneName) { module.exports = { meta: { - type: 'problem' + type: 'problem', + docs: { + description: 'Disallow returning in a test or hook function that uses a callback' + } }, create(context) { function check(node) { diff --git a/lib/rules/no-return-from-async.js b/lib/rules/no-return-from-async.js index fcd4be6..3185a61 100644 --- a/lib/rules/no-return-from-async.js +++ b/lib/rules/no-return-from-async.js @@ -35,7 +35,10 @@ function reportIfFunctionWithBlock(context, node) { module.exports = { meta: { - type: 'suggestion' + type: 'suggestion', + docs: { + description: 'Disallow returning from an async test or hook' + } }, create(context) { function check(node) { diff --git a/lib/rules/no-setup-in-describe.js b/lib/rules/no-setup-in-describe.js index 4383b69..e57712e 100644 --- a/lib/rules/no-setup-in-describe.js +++ b/lib/rules/no-setup-in-describe.js @@ -10,7 +10,10 @@ const PURE = 3; module.exports = { meta: { - type: 'suggestion' + type: 'suggestion', + docs: { + description: 'Disallow setup in describe blocks' + } }, create(context) { const nesting = []; diff --git a/lib/rules/no-sibling-hooks.js b/lib/rules/no-sibling-hooks.js index fc8111a..08f433f 100644 --- a/lib/rules/no-sibling-hooks.js +++ b/lib/rules/no-sibling-hooks.js @@ -15,7 +15,10 @@ function newDescribeLayer(describeNode) { module.exports = { meta: { - type: 'suggestion' + type: 'suggestion', + docs: { + description: 'Disallow duplicate uses of a hook at the same level inside a describe' + } }, create(context) { const isUsed = []; diff --git a/lib/rules/no-skipped-tests.js b/lib/rules/no-skipped-tests.js index 17c0e13..8fc7b9f 100644 --- a/lib/rules/no-skipped-tests.js +++ b/lib/rules/no-skipped-tests.js @@ -49,6 +49,9 @@ function isCallToMochaXFunction(callee) { module.exports = { meta: { fixable: 'code', + docs: { + description: 'Disallow skipped tests' + }, type: 'problem' }, create(context) { diff --git a/lib/rules/no-synchronous-tests.js b/lib/rules/no-synchronous-tests.js index c95b360..3f0bac9 100644 --- a/lib/rules/no-synchronous-tests.js +++ b/lib/rules/no-synchronous-tests.js @@ -38,6 +38,9 @@ function doesReturnPromise(functionExpression) { module.exports = { meta: { type: 'suggestion', + docs: { + description: 'Disallow synchronous tests' + }, schema: [ { type: 'object', diff --git a/lib/rules/no-top-level-hooks.js b/lib/rules/no-top-level-hooks.js index 776be6a..3128b4e 100644 --- a/lib/rules/no-top-level-hooks.js +++ b/lib/rules/no-top-level-hooks.js @@ -5,7 +5,10 @@ const { additionalSuiteNames } = require('../util/settings'); module.exports = { meta: { - type: 'problem' + type: 'problem', + docs: { + description: 'Disallow top-level hooks' + } }, create(context) { const settings = context.settings; diff --git a/lib/rules/prefer-arrow-callback.js b/lib/rules/prefer-arrow-callback.js index 733e4ca..1a341b8 100644 --- a/lib/rules/prefer-arrow-callback.js +++ b/lib/rules/prefer-arrow-callback.js @@ -156,7 +156,7 @@ module.exports = { type: 'suggestion', docs: { - description: 'require using arrow functions for callbacks', + description: 'Require using arrow functions for callbacks', category: 'ECMAScript 6', recommended: false, url: 'https://eslint.org/docs/rules/prefer-arrow-callback' diff --git a/lib/rules/valid-suite-description.js b/lib/rules/valid-suite-description.js index e9012af..246a152 100644 --- a/lib/rules/valid-suite-description.js +++ b/lib/rules/valid-suite-description.js @@ -49,6 +49,9 @@ const messageSchema = { module.exports = { meta: { type: 'suggestion', + docs: { + description: 'Match suite descriptions against a pre-configured regular expression' + }, schema: [ { oneOf: [ patternSchema, { diff --git a/lib/rules/valid-test-description.js b/lib/rules/valid-test-description.js index 61b75db..fd3b695 100644 --- a/lib/rules/valid-test-description.js +++ b/lib/rules/valid-test-description.js @@ -48,6 +48,9 @@ const messageSchema = { module.exports = { meta: { type: 'suggestion', + docs: { + description: 'Match test descriptions against a pre-configured regular expression' + }, schema: [ { oneOf: [ patternSchema, {