File: fixer-return.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 (41 lines) | stat: -rw-r--r-- 904 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
# Enforces always return from a fixer function (fixer-return)

In a fixable rule, missing return from a fixer function will not apply fixes.

## Rule Details

This rule enforces that fixer functions always return a value.

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

```js
/* eslint eslint-plugin/fixer-return: error */
module.exports = {
    create: function(context) {
        context.report( {
            fix: function(fixer) {
                fixer.foo();
            }
        });
    }
};
```

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

```js
/* eslint eslint-plugin/fixer-return: error */
module.exports = {
    create: function(context) {
        context.report( {
            fix: function(fixer) {
                return fixer.foo();
            }
        });
    }
};
```

## When Not To Use It

If you don't want to enforce always return from a fixer function, do not enable this rule.