attio 0.0.1-experimental.20250212 → 0.0.1-experimental.20250212.1

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.
@@ -34,6 +34,7 @@ module.exports = [
34
34
  "react-hooks/exhaustive-deps": "error",
35
35
  "attio/attio-client-import": "error",
36
36
  "attio/server-default-export": "error",
37
+ "attio/form-submit-button": "error",
37
38
  },
38
39
  settings: {
39
40
  react: {
@@ -42,6 +42,7 @@ module.exports = [
42
42
  "@typescript-eslint/ban-ts-comment": "off",
43
43
  "attio/attio-client-import": "error",
44
44
  "attio/server-default-export": "error",
45
+ "attio/form-submit-button": "error",
45
46
  },
46
47
  settings: {
47
48
  react: {
package/lint.cjs CHANGED
@@ -75,5 +75,57 @@ module.exports = {
75
75
  }
76
76
  },
77
77
  },
78
+ "form-submit-button": {
79
+ meta: {
80
+ type: "problem",
81
+ docs: {
82
+ description: "Ensure <Form/> components have exactly one <SubmitButton/> as a direct child, and <SubmitButton/> components only appear as direct children of <Form/> components",
83
+ category: "Possible Errors",
84
+ recommended: true,
85
+ },
86
+ fixable: null,
87
+ },
88
+ create(context) {
89
+ return {
90
+ JSXElement(node) {
91
+ // Check if this is a Form component
92
+ if (node.openingElement.name.name === "Form") {
93
+ let submitButtonCount = 0
94
+
95
+ // Check direct children only
96
+ node.children.forEach(child => {
97
+ if (child.type === "JSXElement") {
98
+ if (child.openingElement.name.name === "SubmitButton") {
99
+ submitButtonCount++
100
+ }
101
+ }
102
+ })
103
+
104
+ if (submitButtonCount === 0) {
105
+ context.report({
106
+ node,
107
+ message: "<Form/> component must have exactly one <SubmitButton/> as a direct child",
108
+ })
109
+ } else if (submitButtonCount > 1) {
110
+ context.report({
111
+ node,
112
+ message: "<Form/> component must not have multiple <SubmitButton/> children",
113
+ })
114
+ }
115
+ }
116
+ // Check if this is a SubmitButton that's not a direct child of Form
117
+ else if (node.openingElement.name.name === "SubmitButton") {
118
+ const parent = node.parent
119
+ if (!parent || parent.type !== "JSXElement" || parent.openingElement.name.name !== "Form") {
120
+ context.report({
121
+ node,
122
+ message: "<SubmitButton/> must be a direct child of a <Form/> component",
123
+ })
124
+ }
125
+ }
126
+ },
127
+ }
128
+ },
129
+ },
78
130
  },
79
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attio",
3
- "version": "0.0.1-experimental.20250212",
3
+ "version": "0.0.1-experimental.20250212.1",
4
4
  "bin": "lib/attio.js",
5
5
  "type": "module",
6
6
  "files": [