@bigbinary/eslint-plugin-neeto 1.1.27 → 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 +14 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -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.27",
3
+ "version": "1.1.28",
4
4
  "main": "dist/index.js",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {