@eslint-react/shared 1.5.28 → 1.5.29-next.0

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.d.mts CHANGED
@@ -40,11 +40,132 @@ declare const createRuleForPlugin: (pluginName: string) => <Options extends read
40
40
 
41
41
  /**
42
42
  * @internal
43
+ * @description
44
+ * This allows the rule to know some key information before checking for user-defined hooks.
45
+ * For example, the position of the `deps` argument for the user-defined `useCustomEffect` hook that represents the built-in `useEffect` hook.
43
46
  */
44
- declare const ESLintReactSettingsSchema: valibot.ObjectSchema<{
47
+ declare const CustomHookSchema: valibot.ObjectSchema<{}, undefined>;
48
+ /**
49
+ * @internal
50
+ */
51
+ declare const CustomAttributeSchema: valibot.ObjectSchema<{
52
+ /**
53
+ * The name of the attribute in the user-defined component.
54
+ * @example
55
+ * "to"
56
+ */
57
+ readonly name: valibot.StringSchema<undefined>;
58
+ /**
59
+ * The name of the attribute in the built-in component.
60
+ * @example
61
+ * "href"
62
+ */
63
+ readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
64
+ /**
65
+ * The default value of the attribute in the user-defined component.
66
+ * @example
67
+ * `"/"`
68
+ */
69
+ readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
70
+ }, undefined>;
71
+ /**
72
+ * @internal
73
+ * @description
74
+ * This will provide some key information to the rule before checking for user-defined components.
75
+ * For example:
76
+ * Which attribute is used as the `href` prop for the user-defined `Link` component that represents the built-in `a` element.
77
+ * Which attributes are used as `children` props for a user-defined `Button` component to receive children of that component.
78
+ */
79
+ declare const CustomComponentSchema: valibot.ObjectSchema<{
80
+ /**
81
+ * The name of the user-defined component.
82
+ * @example
83
+ * "Link"
84
+ */
85
+ readonly name: valibot.StringSchema<undefined>;
86
+ /**
87
+ * The name of the built-in component that the user-defined component represents.
88
+ * @example
89
+ * "a"
90
+ */
91
+ readonly as: valibot.StringSchema<undefined>;
92
+ /**
93
+ * Pre-defined attributes that are used in the user-defined component.
94
+ * @example
95
+ * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
96
+ */
97
+ readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
98
+ /**
99
+ * The name of the attribute in the user-defined component.
100
+ * @example
101
+ * "to"
102
+ */
103
+ readonly name: valibot.StringSchema<undefined>;
104
+ /**
105
+ * The name of the attribute in the built-in component.
106
+ * @example
107
+ * "href"
108
+ */
109
+ readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
110
+ /**
111
+ * The default value of the attribute in the user-defined component.
112
+ * @example
113
+ * `"/"`
114
+ */
115
+ readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
116
+ }, undefined>, undefined>, never>;
117
+ }, undefined>;
118
+ /**
119
+ * @internal
120
+ */
121
+ declare const ESLintReactXSettingsSchema: valibot.ObjectSchema<{
122
+ readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
123
+ readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
124
+ readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
125
+ readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
126
+ readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
127
+ readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
128
+ /**
129
+ * The name of the user-defined component.
130
+ * @example
131
+ * "Link"
132
+ */
133
+ readonly name: valibot.StringSchema<undefined>;
134
+ /**
135
+ * The name of the built-in component that the user-defined component represents.
136
+ * @example
137
+ * "a"
138
+ */
139
+ readonly as: valibot.StringSchema<undefined>;
140
+ /**
141
+ * Pre-defined attributes that are used in the user-defined component.
142
+ * @example
143
+ * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
144
+ */
145
+ readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
146
+ /**
147
+ * The name of the attribute in the user-defined component.
148
+ * @example
149
+ * "to"
150
+ */
151
+ readonly name: valibot.StringSchema<undefined>;
152
+ /**
153
+ * The name of the attribute in the built-in component.
154
+ * @example
155
+ * "href"
156
+ */
157
+ readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
158
+ /**
159
+ * The default value of the attribute in the user-defined component.
160
+ * @example
161
+ * `"/"`
162
+ */
163
+ readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
164
+ }, undefined>, undefined>, never>;
165
+ }, undefined>, undefined>, never>;
45
166
  readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
46
- readonly use: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
47
- readonly useActionState: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
167
+ readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
168
+ readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
48
169
  readonly useCallback: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
49
170
  readonly useContext: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
50
171
  readonly useDebugValue: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
@@ -62,21 +183,59 @@ declare const ESLintReactSettingsSchema: valibot.ObjectSchema<{
62
183
  readonly useSyncExternalStore: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
63
184
  readonly useTransition: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
64
185
  }, undefined>, never>;
65
- readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
66
- readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
67
- readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
68
- readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
69
- readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
70
186
  }, undefined>;
71
- type ESLintReactSettings = ReadonlyDeep<InferOutput<typeof ESLintReactSettingsSchema>>;
72
187
  /**
73
188
  * @internal
74
189
  */
75
190
  declare const ESLintSettingsSchema: valibot.ObjectSchema<{
76
191
  readonly "react-x": valibot.OptionalSchema<valibot.ObjectSchema<{
192
+ readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
193
+ readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
194
+ readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
195
+ readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
196
+ readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
197
+ readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
198
+ /**
199
+ * The name of the user-defined component.
200
+ * @example
201
+ * "Link"
202
+ */
203
+ readonly name: valibot.StringSchema<undefined>;
204
+ /**
205
+ * The name of the built-in component that the user-defined component represents.
206
+ * @example
207
+ * "a"
208
+ */
209
+ readonly as: valibot.StringSchema<undefined>;
210
+ /**
211
+ * Pre-defined attributes that are used in the user-defined component.
212
+ * @example
213
+ * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
214
+ */
215
+ readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
216
+ /**
217
+ * The name of the attribute in the user-defined component.
218
+ * @example
219
+ * "to"
220
+ */
221
+ readonly name: valibot.StringSchema<undefined>;
222
+ /**
223
+ * The name of the attribute in the built-in component.
224
+ * @example
225
+ * "href"
226
+ */
227
+ readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
228
+ /**
229
+ * The default value of the attribute in the user-defined component.
230
+ * @example
231
+ * `"/"`
232
+ */
233
+ readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
234
+ }, undefined>, undefined>, never>;
235
+ }, undefined>, undefined>, never>;
77
236
  readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
78
- readonly use: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
79
- readonly useActionState: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
237
+ readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
238
+ readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
80
239
  readonly useCallback: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
81
240
  readonly useContext: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
82
241
  readonly useDebugValue: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
@@ -94,19 +253,58 @@ declare const ESLintSettingsSchema: valibot.ObjectSchema<{
94
253
  readonly useSyncExternalStore: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
95
254
  readonly useTransition: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
96
255
  }, undefined>, never>;
97
- readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
98
- readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
99
- readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
100
- readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
101
- readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
102
256
  }, undefined>, never>;
103
257
  /**
104
258
  * @deprecated
105
259
  */
106
260
  readonly reactOptions: valibot.OptionalSchema<valibot.ObjectSchema<{
261
+ readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
262
+ readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
263
+ readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
264
+ readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
265
+ readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
266
+ readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
267
+ /**
268
+ * The name of the user-defined component.
269
+ * @example
270
+ * "Link"
271
+ */
272
+ readonly name: valibot.StringSchema<undefined>;
273
+ /**
274
+ * The name of the built-in component that the user-defined component represents.
275
+ * @example
276
+ * "a"
277
+ */
278
+ readonly as: valibot.StringSchema<undefined>;
279
+ /**
280
+ * Pre-defined attributes that are used in the user-defined component.
281
+ * @example
282
+ * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
283
+ */
284
+ readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
285
+ /**
286
+ * The name of the attribute in the user-defined component.
287
+ * @example
288
+ * "to"
289
+ */
290
+ readonly name: valibot.StringSchema<undefined>;
291
+ /**
292
+ * The name of the attribute in the built-in component.
293
+ * @example
294
+ * "href"
295
+ */
296
+ readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
297
+ /**
298
+ * The default value of the attribute in the user-defined component.
299
+ * @example
300
+ * `"/"`
301
+ */
302
+ readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
303
+ }, undefined>, undefined>, never>;
304
+ }, undefined>, undefined>, never>;
107
305
  readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
108
- readonly use: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
109
- readonly useActionState: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
306
+ readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
307
+ readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
110
308
  readonly useCallback: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
111
309
  readonly useContext: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
112
310
  readonly useDebugValue: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
@@ -124,15 +322,11 @@ declare const ESLintSettingsSchema: valibot.ObjectSchema<{
124
322
  readonly useSyncExternalStore: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
125
323
  readonly useTransition: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
126
324
  }, undefined>, never>;
127
- readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
128
- readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
129
- readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
130
- readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
131
- readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
132
325
  }, undefined>, never>;
133
326
  }, undefined>;
327
+ type ESLintReactXSettings = ReadonlyDeep<InferOutput<typeof ESLintReactXSettingsSchema>>;
134
328
  type ESLintSettings = ReadonlyDeep<InferOutput<typeof ESLintSettingsSchema>>;
135
329
 
136
- declare function getESLintReactSettings(data: unknown): ESLintReactSettings;
330
+ declare function parseESLintSettings(data: unknown): ESLintSettings;
137
331
 
138
- export { type ESLintReactSettings, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, getESLintReactSettings };
332
+ export { CustomAttributeSchema, CustomComponentSchema, CustomHookSchema, type ESLintReactXSettings, ESLintReactXSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, parseESLintSettings };
package/dist/index.d.ts CHANGED
@@ -40,11 +40,132 @@ declare const createRuleForPlugin: (pluginName: string) => <Options extends read
40
40
 
41
41
  /**
42
42
  * @internal
43
+ * @description
44
+ * This allows the rule to know some key information before checking for user-defined hooks.
45
+ * For example, the position of the `deps` argument for the user-defined `useCustomEffect` hook that represents the built-in `useEffect` hook.
43
46
  */
44
- declare const ESLintReactSettingsSchema: valibot.ObjectSchema<{
47
+ declare const CustomHookSchema: valibot.ObjectSchema<{}, undefined>;
48
+ /**
49
+ * @internal
50
+ */
51
+ declare const CustomAttributeSchema: valibot.ObjectSchema<{
52
+ /**
53
+ * The name of the attribute in the user-defined component.
54
+ * @example
55
+ * "to"
56
+ */
57
+ readonly name: valibot.StringSchema<undefined>;
58
+ /**
59
+ * The name of the attribute in the built-in component.
60
+ * @example
61
+ * "href"
62
+ */
63
+ readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
64
+ /**
65
+ * The default value of the attribute in the user-defined component.
66
+ * @example
67
+ * `"/"`
68
+ */
69
+ readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
70
+ }, undefined>;
71
+ /**
72
+ * @internal
73
+ * @description
74
+ * This will provide some key information to the rule before checking for user-defined components.
75
+ * For example:
76
+ * Which attribute is used as the `href` prop for the user-defined `Link` component that represents the built-in `a` element.
77
+ * Which attributes are used as `children` props for a user-defined `Button` component to receive children of that component.
78
+ */
79
+ declare const CustomComponentSchema: valibot.ObjectSchema<{
80
+ /**
81
+ * The name of the user-defined component.
82
+ * @example
83
+ * "Link"
84
+ */
85
+ readonly name: valibot.StringSchema<undefined>;
86
+ /**
87
+ * The name of the built-in component that the user-defined component represents.
88
+ * @example
89
+ * "a"
90
+ */
91
+ readonly as: valibot.StringSchema<undefined>;
92
+ /**
93
+ * Pre-defined attributes that are used in the user-defined component.
94
+ * @example
95
+ * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
96
+ */
97
+ readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
98
+ /**
99
+ * The name of the attribute in the user-defined component.
100
+ * @example
101
+ * "to"
102
+ */
103
+ readonly name: valibot.StringSchema<undefined>;
104
+ /**
105
+ * The name of the attribute in the built-in component.
106
+ * @example
107
+ * "href"
108
+ */
109
+ readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
110
+ /**
111
+ * The default value of the attribute in the user-defined component.
112
+ * @example
113
+ * `"/"`
114
+ */
115
+ readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
116
+ }, undefined>, undefined>, never>;
117
+ }, undefined>;
118
+ /**
119
+ * @internal
120
+ */
121
+ declare const ESLintReactXSettingsSchema: valibot.ObjectSchema<{
122
+ readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
123
+ readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
124
+ readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
125
+ readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
126
+ readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
127
+ readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
128
+ /**
129
+ * The name of the user-defined component.
130
+ * @example
131
+ * "Link"
132
+ */
133
+ readonly name: valibot.StringSchema<undefined>;
134
+ /**
135
+ * The name of the built-in component that the user-defined component represents.
136
+ * @example
137
+ * "a"
138
+ */
139
+ readonly as: valibot.StringSchema<undefined>;
140
+ /**
141
+ * Pre-defined attributes that are used in the user-defined component.
142
+ * @example
143
+ * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
144
+ */
145
+ readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
146
+ /**
147
+ * The name of the attribute in the user-defined component.
148
+ * @example
149
+ * "to"
150
+ */
151
+ readonly name: valibot.StringSchema<undefined>;
152
+ /**
153
+ * The name of the attribute in the built-in component.
154
+ * @example
155
+ * "href"
156
+ */
157
+ readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
158
+ /**
159
+ * The default value of the attribute in the user-defined component.
160
+ * @example
161
+ * `"/"`
162
+ */
163
+ readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
164
+ }, undefined>, undefined>, never>;
165
+ }, undefined>, undefined>, never>;
45
166
  readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
46
- readonly use: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
47
- readonly useActionState: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
167
+ readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
168
+ readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
48
169
  readonly useCallback: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
49
170
  readonly useContext: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
50
171
  readonly useDebugValue: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
@@ -62,21 +183,59 @@ declare const ESLintReactSettingsSchema: valibot.ObjectSchema<{
62
183
  readonly useSyncExternalStore: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
63
184
  readonly useTransition: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
64
185
  }, undefined>, never>;
65
- readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
66
- readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
67
- readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
68
- readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
69
- readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
70
186
  }, undefined>;
71
- type ESLintReactSettings = ReadonlyDeep<InferOutput<typeof ESLintReactSettingsSchema>>;
72
187
  /**
73
188
  * @internal
74
189
  */
75
190
  declare const ESLintSettingsSchema: valibot.ObjectSchema<{
76
191
  readonly "react-x": valibot.OptionalSchema<valibot.ObjectSchema<{
192
+ readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
193
+ readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
194
+ readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
195
+ readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
196
+ readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
197
+ readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
198
+ /**
199
+ * The name of the user-defined component.
200
+ * @example
201
+ * "Link"
202
+ */
203
+ readonly name: valibot.StringSchema<undefined>;
204
+ /**
205
+ * The name of the built-in component that the user-defined component represents.
206
+ * @example
207
+ * "a"
208
+ */
209
+ readonly as: valibot.StringSchema<undefined>;
210
+ /**
211
+ * Pre-defined attributes that are used in the user-defined component.
212
+ * @example
213
+ * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
214
+ */
215
+ readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
216
+ /**
217
+ * The name of the attribute in the user-defined component.
218
+ * @example
219
+ * "to"
220
+ */
221
+ readonly name: valibot.StringSchema<undefined>;
222
+ /**
223
+ * The name of the attribute in the built-in component.
224
+ * @example
225
+ * "href"
226
+ */
227
+ readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
228
+ /**
229
+ * The default value of the attribute in the user-defined component.
230
+ * @example
231
+ * `"/"`
232
+ */
233
+ readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
234
+ }, undefined>, undefined>, never>;
235
+ }, undefined>, undefined>, never>;
77
236
  readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
78
- readonly use: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
79
- readonly useActionState: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
237
+ readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
238
+ readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
80
239
  readonly useCallback: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
81
240
  readonly useContext: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
82
241
  readonly useDebugValue: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
@@ -94,19 +253,58 @@ declare const ESLintSettingsSchema: valibot.ObjectSchema<{
94
253
  readonly useSyncExternalStore: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
95
254
  readonly useTransition: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
96
255
  }, undefined>, never>;
97
- readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
98
- readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
99
- readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
100
- readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
101
- readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
102
256
  }, undefined>, never>;
103
257
  /**
104
258
  * @deprecated
105
259
  */
106
260
  readonly reactOptions: valibot.OptionalSchema<valibot.ObjectSchema<{
261
+ readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
262
+ readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
263
+ readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
264
+ readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
265
+ readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
266
+ readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
267
+ /**
268
+ * The name of the user-defined component.
269
+ * @example
270
+ * "Link"
271
+ */
272
+ readonly name: valibot.StringSchema<undefined>;
273
+ /**
274
+ * The name of the built-in component that the user-defined component represents.
275
+ * @example
276
+ * "a"
277
+ */
278
+ readonly as: valibot.StringSchema<undefined>;
279
+ /**
280
+ * Pre-defined attributes that are used in the user-defined component.
281
+ * @example
282
+ * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
283
+ */
284
+ readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
285
+ /**
286
+ * The name of the attribute in the user-defined component.
287
+ * @example
288
+ * "to"
289
+ */
290
+ readonly name: valibot.StringSchema<undefined>;
291
+ /**
292
+ * The name of the attribute in the built-in component.
293
+ * @example
294
+ * "href"
295
+ */
296
+ readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
297
+ /**
298
+ * The default value of the attribute in the user-defined component.
299
+ * @example
300
+ * `"/"`
301
+ */
302
+ readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
303
+ }, undefined>, undefined>, never>;
304
+ }, undefined>, undefined>, never>;
107
305
  readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
108
- readonly use: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
109
- readonly useActionState: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
306
+ readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
307
+ readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
110
308
  readonly useCallback: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
111
309
  readonly useContext: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
112
310
  readonly useDebugValue: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
@@ -124,15 +322,11 @@ declare const ESLintSettingsSchema: valibot.ObjectSchema<{
124
322
  readonly useSyncExternalStore: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
125
323
  readonly useTransition: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
126
324
  }, undefined>, never>;
127
- readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
128
- readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
129
- readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
130
- readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
131
- readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
132
325
  }, undefined>, never>;
133
326
  }, undefined>;
327
+ type ESLintReactXSettings = ReadonlyDeep<InferOutput<typeof ESLintReactXSettingsSchema>>;
134
328
  type ESLintSettings = ReadonlyDeep<InferOutput<typeof ESLintSettingsSchema>>;
135
329
 
136
- declare function getESLintReactSettings(data: unknown): ESLintReactSettings;
330
+ declare function parseESLintSettings(data: unknown): ESLintSettings;
137
331
 
138
- export { type ESLintReactSettings, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, getESLintReactSettings };
332
+ export { CustomAttributeSchema, CustomComponentSchema, CustomHookSchema, type ESLintReactXSettings, ESLintReactXSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, parseESLintSettings };
package/dist/index.js CHANGED
@@ -472,10 +472,59 @@ function parse(schema, input, config2) {
472
472
  }
473
473
 
474
474
  // src/schemas.ts
475
- var ESLintReactSettingsSchema = object({
475
+ var CustomHookSchema = object({
476
+ // TODO: Define the schema for custom hooks
477
+ });
478
+ var CustomAttributeSchema = object({
479
+ /**
480
+ * The name of the attribute in the user-defined component.
481
+ * @example
482
+ * "to"
483
+ */
484
+ name: string(),
485
+ /**
486
+ * The name of the attribute in the built-in component.
487
+ * @example
488
+ * "href"
489
+ */
490
+ as: optional(string()),
491
+ /**
492
+ * The default value of the attribute in the user-defined component.
493
+ * @example
494
+ * `"/"`
495
+ */
496
+ defaultValue: optional(string())
497
+ });
498
+ var CustomComponentSchema = object({
499
+ /**
500
+ * The name of the user-defined component.
501
+ * @example
502
+ * "Link"
503
+ */
504
+ name: string(),
505
+ /**
506
+ * The name of the built-in component that the user-defined component represents.
507
+ * @example
508
+ * "a"
509
+ */
510
+ as: string(),
511
+ /**
512
+ * Pre-defined attributes that are used in the user-defined component.
513
+ * @example
514
+ * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
515
+ */
516
+ attributes: optional(array(CustomAttributeSchema))
517
+ });
518
+ var ESLintReactXSettingsSchema = object({
519
+ importSource: optional(string()),
520
+ jsxPragma: optional(string()),
521
+ jsxPragmaFrag: optional(string()),
522
+ strict: optional(boolean()),
523
+ version: optional(string()),
524
+ additionalComponents: optional(array(CustomComponentSchema)),
476
525
  additionalHooks: optional(object({
477
- use: optional(string()),
478
- useActionState: optional(string()),
526
+ use: optional(array(string())),
527
+ useActionState: optional(array(string())),
479
528
  useCallback: optional(array(string())),
480
529
  useContext: optional(array(string())),
481
530
  useDebugValue: optional(array(string())),
@@ -492,28 +541,25 @@ var ESLintReactSettingsSchema = object({
492
541
  useState: optional(array(string())),
493
542
  useSyncExternalStore: optional(array(string())),
494
543
  useTransition: optional(array(string()))
495
- })),
496
- importSource: optional(string()),
497
- jsxPragma: optional(string()),
498
- jsxPragmaFrag: optional(string()),
499
- strict: optional(boolean()),
500
- version: optional(string())
544
+ }))
501
545
  });
502
546
  var ESLintSettingsSchema = object({
503
- "react-x": optional(ESLintReactSettingsSchema),
547
+ "react-x": optional(ESLintReactXSettingsSchema),
504
548
  /**
505
549
  * @deprecated
506
550
  */
507
- reactOptions: optional(ESLintReactSettingsSchema)
551
+ reactOptions: optional(ESLintReactXSettingsSchema)
508
552
  });
509
553
 
510
554
  // src/settings.ts
511
- function getESLintReactSettings(data) {
512
- const settings = parse(ESLintSettingsSchema, data);
513
- return settings["react-x"] ?? settings.reactOptions ?? {};
555
+ function parseESLintSettings(data) {
556
+ return parse(ESLintSettingsSchema, data);
514
557
  }
515
558
 
516
- exports.ESLintReactSettingsSchema = ESLintReactSettingsSchema;
559
+ exports.CustomAttributeSchema = CustomAttributeSchema;
560
+ exports.CustomComponentSchema = CustomComponentSchema;
561
+ exports.CustomHookSchema = CustomHookSchema;
562
+ exports.ESLintReactXSettingsSchema = ESLintReactXSettingsSchema;
517
563
  exports.ESLintSettingsSchema = ESLintSettingsSchema;
518
564
  exports.GITHUB_URL = GITHUB_URL;
519
565
  exports.HOST_HTML_COMPONENT_TYPES = HOST_HTML_COMPONENT_TYPES;
@@ -527,4 +573,4 @@ exports.RE_PASCAL_CASE = RE_PASCAL_CASE;
527
573
  exports.RE_SNAKE_CASE = RE_SNAKE_CASE;
528
574
  exports.WEBSITE_URL = WEBSITE_URL;
529
575
  exports.createRuleForPlugin = createRuleForPlugin;
530
- exports.getESLintReactSettings = getESLintReactSettings;
576
+ exports.parseESLintSettings = parseESLintSettings;
package/dist/index.mjs CHANGED
@@ -470,10 +470,59 @@ function parse(schema, input, config2) {
470
470
  }
471
471
 
472
472
  // src/schemas.ts
473
- var ESLintReactSettingsSchema = object({
473
+ var CustomHookSchema = object({
474
+ // TODO: Define the schema for custom hooks
475
+ });
476
+ var CustomAttributeSchema = object({
477
+ /**
478
+ * The name of the attribute in the user-defined component.
479
+ * @example
480
+ * "to"
481
+ */
482
+ name: string(),
483
+ /**
484
+ * The name of the attribute in the built-in component.
485
+ * @example
486
+ * "href"
487
+ */
488
+ as: optional(string()),
489
+ /**
490
+ * The default value of the attribute in the user-defined component.
491
+ * @example
492
+ * `"/"`
493
+ */
494
+ defaultValue: optional(string())
495
+ });
496
+ var CustomComponentSchema = object({
497
+ /**
498
+ * The name of the user-defined component.
499
+ * @example
500
+ * "Link"
501
+ */
502
+ name: string(),
503
+ /**
504
+ * The name of the built-in component that the user-defined component represents.
505
+ * @example
506
+ * "a"
507
+ */
508
+ as: string(),
509
+ /**
510
+ * Pre-defined attributes that are used in the user-defined component.
511
+ * @example
512
+ * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
513
+ */
514
+ attributes: optional(array(CustomAttributeSchema))
515
+ });
516
+ var ESLintReactXSettingsSchema = object({
517
+ importSource: optional(string()),
518
+ jsxPragma: optional(string()),
519
+ jsxPragmaFrag: optional(string()),
520
+ strict: optional(boolean()),
521
+ version: optional(string()),
522
+ additionalComponents: optional(array(CustomComponentSchema)),
474
523
  additionalHooks: optional(object({
475
- use: optional(string()),
476
- useActionState: optional(string()),
524
+ use: optional(array(string())),
525
+ useActionState: optional(array(string())),
477
526
  useCallback: optional(array(string())),
478
527
  useContext: optional(array(string())),
479
528
  useDebugValue: optional(array(string())),
@@ -490,25 +539,19 @@ var ESLintReactSettingsSchema = object({
490
539
  useState: optional(array(string())),
491
540
  useSyncExternalStore: optional(array(string())),
492
541
  useTransition: optional(array(string()))
493
- })),
494
- importSource: optional(string()),
495
- jsxPragma: optional(string()),
496
- jsxPragmaFrag: optional(string()),
497
- strict: optional(boolean()),
498
- version: optional(string())
542
+ }))
499
543
  });
500
544
  var ESLintSettingsSchema = object({
501
- "react-x": optional(ESLintReactSettingsSchema),
545
+ "react-x": optional(ESLintReactXSettingsSchema),
502
546
  /**
503
547
  * @deprecated
504
548
  */
505
- reactOptions: optional(ESLintReactSettingsSchema)
549
+ reactOptions: optional(ESLintReactXSettingsSchema)
506
550
  });
507
551
 
508
552
  // src/settings.ts
509
- function getESLintReactSettings(data) {
510
- const settings = parse(ESLintSettingsSchema, data);
511
- return settings["react-x"] ?? settings.reactOptions ?? {};
553
+ function parseESLintSettings(data) {
554
+ return parse(ESLintSettingsSchema, data);
512
555
  }
513
556
 
514
- export { ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, getESLintReactSettings };
557
+ export { CustomAttributeSchema, CustomComponentSchema, CustomHookSchema, ESLintReactXSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, parseESLintSettings };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/shared",
3
- "version": "1.5.28",
3
+ "version": "1.5.29-next.0",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
5
  "homepage": "https://github.com/rel1cx/eslint-react",
6
6
  "bugs": {
@@ -38,7 +38,7 @@
38
38
  "@typescript-eslint/utils": "^7.16.1"
39
39
  },
40
40
  "devDependencies": {
41
- "tsup": "8.2.0",
41
+ "tsup": "8.2.1",
42
42
  "type-fest": "4.22.1",
43
43
  "valibot": "0.36.0"
44
44
  },