Require rules meta.schema
properties to include descriptions (eslint-plugin/require-meta-schema-description
)
Defining a description in the schema for each rule option helps explain that option to users.
It also allows documentation generators such as eslint-doc-generator
to generate more informative documentation for users.
This rule requires that if a rule option has a property in the rule's meta.schema
, it should have a description
.
Examples of incorrect code for this rule:
/* eslint eslint-plugin/require-meta-schema-description: error */
module.exports = {
meta: {
schema: [
{
elements: { type: 'string' },
type: 'array',
},
],
},
create() {},
};
module.exports = {
meta: {
schema: [
{
properties: {
something: {
type: 'string',
},
},
type: 'object',
},
],
},
create() {},
};
Examples of correct code for this rule:
/* eslint eslint-plugin/require-meta-schema-description: error */
module.exports = {
meta: {
schema: [
{
description: 'Elements to allow.',
elements: { type: 'string' },
type: 'array',
},
],
},
create() {},
};
module.exports = {
meta: {
schema: [
{
oneOf: [
{
description: 'Elements to allow.',
elements: { type: 'string' },
type: 'array',
},
],
},
],
},
create() {},
};
If your rule options are very simple and well-named, and your rule isn't used by developers outside of your immediate team, you may not need this rule.