@bigbinary/eslint-plugin-neeto 1.1.13 → 1.1.14
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 +37 -36
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5897,7 +5897,7 @@
|
|
|
5897
5897
|
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableRest();
|
|
5898
5898
|
}
|
|
5899
5899
|
|
|
5900
|
-
|
|
5900
|
+
({
|
|
5901
5901
|
type: TYPES.VARIABLE_DECLARATION,
|
|
5902
5902
|
declarations: [{
|
|
5903
5903
|
type: TYPES.VARIABLE_DECLARATOR,
|
|
@@ -5909,8 +5909,8 @@
|
|
|
5909
5909
|
}
|
|
5910
5910
|
}
|
|
5911
5911
|
}]
|
|
5912
|
-
};
|
|
5913
|
-
|
|
5912
|
+
});
|
|
5913
|
+
({
|
|
5914
5914
|
type: TYPES.EXPRESSION_STATEMENT,
|
|
5915
5915
|
expression: {
|
|
5916
5916
|
type: TYPES.CALL_EXPRESSION,
|
|
@@ -5919,7 +5919,7 @@
|
|
|
5919
5919
|
name: ramda.test(/use[a-zA-z0-9].+/)
|
|
5920
5920
|
}
|
|
5921
5921
|
}
|
|
5922
|
-
};
|
|
5922
|
+
});
|
|
5923
5923
|
|
|
5924
5924
|
// import { functionName } from "neetocommons/react-utils";
|
|
5925
5925
|
var NEETO_COMMONS_REACT_UTILS_IMPORT_PATTERN = {
|
|
@@ -5933,6 +5933,31 @@
|
|
|
5933
5933
|
}]
|
|
5934
5934
|
};
|
|
5935
5935
|
|
|
5936
|
+
var BREAK_STATEMENT_PATTERN = {
|
|
5937
|
+
type: TYPES.BREAK_STATEMENT
|
|
5938
|
+
};
|
|
5939
|
+
var RETURN_STATEMENT_PATTERN = {
|
|
5940
|
+
type: TYPES.RETURN_STATEMENT
|
|
5941
|
+
};
|
|
5942
|
+
var ARRAY_LENGTH_TEST_PATTERN = {
|
|
5943
|
+
test: {
|
|
5944
|
+
right: {
|
|
5945
|
+
type: TYPES.MEMBER_EXPRESSION,
|
|
5946
|
+
property: {
|
|
5947
|
+
name: "length"
|
|
5948
|
+
}
|
|
5949
|
+
}
|
|
5950
|
+
}
|
|
5951
|
+
};
|
|
5952
|
+
var CHAR_AT_PATTERN = {
|
|
5953
|
+
type: TYPES.CALL_EXPRESSION,
|
|
5954
|
+
callee: {
|
|
5955
|
+
property: {
|
|
5956
|
+
name: ramda.includes(ramda.__, ["charAt", "charCodeAt"])
|
|
5957
|
+
}
|
|
5958
|
+
}
|
|
5959
|
+
};
|
|
5960
|
+
|
|
5936
5961
|
var noDumbComponentsWithUseTranslation = {
|
|
5937
5962
|
meta: {
|
|
5938
5963
|
type: "suggestion",
|
|
@@ -5950,12 +5975,13 @@
|
|
|
5950
5975
|
arrowFunctionExpression = _node$declarations[0].init;
|
|
5951
5976
|
var blockStatement = arrowFunctionExpression.body;
|
|
5952
5977
|
if (!blockStatement.body) return;
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5978
|
+
if (blockStatement.body.length !== 2) return;
|
|
5979
|
+
var _blockStatement$body = _slicedToArray(blockStatement.body, 2),
|
|
5980
|
+
firstStatement = _blockStatement$body[0],
|
|
5981
|
+
secondStatement = _blockStatement$body[1];
|
|
5982
|
+
if (!(pure.matches(USE_TRANSLATION_HOOK_PATTERN, firstStatement) && pure.matches(RETURN_STATEMENT_PATTERN, secondStatement))) {
|
|
5983
|
+
return;
|
|
5984
|
+
}
|
|
5959
5985
|
context.report({
|
|
5960
5986
|
node: node,
|
|
5961
5987
|
message: USE_WITH_T_HOC_IN_DUMB_COMPONENTS,
|
|
@@ -5979,7 +6005,7 @@
|
|
|
5979
6005
|
return "";
|
|
5980
6006
|
};
|
|
5981
6007
|
var blockStatementCode = getCode$1(context, blockStatement);
|
|
5982
|
-
var useTranslationHookCode = getCode$1(context,
|
|
6008
|
+
var useTranslationHookCode = getCode$1(context, firstStatement);
|
|
5983
6009
|
var body = blockStatementCode.replace(useTranslationHookCode, "");
|
|
5984
6010
|
var withTWrap = "withT((".concat(getPropsCode()).concat(pure.isNotEmpty(restParams) ? ", ".concat(restParams.map(function (param) {
|
|
5985
6011
|
return getCode$1(context, param);
|
|
@@ -7787,31 +7813,6 @@
|
|
|
7787
7813
|
}
|
|
7788
7814
|
};
|
|
7789
7815
|
|
|
7790
|
-
var BREAK_STATEMENT_PATTERN = {
|
|
7791
|
-
type: TYPES.BREAK_STATEMENT
|
|
7792
|
-
};
|
|
7793
|
-
var RETURN_STATEMENT_PATTERN = {
|
|
7794
|
-
type: TYPES.RETURN_STATEMENT
|
|
7795
|
-
};
|
|
7796
|
-
var ARRAY_LENGTH_TEST_PATTERN = {
|
|
7797
|
-
test: {
|
|
7798
|
-
right: {
|
|
7799
|
-
type: TYPES.MEMBER_EXPRESSION,
|
|
7800
|
-
property: {
|
|
7801
|
-
name: "length"
|
|
7802
|
-
}
|
|
7803
|
-
}
|
|
7804
|
-
}
|
|
7805
|
-
};
|
|
7806
|
-
var CHAR_AT_PATTERN = {
|
|
7807
|
-
type: TYPES.CALL_EXPRESSION,
|
|
7808
|
-
callee: {
|
|
7809
|
-
property: {
|
|
7810
|
-
name: ramda.includes(ramda.__, ["charAt", "charCodeAt"])
|
|
7811
|
-
}
|
|
7812
|
-
}
|
|
7813
|
-
};
|
|
7814
|
-
|
|
7815
7816
|
var isForLoopReplacable = function isForLoopReplacable(node) {
|
|
7816
7817
|
return ramda.not(patternExistsDeep(BREAK_STATEMENT_PATTERN, node.body) || patternExistsDeep(RETURN_STATEMENT_PATTERN, node.body) || patternExistsDeep(CHAR_AT_PATTERN, node.body));
|
|
7817
7818
|
};
|