Skip to content

Commit

Permalink
Merge pull request #257 from edg2s/docs
Browse files Browse the repository at this point in the history
Add meta.docs.description to all rules
  • Loading branch information
lo1tuma authored Jun 16, 2020
2 parents b4787e8 + 163d649 commit 09eb3b6
Show file tree
Hide file tree
Showing 21 changed files with 72 additions and 12 deletions.
5 changes: 4 additions & 1 deletion lib/rules/handle-done-callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/max-top-level-suites.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/no-async-describe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/no-exclusive-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/no-global-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/no-hooks-for-single-case.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/no-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ const astUtil = require('../util/ast');
module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Disallow hooks'
},
schema: [
{
type: 'object',
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/no-identical-title.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ function isFirstArgLiteral(node) {

module.exports = {
meta: {
type: 'suggestion'
type: 'suggestion',
docs: {
description: 'Disallow identical titles'
}
},
create(context) {
const titleLayers = [ newLayer() ];
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/no-mocha-arrows.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/no-nested-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/no-pending-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/no-return-and-callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/no-return-from-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/no-setup-in-describe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/no-sibling-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/no-skipped-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ function isCallToMochaXFunction(callee) {
module.exports = {
meta: {
fixable: 'code',
docs: {
description: 'Disallow skipped tests'
},
type: 'problem'
},
create(context) {
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/no-synchronous-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ function doesReturnPromise(functionExpression) {
module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Disallow synchronous tests'
},
schema: [
{
type: 'object',
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/no-top-level-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-arrow-callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/valid-suite-description.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/valid-test-description.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

0 comments on commit 09eb3b6

Please sign in to comment.