@bigbinary/eslint-plugin-neeto 1.7.3 → 1.7.5

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 +43 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -68,6 +68,9 @@
68
68
  exportnameCase: "camelCase"
69
69
  },
70
70
  configs: [{
71
+ filenameCase: "anycase",
72
+ includes: "/translations/**"
73
+ }, {
71
74
  filenameCase: "camelCase",
72
75
  exportnameCase: "CONSTANT_CASE",
73
76
  includes: ["/**/constants.{js,jsx}", "/**/constants/**"]
@@ -209,6 +212,9 @@
209
212
  exportnameCase: "camelCase"
210
213
  },
211
214
  configs: [{
215
+ filenameCase: "anycase",
216
+ includes: "/translations/**"
217
+ }, {
212
218
  filenameCase: "camelCase",
213
219
  exportnameCase: "CONSTANT_CASE",
214
220
  includes: ["/**/constants.{js,jsx}", "/**/constants/**"]
@@ -324,7 +330,7 @@
324
330
  }
325
331
 
326
332
  var name = "@bigbinary/eslint-plugin-neeto";
327
- var version = "1.7.2";
333
+ var version = "1.7.4";
328
334
  var main = "dist/index.js";
329
335
  var license = "UNLICENSED";
330
336
  var scripts = {
@@ -5471,9 +5477,18 @@
5471
5477
 
5472
5478
  var minimatch$1 = minimatch_1;
5473
5479
 
5480
+ var _CASE_REGEXES;
5474
5481
  var EXPORT_PATTERN = {
5475
5482
  type: ramda.includes(ramda.__, [TYPES.EXPORT_DEFAULT_DECLARATION, TYPES.EXPORT_NAMED_DECLARATION])
5476
5483
  };
5484
+ var CASE_STYLES = {
5485
+ camel: "camelCase",
5486
+ constant: "CONSTANT_CASE",
5487
+ pascal: "PascalCase",
5488
+ snake: "snake_case",
5489
+ any: "anycase"
5490
+ };
5491
+ var CASE_REGEXES = (_CASE_REGEXES = {}, _defineProperty(_CASE_REGEXES, CASE_STYLES.camel, CAMEL_CASE_REGEX), _defineProperty(_CASE_REGEXES, CASE_STYLES.constant, CONSTANT_CASE_REGEX), _defineProperty(_CASE_REGEXES, CASE_STYLES.pascal, PASCAL_CASE_REGEX), _defineProperty(_CASE_REGEXES, CASE_STYLES.snake, SNAKE_CASE_REGEX), _CASE_REGEXES);
5477
5492
 
5478
5493
  var isInsideBaseDirectory = function isInsideBaseDirectory(context) {
5479
5494
  return context.getFilename().startsWith(context.options[0].basePath);
@@ -5483,15 +5498,9 @@
5483
5498
  return Array.isArray(item) ? item : new Array(item);
5484
5499
  };
5485
5500
  var isCaseMatching = function isCaseMatching(text, caseStyle) {
5486
- var _regexes$caseStyle$te, _regexes$caseStyle;
5487
- if (!text) return true;
5488
- var regexes = {
5489
- camelCase: CAMEL_CASE_REGEX,
5490
- CONSTANT_CASE: CONSTANT_CASE_REGEX,
5491
- PascalCase: PASCAL_CASE_REGEX,
5492
- snake_case: SNAKE_CASE_REGEX
5493
- };
5494
- return (_regexes$caseStyle$te = (_regexes$caseStyle = regexes[caseStyle]) === null || _regexes$caseStyle === void 0 ? void 0 : _regexes$caseStyle.test(text)) !== null && _regexes$caseStyle$te !== void 0 ? _regexes$caseStyle$te : true;
5501
+ var _CASE_REGEXES$caseSty, _CASE_REGEXES$caseSty2;
5502
+ if (!text || caseStyle === CASE_STYLES.any) return true;
5503
+ return (_CASE_REGEXES$caseSty = (_CASE_REGEXES$caseSty2 = CASE_REGEXES[caseStyle]) === null || _CASE_REGEXES$caseSty2 === void 0 ? void 0 : _CASE_REGEXES$caseSty2.test(text)) !== null && _CASE_REGEXES$caseSty !== void 0 ? _CASE_REGEXES$caseSty : true;
5495
5504
  };
5496
5505
  var findMatchedConfig = function findMatchedConfig(context, configs) {
5497
5506
  var fullFilePath = context.getFilename();
@@ -11753,6 +11762,16 @@
11753
11762
  };
11754
11763
  var CONDITIONAL_NODE_TYPES = [TYPES.LOGICAL_EXPRESSION, TYPES.CONDITIONAL_EXPRESSION];
11755
11764
  var NODE_TYPES = [TYPES.JSX_ELEMENT, TYPES.JSX_EXPRESSION_CONTAINER];
11765
+ var HTML_FORM_ELEMENT_PATTERN = {
11766
+ type: TYPES.JSX_ELEMENT,
11767
+ openingElement: {
11768
+ name: {
11769
+ name: function name(_name3) {
11770
+ return _name3 === null || _name3 === void 0 ? void 0 : _name3.includes("form");
11771
+ }
11772
+ }
11773
+ }
11774
+ };
11756
11775
 
11757
11776
  var isFormActionButton = function isFormActionButton(node) {
11758
11777
  return matchesAny([BUTTON_NODE_PATTERN, SUBMIT_BUTTON_PATTERN, CANCEL_BUTTON_PATTERN], node);
@@ -11771,6 +11790,17 @@
11771
11790
  }
11772
11791
  }, node.parent);
11773
11792
  };
11793
+ var traverseParentsAndCheckFormType = function traverseParentsAndCheckFormType(node) {
11794
+ var current = node.parent;
11795
+ while (current) {
11796
+ if (neetoCist.matches(HTML_FORM_ELEMENT_PATTERN, current)) return true;
11797
+ current = current.parent;
11798
+ }
11799
+ return false;
11800
+ };
11801
+ var isInsideHtmlForm = function isInsideHtmlForm(node) {
11802
+ return traverseParentsAndCheckFormType(node);
11803
+ };
11774
11804
  var getAdjacentActionNode = function getAdjacentActionNode(node) {
11775
11805
  var _node$parent, _node$parent$parent, _filterBy2, _findIndexBy2;
11776
11806
  var isSucceedingNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -11805,7 +11835,9 @@
11805
11835
  create: function create(context) {
11806
11836
  return {
11807
11837
  JSXElement: function JSXElement(node) {
11808
- if (!isFormSubmitButton(node) || isAlternateNode(node)) return;
11838
+ if (!isFormSubmitButton(node) || isAlternateNode(node) || isInsideHtmlForm(node)) {
11839
+ return;
11840
+ }
11809
11841
  var succeedingButton = getAdjacentActionNode(node, true);
11810
11842
  var precedingButton = getAdjacentActionNode(node);
11811
11843
  var start = node.loc.start;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/eslint-plugin-neeto",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "main": "dist/index.js",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {