@bigbinary/eslint-plugin-neeto 1.1.36 → 1.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9051,6 +9051,7 @@
|
|
|
9051
9051
|
create: function create(context) {
|
|
9052
9052
|
return {
|
|
9053
9053
|
":matches(FunctionDeclaration, ArrowFunctionExpression) > BlockStatement > IfStatement:first-child": function matchesFunctionDeclarationArrowFunctionExpressionBlockStatementIfStatementFirstChild(node) {
|
|
9054
|
+
var _node$consequent$body;
|
|
9054
9055
|
// checks if a node is `return` type or `block` with only a `return` type
|
|
9055
9056
|
var isReturnBlock = ramda.either(neetoCist.matches(RETURN_STATEMENT_PATTERN), neetoCist.matches(RETURN_BLOCK_PATTERN));
|
|
9056
9057
|
var ensurePunctuation = function ensurePunctuation(text) {
|
|
@@ -9060,6 +9061,8 @@
|
|
|
9060
9061
|
// ignore if:
|
|
9061
9062
|
node.parent.body.length > 1 ||
|
|
9062
9063
|
// function includes other statements.
|
|
9064
|
+
((_node$consequent$body = node.consequent.body) === null || _node$consequent$body === void 0 ? void 0 : _node$consequent$body.length) === 1 ||
|
|
9065
|
+
// `if` block has only one statement
|
|
9063
9066
|
node.consequent.type !== TYPES.BLOCK_STATEMENT ||
|
|
9064
9067
|
// avoid inline `if` statement.
|
|
9065
9068
|
isReturnBlock(node.consequent) ||
|