Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.34 KB

require-meta-docs-recommended.md

File metadata and controls

45 lines (31 loc) · 1.34 KB

Require rules to implement a meta.docs.recommended property (eslint-plugin/require-meta-docs-recommended)

Utilizing meta.docs.recommended makes it clear from each rule implementation whether a rule is part of the recommended config. Some plugins also have scripting for conveniently generating their config based on this flag.

However, this flag may not be appropriate for all plugins:

  • Extra scripting/tooling is needed to keep the flags in sync with the config
  • The flag may not scale to plugins that have multiple/many configs or don't have a recommended config
  • Or some may simply prefer to keep the source of truth solely in the config rather than duplicating config membership data in the rules

Rule Details

This rule requires ESLint rules to have a valid meta.docs.recommended property.

Examples of incorrect code for this rule:

/* eslint eslint-plugin/require-meta-docs-recommended: error */

module.exports = {
  meta: {},
  create(context) {
    /* ... */
  },
};

Examples of correct code for this rule:

/* eslint eslint-plugin/require-meta-docs-recommended: error */

module.exports = {
  meta: { recommended: true },
  create(context) {
    /* ... */
  },
};

Further Reading