File: require-meta-type.md

package info (click to toggle)
node-eslint-plugin-eslint-plugin 2.3.0%2B~0.3.0-6
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 652 kB
  • sloc: javascript: 5,372; makefile: 34; sh: 1
file content (46 lines) | stat: -rw-r--r-- 1,291 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# require rules to implement a meta.type property (require-meta-type)

ESLint v5.9.0 introduces a new `--fix-type` option for the command line interface. This option allows users to filter the type of fixes applied when using `--fix`.

Fixes in custom rules will not be applied when using `--fix-type` unless they include a meta.type field.

## Rule Details

This rule aims to require ESLint rules to have a valid `meta.type` property.

Examples of **incorrect** code for this rule:

```js
/* eslint eslint-plugin/require-meta-type: error */
module.exports = {
    meta: {},
    create: function(context) {
        // ...
    }
};

module.exports = {
    meta: {type: 'invalid'},
    create: function(context) {
        // ...
    }
};
```

Examples of **correct** code for this rule:

```js
/* eslint eslint-plugin/require-meta-type: error */
module.exports = {
    meta: {type: 'problem'},
    create: function(context) {
        // ...
    }
};
```

## Further Reading

* [command-line-interface#--fix-type](https://eslint.org/docs/user-guide/command-line-interface#--fix-type)
* [working-with-rules#rule-basics](https://eslint.org/docs/developer-guide/working-with-rules#rule-basics)
* [ESLint v5.9.0 released](https://eslint.org/blog/2018/11/eslint-v5.9.0-released#the-fix-type-option)