Skip to content

Commit

Permalink
Docs: Missing metadata property (fixes eslint#13349)
Browse files Browse the repository at this point in the history
If metadata property is missing, `fixable` essentially gets defaulted
to true.  Described this behavior in the docs as well as added
recommendations to include metadata/type properties
  • Loading branch information
ajkovar committed Jun 12, 2020
1 parent 6cfbd03 commit 796ee98
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/developer-guide/working-with-rules.md
Expand Up @@ -51,7 +51,12 @@ The source file for a rule exports an object with the following properties.

`meta` (object) contains metadata for the rule:

**Warning:** This property is not required but recommended as that may change in the future.

* `type` (string) indicates the type of rule, which is one of `"problem"`, `"suggestion"`, or `"layout"`:

**Warning:** This property is not required but recommended as that may change in the future.

* `"problem"` means the rule is identifying code that either will cause an error or may cause a confusing behavior. Developers should consider this a high priority to resolve.
* `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isn't changed.
* `"layout"` means the rule cares primarily about whitespace, semicolons, commas, and parentheses, all the parts of the program that determine how the code looks rather than how it executes. These rules work on parts of the code that aren't specified in the AST.
Expand All @@ -68,7 +73,7 @@ The source file for a rule exports an object with the following properties.

* `fixable` (string) is either `"code"` or `"whitespace"` if the `--fix` option on the [command line](../user-guide/command-line-interface.md#fix) automatically fixes problems reported by the rule

**Important:** Without the `fixable` property, ESLint does not [apply fixes](#applying-fixes) even if the rule implements `fix` functions. Omit the `fixable` property if the rule is not fixable.
**Important:** Without the `fixable` property, ESLint does not [apply fixes](#applying-fixes) even if the rule implements `fix` functions. Omit the `fixable` property if the rule is not fixable. However, due to backwards compatibility, if the `metadata` is not present, and a rule does implement `fix` functions, the fix *will* be applied.

* `schema` (array) specifies the [options](#options-schemas) so ESLint can prevent invalid [rule configurations](../user-guide/configuring.md#configuring-rules)

Expand Down

0 comments on commit 796ee98

Please sign in to comment.