eslint-plugin-react-func
Advanced tools
Comparing version
{ | ||
"name": "eslint-plugin-react-func", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "max lines per function for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -52,7 +52,72 @@ # eslint-plugin-react-func | ||
## Supported Rules | ||
| ||
# max-lines-per-function | ||
## Options | ||
- "max" (default 50) enforces a maximum number of lines in a function. | ||
- "skipBlankLines" (default false) ignore lines made up purely of whitespace. | ||
- "skipComments" (default false) ignore lines containing just comments. | ||
- "IIFEs" (default false) include any code included in IIFEs. | ||
```json | ||
{ | ||
"rules": { | ||
"react-func/max-lines-per-function": [ | ||
"warn", | ||
{ | ||
"max": 20, | ||
"skipBlankLines": true, | ||
"skipComments": true, | ||
"IIFEs": true | ||
} | ||
], | ||
} | ||
} | ||
``` | ||
### Bad | ||
```javascript | ||
/*eslint max-lines-per-function: ["error", 2]*/ | ||
function foo() { | ||
var foo = 0; | ||
var bar = 0; | ||
var baz = 0; | ||
} | ||
``` | ||
### Good | ||
```javascript | ||
/*eslint max-lines-per-function: ["error", 2]*/ | ||
function foo() { | ||
var foo = 0; | ||
var bar = 0; | ||
} | ||
``` | ||
# max-combined-conditions | ||
## Options | ||
This rule has a numeric option (defaulted to 1) | ||
```json | ||
{ | ||
"rules": { | ||
"react-func/max-combined-conditions": ["error", 1], | ||
} | ||
} | ||
``` | ||
### Bad | ||
```javascript | ||
/*eslint max-combined-conditions: ["error", 0]*/ | ||
if (a < b && b > c) { | ||
a = c | ||
} | ||
``` | ||
### Good | ||
```javascript | ||
/*eslint max-combined-conditions: ["error", 0]*/ | ||
const isBGreaterThanOthers = a < b && b > c | ||
if (isBGreaterThanOthers) { | ||
a = c | ||
} | ||
``` |
18587
8.31%123
112.07%