remix-validated-form 1.1.0 → 2.0.0-beta.2

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 (81) hide show
  1. package/.turbo/turbo-build.log +9 -0
  2. package/.turbo/turbo-dev.log +78 -0
  3. package/.turbo/turbo-test.log +36 -0
  4. package/README.md +72 -19
  5. package/browser/ValidatedForm.d.ts +35 -1
  6. package/browser/ValidatedForm.js +76 -20
  7. package/browser/hooks.d.ts +28 -3
  8. package/browser/hooks.js +17 -2
  9. package/browser/index.d.ts +3 -0
  10. package/browser/index.js +2 -0
  11. package/browser/internal/flatten.d.ts +4 -0
  12. package/browser/internal/flatten.js +35 -0
  13. package/browser/internal/formContext.d.ts +18 -0
  14. package/browser/internal/formContext.js +0 -0
  15. package/browser/internal/submissionCallbacks.d.ts +1 -0
  16. package/browser/internal/submissionCallbacks.js +13 -0
  17. package/browser/internal/util.d.ts +0 -0
  18. package/browser/internal/util.js +0 -0
  19. package/browser/server.d.ts +5 -0
  20. package/browser/server.js +5 -0
  21. package/browser/test-data/testFormData.d.ts +15 -0
  22. package/browser/test-data/testFormData.js +46 -0
  23. package/browser/validation/createValidator.d.ts +7 -0
  24. package/browser/validation/createValidator.js +30 -0
  25. package/browser/validation/types.d.ts +17 -2
  26. package/browser/validation/types.js +0 -0
  27. package/browser/validation/validation.test.d.ts +0 -0
  28. package/browser/validation/validation.test.js +162 -8
  29. package/browser/validation/withYup.d.ts +3 -0
  30. package/browser/validation/withYup.js +31 -25
  31. package/browser/validation/withZod.d.ts +3 -0
  32. package/browser/validation/withZod.js +19 -4
  33. package/build/ValidatedForm.d.ts +35 -1
  34. package/build/ValidatedForm.js +75 -19
  35. package/build/hooks.d.ts +28 -3
  36. package/build/hooks.js +20 -2
  37. package/build/index.d.ts +3 -0
  38. package/build/index.js +2 -0
  39. package/build/internal/flatten.d.ts +4 -0
  40. package/build/internal/flatten.js +43 -0
  41. package/build/internal/formContext.d.ts +18 -0
  42. package/build/internal/formContext.js +0 -0
  43. package/build/internal/submissionCallbacks.d.ts +1 -0
  44. package/build/internal/submissionCallbacks.js +17 -0
  45. package/build/internal/util.d.ts +0 -0
  46. package/build/internal/util.js +0 -0
  47. package/build/server.d.ts +5 -0
  48. package/build/server.js +5 -0
  49. package/build/test-data/testFormData.d.ts +15 -0
  50. package/build/test-data/testFormData.js +50 -0
  51. package/build/validation/createValidator.d.ts +7 -0
  52. package/build/validation/createValidator.js +34 -0
  53. package/build/validation/types.d.ts +17 -2
  54. package/build/validation/types.js +0 -0
  55. package/build/validation/validation.test.d.ts +0 -0
  56. package/build/validation/validation.test.js +162 -8
  57. package/build/validation/withYup.d.ts +3 -0
  58. package/build/validation/withYup.js +31 -25
  59. package/build/validation/withZod.d.ts +3 -0
  60. package/build/validation/withZod.js +22 -4
  61. package/jest.config.js +5 -0
  62. package/package.json +18 -38
  63. package/src/ValidatedForm.tsx +227 -0
  64. package/src/hooks.ts +60 -0
  65. package/src/index.ts +8 -0
  66. package/src/internal/flatten.ts +48 -0
  67. package/src/internal/formContext.ts +36 -0
  68. package/src/internal/submissionCallbacks.ts +15 -0
  69. package/src/internal/util.ts +23 -0
  70. package/src/server.ts +10 -0
  71. package/src/test-data/testFormData.ts +55 -0
  72. package/src/validation/createValidator.ts +34 -0
  73. package/src/validation/types.ts +28 -0
  74. package/src/validation/validation.test.ts +322 -0
  75. package/src/validation/withYup.ts +43 -0
  76. package/src/validation/withZod.ts +51 -0
  77. package/tsconfig.json +5 -0
  78. package/.eslintcache +0 -1
  79. package/.eslintignore +0 -1
  80. package/.prettierignore +0 -8
  81. package/LICENSE +0 -21
@@ -0,0 +1,55 @@
1
+ // Copied from remix to use in tests
2
+ // https://github.com/remix-run/remix/blob/a69a631cb5add72d5fb24211ab2a0be367b6f2fd/packages/remix-node/form-data.ts
3
+ export class TestFormData implements FormData {
4
+ private _params: URLSearchParams;
5
+
6
+ constructor(body?: string) {
7
+ this._params = new URLSearchParams(body);
8
+ }
9
+ append(name: string, value: string | Blob, fileName?: string): void {
10
+ if (typeof value !== "string") {
11
+ throw new Error("formData.append can only accept a string");
12
+ }
13
+ this._params.append(name, value);
14
+ }
15
+ delete(name: string): void {
16
+ this._params.delete(name);
17
+ }
18
+ get(name: string): FormDataEntryValue | null {
19
+ return this._params.get(name);
20
+ }
21
+ getAll(name: string): FormDataEntryValue[] {
22
+ return this._params.getAll(name);
23
+ }
24
+ has(name: string): boolean {
25
+ return this._params.has(name);
26
+ }
27
+ set(name: string, value: string | Blob, fileName?: string): void {
28
+ if (typeof value !== "string") {
29
+ throw new Error("formData.set can only accept a string");
30
+ }
31
+ this._params.set(name, value);
32
+ }
33
+ forEach(
34
+ callbackfn: (
35
+ value: FormDataEntryValue,
36
+ key: string,
37
+ parent: FormData
38
+ ) => void,
39
+ thisArg?: any
40
+ ): void {
41
+ this._params.forEach(callbackfn, thisArg);
42
+ }
43
+ entries(): IterableIterator<[string, FormDataEntryValue]> {
44
+ return this._params.entries();
45
+ }
46
+ keys(): IterableIterator<string> {
47
+ return this._params.keys();
48
+ }
49
+ values(): IterableIterator<FormDataEntryValue> {
50
+ return this._params.values();
51
+ }
52
+ *[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]> {
53
+ yield* this._params;
54
+ }
55
+ }
@@ -0,0 +1,34 @@
1
+ import { GenericObject, Validator } from "..";
2
+ import { objectFromPathEntries } from "../internal/flatten";
3
+
4
+ const preprocessFormData = (data: GenericObject | FormData): GenericObject => {
5
+ // A slightly janky way of determining if the data is a FormData object
6
+ // since node doesn't really have FormData
7
+ if ("entries" in data && typeof data.entries === "function")
8
+ return objectFromPathEntries([...data.entries()]);
9
+ return objectFromPathEntries(Object.entries(data));
10
+ };
11
+
12
+ /**
13
+ * Used to create a validator for a form.
14
+ * It provides built-in handling for unflattening nested objects and
15
+ * extracting the values from FormData.
16
+ */
17
+ export function createValidator<T>(validator: Validator<T>): Validator<T> {
18
+ return {
19
+ validate: (value: GenericObject | FormData) => {
20
+ const data = preprocessFormData(value);
21
+ const result = validator.validate(data);
22
+ if (result.error) {
23
+ // Ideally, we should probably be returning a nested object like
24
+ // { fieldErrors: {}, submittedData: {} }
25
+ // We should do this in the next major version of the library
26
+ // but for now, we can sneak it in with the fieldErrors.
27
+ result.error._submittedData = data as any;
28
+ }
29
+ return result;
30
+ },
31
+ validateField: (data: GenericObject | FormData, field: string) =>
32
+ validator.validateField(preprocessFormData(data), field),
33
+ };
34
+ }
@@ -0,0 +1,28 @@
1
+ export type FieldErrors = Record<string, string>;
2
+
3
+ export type FieldErrorsWithData = FieldErrors & { _submittedData: any };
4
+
5
+ export type GenericObject = { [key: string]: any };
6
+
7
+ /**
8
+ * The result when validating a form.
9
+ */
10
+ export type ValidationResult<DataType> =
11
+ | { data: DataType; error: undefined }
12
+ | { error: FieldErrors; data: undefined };
13
+
14
+ /**
15
+ * The result when validating an individual field in a form.
16
+ */
17
+ export type ValidateFieldResult = { error?: string };
18
+
19
+ /**
20
+ * A `Validator` can be passed to the `validator` prop of a `ValidatedForm`.
21
+ */
22
+ export type Validator<DataType> = {
23
+ validate: (unvalidatedData: GenericObject) => ValidationResult<DataType>;
24
+ validateField: (
25
+ unvalidatedData: GenericObject,
26
+ field: string
27
+ ) => ValidateFieldResult;
28
+ };
@@ -0,0 +1,322 @@
1
+ import * as yup from "yup";
2
+ import { z } from "zod";
3
+ import { Validator, withYup } from "..";
4
+ import { objectFromPathEntries } from "../internal/flatten";
5
+ import { TestFormData } from "../test-data/testFormData";
6
+ import { withZod } from "./withZod";
7
+
8
+ // If adding an adapter, write a validator that validates this shape
9
+ type Person = {
10
+ firstName: string;
11
+ lastName: string;
12
+ age?: number;
13
+ address: {
14
+ streetAddress: string;
15
+ city: string;
16
+ country: string;
17
+ };
18
+ pets?: {
19
+ animal: string;
20
+ name: string;
21
+ }[];
22
+ };
23
+
24
+ type ValidationTestCase = {
25
+ name: string;
26
+ validator: Validator<Person>;
27
+ };
28
+
29
+ const validationTestCases: ValidationTestCase[] = [
30
+ {
31
+ name: "yup",
32
+ validator: withYup(
33
+ yup.object({
34
+ firstName: yup.string().required(),
35
+ lastName: yup.string().required(),
36
+ age: yup.number(),
37
+ address: yup
38
+ .object({
39
+ streetAddress: yup.string().required(),
40
+ city: yup.string().required(),
41
+ country: yup.string().required(),
42
+ })
43
+ .required(),
44
+ pets: yup.array().of(
45
+ yup.object({
46
+ animal: yup.string().required(),
47
+ name: yup.string().required(),
48
+ })
49
+ ),
50
+ })
51
+ ),
52
+ },
53
+ {
54
+ name: "zod",
55
+ validator: withZod(
56
+ z.object({
57
+ firstName: z.string().nonempty(),
58
+ lastName: z.string().nonempty(),
59
+ age: z.optional(z.number()),
60
+ address: z.preprocess(
61
+ (value) => (value == null ? {} : value),
62
+ z.object({
63
+ streetAddress: z.string().nonempty(),
64
+ city: z.string().nonempty(),
65
+ country: z.string().nonempty(),
66
+ })
67
+ ),
68
+ pets: z
69
+ .object({
70
+ animal: z.string().nonempty(),
71
+ name: z.string().nonempty(),
72
+ })
73
+ .array()
74
+ .optional(),
75
+ })
76
+ ),
77
+ },
78
+ ];
79
+
80
+ // Not going to enforce exact error strings here
81
+ const anyString = expect.any(String);
82
+
83
+ describe("Validation", () => {
84
+ describe.each(validationTestCases)("Adapter for $name", ({ validator }) => {
85
+ describe("validate", () => {
86
+ it("should return the data when valid", () => {
87
+ const person: Person = {
88
+ firstName: "John",
89
+ lastName: "Doe",
90
+ age: 30,
91
+ address: {
92
+ streetAddress: "123 Main St",
93
+ city: "Anytown",
94
+ country: "USA",
95
+ },
96
+ pets: [{ animal: "dog", name: "Fido" }],
97
+ };
98
+ expect(validator.validate(person)).toEqual({
99
+ data: person,
100
+ error: undefined,
101
+ });
102
+ });
103
+
104
+ it("should return field errors when invalid", () => {
105
+ const obj = { age: "hi!", pets: [{ animal: "dog" }] };
106
+ expect(validator.validate(obj)).toEqual({
107
+ data: undefined,
108
+ error: {
109
+ firstName: anyString,
110
+ lastName: anyString,
111
+ age: anyString,
112
+ "address.city": anyString,
113
+ "address.country": anyString,
114
+ "address.streetAddress": anyString,
115
+ "pets[0].name": anyString,
116
+ _submittedData: obj,
117
+ },
118
+ });
119
+ });
120
+
121
+ it("should unflatten data when validating", () => {
122
+ const data = {
123
+ firstName: "John",
124
+ lastName: "Doe",
125
+ age: 30,
126
+ "address.streetAddress": "123 Main St",
127
+ "address.city": "Anytown",
128
+ "address.country": "USA",
129
+ "pets[0].animal": "dog",
130
+ "pets[0].name": "Fido",
131
+ };
132
+ expect(validator.validate(data)).toEqual({
133
+ data: {
134
+ firstName: "John",
135
+ lastName: "Doe",
136
+ age: 30,
137
+ address: {
138
+ streetAddress: "123 Main St",
139
+ city: "Anytown",
140
+ country: "USA",
141
+ },
142
+ pets: [{ animal: "dog", name: "Fido" }],
143
+ },
144
+ error: undefined,
145
+ });
146
+ });
147
+
148
+ it("should accept FormData directly and return errors", () => {
149
+ const formData = new TestFormData();
150
+ formData.set("firstName", "John");
151
+ formData.set("lastName", "Doe");
152
+ formData.set("address.streetAddress", "123 Main St");
153
+ formData.set("address.country", "USA");
154
+ formData.set("pets[0].animal", "dog");
155
+
156
+ expect(validator.validate(formData)).toEqual({
157
+ data: undefined,
158
+ error: {
159
+ "address.city": anyString,
160
+ "pets[0].name": anyString,
161
+ _submittedData: objectFromPathEntries([...formData.entries()]),
162
+ },
163
+ });
164
+ });
165
+
166
+ it("should accept FormData directly and return valid data", () => {
167
+ const formData = new TestFormData();
168
+ formData.set("firstName", "John");
169
+ formData.set("lastName", "Doe");
170
+ formData.set("address.streetAddress", "123 Main St");
171
+ formData.set("address.country", "USA");
172
+ formData.set("address.city", "Anytown");
173
+ formData.set("pets[0].animal", "dog");
174
+ formData.set("pets[0].name", "Fido");
175
+
176
+ expect(validator.validate(formData)).toEqual({
177
+ data: {
178
+ firstName: "John",
179
+ lastName: "Doe",
180
+ address: {
181
+ streetAddress: "123 Main St",
182
+ country: "USA",
183
+ city: "Anytown",
184
+ },
185
+ pets: [{ animal: "dog", name: "Fido" }],
186
+ },
187
+ error: undefined,
188
+ });
189
+ });
190
+ });
191
+
192
+ describe("validateField", () => {
193
+ it("should not return an error if field is valid", () => {
194
+ const person = {
195
+ firstName: "John",
196
+ lastName: {}, // invalid, but we should only be validating firstName
197
+ };
198
+ expect(validator.validateField(person, "firstName")).toEqual({
199
+ error: undefined,
200
+ });
201
+ });
202
+ it("should not return an error if a nested field is valid", () => {
203
+ const person = {
204
+ firstName: "John",
205
+ lastName: {}, // invalid, but we should only be validating firstName
206
+ address: {
207
+ streetAddress: "123 Main St",
208
+ city: "Anytown",
209
+ country: "USA",
210
+ },
211
+ pets: [{ animal: "dog", name: "Fido" }],
212
+ };
213
+ expect(
214
+ validator.validateField(person, "address.streetAddress")
215
+ ).toEqual({
216
+ error: undefined,
217
+ });
218
+ expect(validator.validateField(person, "address.city")).toEqual({
219
+ error: undefined,
220
+ });
221
+ expect(validator.validateField(person, "address.country")).toEqual({
222
+ error: undefined,
223
+ });
224
+ expect(validator.validateField(person, "pets[0].animal")).toEqual({
225
+ error: undefined,
226
+ });
227
+ expect(validator.validateField(person, "pets[0].name")).toEqual({
228
+ error: undefined,
229
+ });
230
+ });
231
+
232
+ it("should return an error if field is invalid", () => {
233
+ const person = {
234
+ firstName: "John",
235
+ lastName: {},
236
+ address: {
237
+ streetAddress: "123 Main St",
238
+ city: 1234,
239
+ },
240
+ };
241
+ expect(validator.validateField(person, "lastName")).toEqual({
242
+ error: anyString,
243
+ });
244
+ });
245
+
246
+ it("should return an error if a nested field is invalid", () => {
247
+ const person = {
248
+ firstName: "John",
249
+ lastName: {},
250
+ address: {
251
+ streetAddress: "123 Main St",
252
+ city: 1234,
253
+ },
254
+ pets: [{ animal: "dog" }],
255
+ };
256
+ expect(validator.validateField(person, "address.country")).toEqual({
257
+ error: anyString,
258
+ });
259
+ expect(validator.validateField(person, "pets[0].name")).toEqual({
260
+ error: anyString,
261
+ });
262
+ });
263
+ });
264
+ });
265
+ });
266
+
267
+ describe("withZod", () => {
268
+ it("returns coherent errors for complex schemas", () => {
269
+ const schema = z.union([
270
+ z.object({
271
+ type: z.literal("foo"),
272
+ foo: z.string(),
273
+ }),
274
+ z.object({
275
+ type: z.literal("bar"),
276
+ bar: z.string(),
277
+ }),
278
+ ]);
279
+ const obj = {
280
+ type: "foo",
281
+ bar: 123,
282
+ foo: 123,
283
+ };
284
+
285
+ expect(withZod(schema).validate(obj)).toEqual({
286
+ data: undefined,
287
+ error: {
288
+ type: anyString,
289
+ bar: anyString,
290
+ foo: anyString,
291
+ _submittedData: obj,
292
+ },
293
+ });
294
+ });
295
+
296
+ it("returns errors for fields that are unions", () => {
297
+ const schema = z.object({
298
+ field1: z.union([z.literal("foo"), z.literal("bar")]),
299
+ field2: z.union([z.literal("foo"), z.literal("bar")]),
300
+ });
301
+ const obj = {
302
+ field1: "a value",
303
+ // field2 missing
304
+ };
305
+
306
+ const validator = withZod(schema);
307
+ expect(validator.validate(obj)).toEqual({
308
+ data: undefined,
309
+ error: {
310
+ field1: anyString,
311
+ field2: anyString,
312
+ _submittedData: obj,
313
+ },
314
+ });
315
+ expect(validator.validateField(obj, "field1")).toEqual({
316
+ error: anyString,
317
+ });
318
+ expect(validator.validateField(obj, "field2")).toEqual({
319
+ error: anyString,
320
+ });
321
+ });
322
+ });
@@ -0,0 +1,43 @@
1
+ import type { AnyObjectSchema, InferType, ValidationError } from "yup";
2
+ import { createValidator } from "./createValidator";
3
+ import { FieldErrors, Validator } from "./types";
4
+
5
+ const validationErrorToFieldErrors = (error: ValidationError): FieldErrors => {
6
+ const fieldErrors: FieldErrors = {};
7
+ error.inner.forEach((innerError) => {
8
+ if (!innerError.path) return;
9
+ fieldErrors[innerError.path] = innerError.message;
10
+ });
11
+ return fieldErrors;
12
+ };
13
+
14
+ /**
15
+ * Create a `Validator` using a `yup` schema.
16
+ */
17
+ export const withYup = <Schema extends AnyObjectSchema>(
18
+ validationSchema: Schema
19
+ ): Validator<InferType<Schema>> => {
20
+ return createValidator({
21
+ validate: (data) => {
22
+ try {
23
+ const validated = validationSchema.validateSync(data, {
24
+ abortEarly: false,
25
+ });
26
+ return { data: validated, error: undefined };
27
+ } catch (err) {
28
+ return {
29
+ error: validationErrorToFieldErrors(err as ValidationError),
30
+ data: undefined,
31
+ };
32
+ }
33
+ },
34
+ validateField: (data, field) => {
35
+ try {
36
+ validationSchema.validateSyncAt(field, data);
37
+ return {};
38
+ } catch (err) {
39
+ return { error: (err as ValidationError).message };
40
+ }
41
+ },
42
+ });
43
+ };
@@ -0,0 +1,51 @@
1
+ import isEqual from "lodash/isEqual";
2
+ import toPath from "lodash/toPath";
3
+ import type { z } from "zod";
4
+ import { FieldErrors, Validator } from "..";
5
+ import { createValidator } from "./createValidator";
6
+
7
+ const getIssuesForError = (err: z.ZodError<any>): z.ZodIssue[] => {
8
+ return err.issues.flatMap((issue) => {
9
+ if ("unionErrors" in issue) {
10
+ return issue.unionErrors.flatMap((err) => getIssuesForError(err));
11
+ } else {
12
+ return [issue];
13
+ }
14
+ });
15
+ };
16
+
17
+ function pathToString(array: (string | number)[]): string {
18
+ return array.reduce(function (string: string, item: string | number) {
19
+ var prefix = string === "" ? "" : ".";
20
+ return string + (isNaN(Number(item)) ? prefix + item : "[" + item + "]");
21
+ }, "");
22
+ }
23
+
24
+ /**
25
+ * Create a validator using a `zod` schema.
26
+ */
27
+ export function withZod<T>(zodSchema: z.Schema<T>): Validator<T> {
28
+ return createValidator({
29
+ validate: (value) => {
30
+ const result = zodSchema.safeParse(value);
31
+ if (result.success) return { data: result.data, error: undefined };
32
+
33
+ const fieldErrors: FieldErrors = {};
34
+ getIssuesForError(result.error).forEach((issue) => {
35
+ const path = pathToString(issue.path);
36
+ if (!fieldErrors[path]) fieldErrors[path] = issue.message;
37
+ });
38
+ return { error: fieldErrors, data: undefined };
39
+ },
40
+ validateField: (data, field) => {
41
+ const result = zodSchema.safeParse(data);
42
+ if (result.success) return { error: undefined };
43
+ return {
44
+ error: getIssuesForError(result.error).find((issue) => {
45
+ const allPathsAsString = issue.path.map((p) => `${p}`);
46
+ return isEqual(allPathsAsString, toPath(field));
47
+ })?.message,
48
+ };
49
+ },
50
+ });
51
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "tsconfig/tsconfig.json",
3
+ "include": ["src/**/*.ts", "src/**/*.tsx"],
4
+ "exclude": ["node_modules"]
5
+ }
package/.eslintcache DELETED
@@ -1 +0,0 @@
1
- [{"/Users/aaronpettengill/dev/remix-validated-form/src/server.ts":"1","/Users/aaronpettengill/dev/remix-validated-form/src/validation/types.ts":"2","/Users/aaronpettengill/dev/remix-validated-form/src/validation/withYup.ts":"3","/Users/aaronpettengill/dev/remix-validated-form/test-app/app/routes/validation.tsx":"4","/Users/aaronpettengill/dev/remix-validated-form/test-app/app/routes/validation-fetcher.tsx":"5","/Users/aaronpettengill/dev/remix-validated-form/test-app/cypress/integration/validation-with-fetchers.ts":"6","/Users/aaronpettengill/dev/remix-validated-form/src/validation/validation.test.ts":"7","/Users/aaronpettengill/dev/remix-validated-form/src/validation/withZod.ts":"8"},{"size":207,"mtime":1637876506168,"results":"9","hashOfConfig":"10"},{"size":438,"mtime":1637877226360,"results":"11","hashOfConfig":"10"},{"size":1085,"mtime":1637877476573,"results":"12","hashOfConfig":"10"},{"size":1293,"mtime":1637876566355,"results":"13","hashOfConfig":"10"},{"size":1330,"mtime":1637902697212,"results":"14","hashOfConfig":"10"},{"size":2220,"mtime":1637902736281,"results":"15","hashOfConfig":"10"},{"size":3526,"mtime":1638155421909,"results":"16","hashOfConfig":"10"},{"size":1168,"mtime":1638155747107,"results":"17","hashOfConfig":"10"},{"filePath":"18","messages":"19","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"bt07le",{"filePath":"20","messages":"21","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"22","messages":"23","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"24","messages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"26","messages":"27","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"28","messages":"29","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"32","messages":"33","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/aaronpettengill/dev/remix-validated-form/src/server.ts",[],"/Users/aaronpettengill/dev/remix-validated-form/src/validation/types.ts",[],"/Users/aaronpettengill/dev/remix-validated-form/src/validation/withYup.ts",["34"],"/Users/aaronpettengill/dev/remix-validated-form/test-app/app/routes/validation.tsx",[],"/Users/aaronpettengill/dev/remix-validated-form/test-app/app/routes/validation-fetcher.tsx",["35"],"/Users/aaronpettengill/dev/remix-validated-form/test-app/cypress/integration/validation-with-fetchers.ts",[],"/Users/aaronpettengill/dev/remix-validated-form/src/validation/validation.test.ts",[],"/Users/aaronpettengill/dev/remix-validated-form/src/validation/withZod.ts",[],{"ruleId":"36","severity":1,"message":"37","line":2,"column":23,"nodeType":"38","messageId":"39","endLine":2,"endColumn":39},{"ruleId":"36","severity":1,"message":"40","line":1,"column":26,"nodeType":"38","messageId":"39","endLine":1,"endColumn":39},"@typescript-eslint/no-unused-vars","'ValidationResult' is defined but never used.","Identifier","unusedVar","'useActionData' is defined but never used."]
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- ./package-lock.json
package/.prettierignore DELETED
@@ -1,8 +0,0 @@
1
- .cache
2
- build
3
- browser
4
- test-app/build
5
- test-app/remix-validated-form
6
- node_modules
7
- public
8
- package-lock.json
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 Aaron Pettengill
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.