@bigbinary/eslint-plugin-neeto 1.1.26 → 1.1.28

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 +15 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -551,7 +551,7 @@
551
551
  var USE_WITH_IMMUTABLE_ACTIONS_WRAPPER = 'Use "withImmutableActions" wrapper from "neeto-commons-frontend" inside zustand create. Refer: https://bit.ly/withimmutableactions';
552
552
  var USE_WITH_T_HOC_IN_DUMB_COMPONENTS = 'Use "withT" HOC from "neeto-commons-frontend" instead of useTranslation hook in Dumb components';
553
553
  var NO_WITH_T_IN_SMART_COMPONENTS = '"withT" HOC should only be used in dumb components. "useTranslation" hook should be used here.';
554
- var USE_STANDARD_DATE_TIME_FORMATS = 'Use "dateFormat/timeFormat" from "@bigbinary/neeto-commons-frontend/utils" instead. Refer: https://github.com/bigbinary/neeto-commons-frontend/blob/main/docs/utils/README.md#dateformattimeformat';
554
+ var USE_STANDARD_DATE_TIME_FORMATS = 'Use "dateFormat/timeFormat" from "@bigbinary/neeto-commons-frontend/utils" instead. Refer: https://github.com/bigbinary/neeto-commons-frontend/blob/main/docs/utils/dateFormat.md';
555
555
  var MOVE_SPREAD_ATTRIBUTES_TO_TOP = "Move spread attribute to top";
556
556
  var USE_USE_MUTATION_WITH_INVALIDATION = "Use useMutationWithInvalidation from 'neetocommons/react-utils'";
557
557
  var USE_CLASSNAMES_PACKAGE = "Use classnames package for dynamic classes";
@@ -4039,11 +4039,22 @@
4039
4039
  return node.id.name;
4040
4040
  case TYPES.ASSIGNMENT_EXPRESSION:
4041
4041
  return node.left.name;
4042
+ case TYPES.JSX_ELEMENT:
4043
+ return TYPES.JSX_ELEMENT;
4042
4044
  default:
4043
4045
  return "";
4044
4046
  }
4045
4047
  };
4046
- var shouldReport = function shouldReport(node, nodeValue, context) {
4048
+ var getNodeValue = function getNodeValue(node) {
4049
+ switch (node.type) {
4050
+ case TYPES.TEMPLATE_LITERAL:
4051
+ return node.quasis.map(ramda.path(["value", "raw"])).join("");
4052
+ default:
4053
+ return node.value;
4054
+ }
4055
+ };
4056
+ var shouldReport = function shouldReport(node, context) {
4057
+ var nodeValue = getNodeValue(node);
4047
4058
  if (node.type !== TYPES.TEMPLATE_LITERAL) {
4048
4059
  if (typeof nodeValue !== "string") return false;
4049
4060
  var containOnlyNonWordChars = ONLY_NON_WORD_CHAR_REGEX.test(nodeValue);
@@ -4071,17 +4082,15 @@
4071
4082
  if (nodeName) {
4072
4083
  var isInIncludedList = INCLUDED_KEYWORDS_REGEX.test(nodeName);
4073
4084
  if (isInIncludedList) return true;
4074
- var _isMatchesNaturalLangRegex = NATURAL_LANGUAGE_REGEX.test(nodeValue);
4075
- if (!_isMatchesNaturalLangRegex) return false;
4076
4085
  var isInExcludedList = EXCLUDED_KEYWORDS_REGEX.test(nodeName);
4077
4086
  if (isInExcludedList) return false;
4087
+ return !!isMatchesNaturalLangRegex;
4078
4088
  }
4079
4089
  }
4080
4090
  return false;
4081
4091
  };
4082
4092
  var checkAndReport$4 = function checkAndReport(node, context) {
4083
- var nodeValue = node.type === TYPES.TEMPLATE_ELEMENT ? node.value.raw : node.value;
4084
- if (!shouldReport(node, nodeValue, context)) return;
4093
+ if (!shouldReport(node, context)) return;
4085
4094
  context.report({
4086
4095
  node: node,
4087
4096
  message: HARD_CODED_STRING_SHOULD_BE_LOCALIZED
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/eslint-plugin-neeto",
3
- "version": "1.1.26",
3
+ "version": "1.1.28",
4
4
  "main": "dist/index.js",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {