@bigbinary/eslint-plugin-neeto 1.1.17 → 1.1.18

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.
Files changed (2) hide show
  1. package/dist/index.js +38 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3864,6 +3864,41 @@
3864
3864
  }
3865
3865
  }]
3866
3866
  };
3867
+ var WRAPPED_WITH_T_PATTERN = {
3868
+ type: TYPES.VARIABLE_DECLARATOR,
3869
+ init: {
3870
+ type: TYPES.CALL_EXPRESSION,
3871
+ callee: {
3872
+ name: "withT"
3873
+ },
3874
+ arguments: [{
3875
+ body: {
3876
+ type: TYPES.BLOCK_STATEMENT,
3877
+ body: function body(_body) {
3878
+ return _body.length >= 2;
3879
+ }
3880
+ }
3881
+ }]
3882
+ },
3883
+ id: {
3884
+ type: TYPES.IDENTIFIER,
3885
+ name: ramda.test(PASCAL_CASE_REGEX)
3886
+ }
3887
+ };
3888
+ var EXPORTED_WITH_T_PATTERN = {
3889
+ type: TYPES.EXPORT_DEFAULT_DECLARATION,
3890
+ declaration: {
3891
+ type: TYPES.CALL_EXPRESSION,
3892
+ callee: {
3893
+ type: TYPES.IDENTIFIER,
3894
+ name: "withT"
3895
+ },
3896
+ arguments: ramda.any(pure.matches({
3897
+ type: TYPES.IDENTIFIER,
3898
+ name: ramda.test(PASCAL_CASE_REGEX)
3899
+ }))
3900
+ }
3901
+ };
3867
3902
 
3868
3903
  // components={{}}
3869
3904
  var COMPONENTS_PROP_PATTERN = {
@@ -4449,6 +4484,7 @@
4449
4484
  if (!isInsideComponentsDirectory(context)) return;
4450
4485
  var componentNodes = findMatchingNodesDeep(node.body, COMPONENT_PATTERN);
4451
4486
  if (ramda.isEmpty(componentNodes)) return;
4487
+ var isExportedWithT = patternExistsDeep(EXPORTED_WITH_T_PATTERN, node);
4452
4488
  componentNodes.forEach(function (node) {
4453
4489
  var tFunctionMemeberExpressionNodes = findMatchingNodesDeep(node, T_FUNCTION_MEMBER_EXPRESSION_PATTERN);
4454
4490
  tFunctionMemeberExpressionNodes.forEach(function (node) {
@@ -4460,7 +4496,9 @@
4460
4496
  var tFunctionNodes = findMatchingNodesDeep(node, T_FUNCTION_PATTERN);
4461
4497
  if (ramda.isEmpty(tFunctionNodes)) return;
4462
4498
  var isUseTranslationHookPresent = patternExistsDeep(USE_TRANSLATION_HOOK_PATTERN, node);
4499
+ var isWrappedWithT = patternExistsDeep(WRAPPED_WITH_T_PATTERN, node) || isExportedWithT;
4463
4500
  if (isUseTranslationHookPresent) return;
4501
+ if (isWrappedWithT) return;
4464
4502
  tFunctionNodes.forEach(function (node) {
4465
4503
  context.report({
4466
4504
  node: node,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/eslint-plugin-neeto",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "main": "dist/index.js",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {