@bigbinary/eslint-plugin-neeto 1.7.3 → 1.7.4
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 +25 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
var name = "@bigbinary/eslint-plugin-neeto";
|
|
327
|
-
var version = "1.7.
|
|
327
|
+
var version = "1.7.3";
|
|
328
328
|
var main = "dist/index.js";
|
|
329
329
|
var license = "UNLICENSED";
|
|
330
330
|
var scripts = {
|
|
@@ -11753,6 +11753,16 @@
|
|
|
11753
11753
|
};
|
|
11754
11754
|
var CONDITIONAL_NODE_TYPES = [TYPES.LOGICAL_EXPRESSION, TYPES.CONDITIONAL_EXPRESSION];
|
|
11755
11755
|
var NODE_TYPES = [TYPES.JSX_ELEMENT, TYPES.JSX_EXPRESSION_CONTAINER];
|
|
11756
|
+
var HTML_FORM_ELEMENT_PATTERN = {
|
|
11757
|
+
type: TYPES.JSX_ELEMENT,
|
|
11758
|
+
openingElement: {
|
|
11759
|
+
name: {
|
|
11760
|
+
name: function name(_name3) {
|
|
11761
|
+
return _name3 === null || _name3 === void 0 ? void 0 : _name3.includes("form");
|
|
11762
|
+
}
|
|
11763
|
+
}
|
|
11764
|
+
}
|
|
11765
|
+
};
|
|
11756
11766
|
|
|
11757
11767
|
var isFormActionButton = function isFormActionButton(node) {
|
|
11758
11768
|
return matchesAny([BUTTON_NODE_PATTERN, SUBMIT_BUTTON_PATTERN, CANCEL_BUTTON_PATTERN], node);
|
|
@@ -11771,6 +11781,17 @@
|
|
|
11771
11781
|
}
|
|
11772
11782
|
}, node.parent);
|
|
11773
11783
|
};
|
|
11784
|
+
var traverseParentsAndCheckFormType = function traverseParentsAndCheckFormType(node) {
|
|
11785
|
+
var current = node.parent;
|
|
11786
|
+
while (current) {
|
|
11787
|
+
if (neetoCist.matches(HTML_FORM_ELEMENT_PATTERN, current)) return true;
|
|
11788
|
+
current = current.parent;
|
|
11789
|
+
}
|
|
11790
|
+
return false;
|
|
11791
|
+
};
|
|
11792
|
+
var isInsideHtmlForm = function isInsideHtmlForm(node) {
|
|
11793
|
+
return traverseParentsAndCheckFormType(node);
|
|
11794
|
+
};
|
|
11774
11795
|
var getAdjacentActionNode = function getAdjacentActionNode(node) {
|
|
11775
11796
|
var _node$parent, _node$parent$parent, _filterBy2, _findIndexBy2;
|
|
11776
11797
|
var isSucceedingNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -11805,7 +11826,9 @@
|
|
|
11805
11826
|
create: function create(context) {
|
|
11806
11827
|
return {
|
|
11807
11828
|
JSXElement: function JSXElement(node) {
|
|
11808
|
-
if (!isFormSubmitButton(node) || isAlternateNode(node))
|
|
11829
|
+
if (!isFormSubmitButton(node) || isAlternateNode(node) || isInsideHtmlForm(node)) {
|
|
11830
|
+
return;
|
|
11831
|
+
}
|
|
11809
11832
|
var succeedingButton = getAdjacentActionNode(node, true);
|
|
11810
11833
|
var precedingButton = getAdjacentActionNode(node);
|
|
11811
11834
|
var start = node.loc.start;
|