Skip to content

Commit c5b9774

Browse files
committed
chore: added code format for zod example in docs
1 parent 5f53281 commit c5b9774

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

docs/en/5-reference/5.0-form-instrument.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ Always consider using \`group\`ing to structure sections
5555
- Make sure your rules are correct given the paper form
5656
- Please familiarize yourself with the possible validation rules here
5757
- Be careful to write the most restrictive validation schema possible
58-
- Example: likert-scale data should be .int()
59-
- Example: A select from multiple string options question should be .enum(['option1','option2', ...]) instead of .string()
58+
- Example: likert-scale data should be `.int()`
59+
- Example: A select from multiple string options question should be `.enum(['option1','option2', ...])` instead of `.string()`
6060
- Remember the API data-entry is independent of the form, so the validation schema must properly restrict API entry as well
6161
5. Please make sure to format your code whenever possible, as this can prevent annoying issues with missing brackets. In the playground, you can do this with (Alt + F)
6262
6. If you find yourself repeating code frequently, consider extracting the logic into shared variables. The guiding principle of this should be to maximize readability.
63-
- For example, if your data schema is z.number().int().min(0).max(7) for every field, consider moving it into a variable, as this can reduce the cognitive load of programmers reading your form
63+
- For example, if your data schema is `z.number().int().min(0).max(7)` for every field, consider moving it into a variable, as this can reduce the cognitive load of programmers reading your form
6464
- On the other hand, if this is the schema for only two or three variables, creating a variable would probably increase cognitive load, rather than reducing it.
6565
- The same applies for computed measures (i.e., define a function at the top of your file instead of copy-pasting it to every field).
6666
7. Review common styling conventions
@@ -70,7 +70,7 @@ Always consider using \`group\`ing to structure sections
7070
- It is setup with formatting, linting, and type checking by default
7171
9. Proper use of Zod's enum type
7272
- It is best to use Zod's enum type when the answer to a form question is a set of constant values.
73-
- Example: A question which asks the user to choose from a selection of options should use z.enum([option1, option2, ...]) within its zod validation schema.
73+
- Example: A question which asks the user to choose from a selection of options should use `z.enum([option1, option2, ...])` within its zod validation schema.
7474

7575
### Example
7676

0 commit comments

Comments
 (0)