eslint-plugin-react-func
Advanced tools
Comparing version
@@ -16,22 +16,5 @@ /** | ||
const OPTIONS_SCHEMA = { | ||
type: "object", | ||
properties: { | ||
max: { | ||
type: "integer", | ||
minimum: 0 | ||
} | ||
}, | ||
additionalProperties: false | ||
}; | ||
const OPTIONS_OR_INTEGER_SCHEMA = { | ||
oneOf: [ | ||
OPTIONS_SCHEMA, | ||
{ | ||
type: "integer", | ||
minimum: 0 | ||
} | ||
] | ||
type: "integer", | ||
minimum: 0 | ||
}; | ||
@@ -55,3 +38,3 @@ | ||
messages: { | ||
unexpected: "too many combined conditions {{operatorNum}}. Maximum allowed is {{maxCombination}}." | ||
unexpected: "too many combined conditions ({{operatorNum}}). Maximum allowed is {{maxCombination}}." | ||
} | ||
@@ -61,10 +44,7 @@ }, | ||
create(context) { | ||
const option = context.options[0] || {}; | ||
let maxCombination = 1; | ||
const defaultMaxCombination = 1; | ||
let option = context.options[0] || defaultMaxCombination; | ||
let maxCombination = defaultMaxCombination; | ||
let operatorNum = 0; | ||
if (typeof option === "object") { | ||
maxCombination = typeof option.max === "number" ? option.max : 1; | ||
} | ||
if (typeof option === "number") { | ||
@@ -86,2 +66,3 @@ maxCombination = option; | ||
findOperatorNum(node); | ||
console.log(operatorNum, maxCombination, context.options) | ||
return operatorNum > maxCombination | ||
@@ -101,4 +82,6 @@ } | ||
messageId: "unexpected", | ||
maxCombination, | ||
operatorNum | ||
data: { | ||
maxCombination, | ||
operatorNum | ||
} | ||
}); | ||
@@ -105,0 +88,0 @@ } |
{ | ||
"name": "eslint-plugin-react-func", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "max lines per function for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
17256
-1.02%402
-3.37%