Skip to content

Commit 646d28f

Browse files
committed
Docs: fixer-return.md
1 parent 8835fce commit 646d28f

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

docs/rules/fixer-return.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Enforces always return from a fixer function (fixer-return)
2+
3+
In a fixable rule, missing return from a fixer function will not apply fixes.
4+
5+
## Rule Details
6+
7+
This rule enforces always return from a fixer function.
8+
9+
Examples of **incorrect** code for this rule:
10+
11+
```js
12+
/* eslint eslint-plugin/fixer-return: error */
13+
module.exports = {
14+
create: function(context) {
15+
context.report( {
16+
fix: function(fixer) {
17+
fixer.foo();
18+
}
19+
});
20+
}
21+
};
22+
```
23+
24+
Examples of **correct** code for this rule:
25+
26+
```js
27+
/* eslint eslint-plugin/fixer-return: error */
28+
module.exports = {
29+
create: function(context) {
30+
context.report( {
31+
fix: function(fixer) {
32+
return fixer.foo();
33+
}
34+
});
35+
}
36+
};
37+
```
38+
39+
## When Not To Use It
40+
41+
If you don't want to enforce always return from a fixer function, do not enable this rule.

lib/rules/fixer-return.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @fileoverview enforces fixer function always return a value
2+
* @fileoverview Enforces always return from a fixer function
33
* @author 薛定谔的猫<[email protected]>
44
*/
55

tests/lib/rules/fixer-return.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @fileoverview enforces fixer function always return a value
2+
* @fileoverview enforces always return from a fixer function
33
* @author 薛定谔的猫<[email protected]>
44
*/
55

0 commit comments

Comments
 (0)