@bigbinary/eslint-plugin-neeto 1.1.36 → 1.1.38
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 +9 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4606,7 +4606,7 @@
|
|
|
4606
4606
|
return "It may be possible to shorten this code using ".concat(replacement, " from neetocist");
|
|
4607
4607
|
};
|
|
4608
4608
|
|
|
4609
|
-
var NEETO_COMMONS_UTILS_IMPORT_PATTERNS = ["neetocommons/utils", "@bigbinary/neeto-commons-frontend/utils", "neetomolecules/CopyToClipboardButton", "@bigbinary/neeto-molecules/CopyToClipboardButton"];
|
|
4609
|
+
var NEETO_COMMONS_UTILS_IMPORT_PATTERNS = ["neetocommons/utils", "neetocommons/utils/general", "@bigbinary/neeto-commons-frontend/utils", "@bigbinary/neeto-commons-frontend/utils/general", "neetomolecules/CopyToClipboardButton", "@bigbinary/neeto-molecules/CopyToClipboardButton"];
|
|
4610
4610
|
var NOT_EQUALS_DEEP_CALL_EXP_PATTERN = {
|
|
4611
4611
|
type: TYPES.CALL_EXPRESSION,
|
|
4612
4612
|
callee: {
|
|
@@ -8863,6 +8863,8 @@
|
|
|
8863
8863
|
}
|
|
8864
8864
|
};
|
|
8865
8865
|
|
|
8866
|
+
var ALLOWED_IMPORTS = ["neetocommons/utils/createSubscription", "neetocommons/utils"];
|
|
8867
|
+
|
|
8866
8868
|
// createSubscription();
|
|
8867
8869
|
var CUSTOM_CREATE_SUBSCRIPTION_PATTERN = {
|
|
8868
8870
|
type: TYPES.CALL_EXPRESSION,
|
|
@@ -8943,7 +8945,9 @@
|
|
|
8943
8945
|
type: TYPES.IMPORT_DECLARATION,
|
|
8944
8946
|
source: {
|
|
8945
8947
|
type: TYPES.LITERAL,
|
|
8946
|
-
value:
|
|
8948
|
+
value: function value(_value) {
|
|
8949
|
+
return !ramda.includes(_value, ALLOWED_IMPORTS);
|
|
8950
|
+
}
|
|
8947
8951
|
},
|
|
8948
8952
|
specifiers: ramda.any(matchesAny([{
|
|
8949
8953
|
type: TYPES.IMPORT_DEFAULT_SPECIFIER,
|
|
@@ -9051,6 +9055,7 @@
|
|
|
9051
9055
|
create: function create(context) {
|
|
9052
9056
|
return {
|
|
9053
9057
|
":matches(FunctionDeclaration, ArrowFunctionExpression) > BlockStatement > IfStatement:first-child": function matchesFunctionDeclarationArrowFunctionExpressionBlockStatementIfStatementFirstChild(node) {
|
|
9058
|
+
var _node$consequent$body;
|
|
9054
9059
|
// checks if a node is `return` type or `block` with only a `return` type
|
|
9055
9060
|
var isReturnBlock = ramda.either(neetoCist.matches(RETURN_STATEMENT_PATTERN), neetoCist.matches(RETURN_BLOCK_PATTERN));
|
|
9056
9061
|
var ensurePunctuation = function ensurePunctuation(text) {
|
|
@@ -9060,6 +9065,8 @@
|
|
|
9060
9065
|
// ignore if:
|
|
9061
9066
|
node.parent.body.length > 1 ||
|
|
9062
9067
|
// function includes other statements.
|
|
9068
|
+
((_node$consequent$body = node.consequent.body) === null || _node$consequent$body === void 0 ? void 0 : _node$consequent$body.length) === 1 ||
|
|
9069
|
+
// `if` block has only one statement
|
|
9063
9070
|
node.consequent.type !== TYPES.BLOCK_STATEMENT ||
|
|
9064
9071
|
// avoid inline `if` statement.
|
|
9065
9072
|
isReturnBlock(node.consequent) ||
|