Skip to content
Permalink
Browse files

Fix unnecessary let usage (#1964)

When only properties are updated on the error object it should be `const` not `let`.
  • Loading branch information...
karl-run authored and jaredpalmer committed Nov 1, 2019
1 parent a2b66c5 commit a4ebf84c016f3e427d2297e67fcd4951c111bd8a
Showing with 60 additions and 60 deletions.
  1. +2 βˆ’2 docs/api/formik.md
  2. +2 βˆ’2 docs/api/withFormik.md
  3. +2 βˆ’2 docs/guides/validation.md
  4. +2 βˆ’2 docs/overview.md
  5. +1 βˆ’1 examples/AsyncValidation.js
  6. +1 βˆ’1 examples/SyncValidation.js
  7. +2 βˆ’2 website/versioned_docs/version-1.2.0/api/formik.md
  8. +2 βˆ’2 website/versioned_docs/version-1.2.0/api/withFormik.md
  9. +2 βˆ’2 website/versioned_docs/version-1.2.0/guides/validation.md
  10. +2 βˆ’2 website/versioned_docs/version-1.2.0/overview.md
  11. +2 βˆ’2 website/versioned_docs/version-1.3.0/overview.md
  12. +2 βˆ’2 website/versioned_docs/version-1.3.1/guides/validation.md
  13. +2 βˆ’2 website/versioned_docs/version-1.3.2/api/formik.md
  14. +2 βˆ’2 website/versioned_docs/version-1.3.2/guides/validation.md
  15. +2 βˆ’2 website/versioned_docs/version-1.4.0/api/formik.md
  16. +2 βˆ’2 website/versioned_docs/version-1.4.0/guides/validation.md
  17. +2 βˆ’2 website/versioned_docs/version-1.4.2/api/formik.md
  18. +2 βˆ’2 website/versioned_docs/version-1.4.2/guides/validation.md
  19. +2 βˆ’2 website/versioned_docs/version-1.4.3/guides/validation.md
  20. +2 βˆ’2 website/versioned_docs/version-1.4.3/overview.md
  21. +2 βˆ’2 website/versioned_docs/version-1.5.0/api/formik.md
  22. +2 βˆ’2 website/versioned_docs/version-1.5.0/api/withFormik.md
  23. +2 βˆ’2 website/versioned_docs/version-1.5.1/guides/validation.md
  24. +2 βˆ’2 website/versioned_docs/version-1.5.2/api/formik.md
  25. +2 βˆ’2 website/versioned_docs/version-1.5.3/api/formik.md
  26. +2 βˆ’2 website/versioned_docs/version-1.5.3/overview.md
  27. +2 βˆ’2 website/versioned_docs/version-1.5.5/api/formik.md
  28. +2 βˆ’2 website/versioned_docs/version-2.0.3/api/formik.md
  29. +2 βˆ’2 website/versioned_docs/version-2.0.3/api/withFormik.md
  30. +2 βˆ’2 website/versioned_docs/version-2.0.3/guides/validation.md
  31. +2 βˆ’2 website/versioned_docs/version-2.0.3/overview.md
@@ -348,7 +348,7 @@ Validate the form's `values` with function. This function can either be:
```js
// Synchronous validation
const validate = values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -370,7 +370,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = values => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -161,7 +161,7 @@ Validate the form's `values` with function. This function can either be:
```js
// Synchronous validation
const validate = (values, props) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -183,7 +183,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values, props) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -27,7 +27,7 @@ There are 2 ways to do form-level validation with Formik:
```js
// Synchronous validation
const validate = (values, props /* only available when using withFormik */) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -45,7 +45,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values, props /* only available when using withFormik */) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -116,7 +116,7 @@ const Basic = () => (
<Formik
initialValues={{ email: '', password: '' }}
validate={values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
} else if (
@@ -187,7 +187,7 @@ const Basic = () => (
<Formik
initialValues={{ email: '', password: '' }}
validate={values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
} else if (
@@ -7,7 +7,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));

const validate = (values) => {
return sleep(300).then(() => {
let errors = {};
const errors = {};

if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
@@ -3,7 +3,7 @@ import { Formik, Field, Form, ErrorMessage } from 'formik';
import { Debug } from './Debug';

const validate = values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
} else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(values.email)) {
@@ -327,7 +327,7 @@ Validate the form's `values` with function. This function can either be:
```js
// Synchronous validation
const validate = (values) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -349,7 +349,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -142,7 +142,7 @@ Validate the form's `values` with function. This function can either be:
```js
// Synchronous validation
const validate = (values, props) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -164,7 +164,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values, props) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -28,7 +28,7 @@ There are 2 ways to do form-level validation with Formik:
```js
// Synchronous validation
const validate = (values, props /* only available when using withFormik */) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -46,7 +46,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values, props /* only available when using withFormik */) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -107,7 +107,7 @@ const Basic = () => (
<Formik
initialValues={{ email: '', password: '' }}
validate={values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
} else if (
@@ -178,7 +178,7 @@ const Basic = () => (
<Formik
initialValues={{ email: '', password: '' }}
validate={values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
} else if (
@@ -113,7 +113,7 @@ const Basic = () => (
<Formik
initialValues={{ email: '', password: '' }}
validate={values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
} else if (
@@ -184,7 +184,7 @@ const Basic = () => (
<Formik
initialValues={{ email: '', password: '' }}
validate={values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
} else if (
@@ -28,7 +28,7 @@ There are 2 ways to do form-level validation with Formik:
```js
// Synchronous validation
const validate = (values) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -46,7 +46,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -327,7 +327,7 @@ Validate the form's `values` with function. This function can either be:
```js
// Synchronous validation
const validate = (values) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -349,7 +349,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -28,7 +28,7 @@ There are 2 ways to do form-level validation with Formik:
```js
// Synchronous validation
const validate = (values, props /* only available when using withFormik */) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -46,7 +46,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values, props /* only available when using withFormik */) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -327,7 +327,7 @@ Validate the form's `values` with function. This function can either be:
```js
// Synchronous validation
const validate = values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -349,7 +349,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = values => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -28,7 +28,7 @@ There are 2 ways to do form-level validation with Formik:
```js
// Synchronous validation
const validate = (values, props /* only available when using withFormik */) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -46,7 +46,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values, props /* only available when using withFormik */) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -327,7 +327,7 @@ Validate the form's `values` with function. This function can either be:
```js
// Synchronous validation
const validate = values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -349,7 +349,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = values => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -28,7 +28,7 @@ There are 2 ways to do form-level validation with Formik:
```js
// Synchronous validation
const validate = (values, props /* only available when using withFormik */) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -46,7 +46,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values, props /* only available when using withFormik */) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -28,7 +28,7 @@ There are 2 ways to do form-level validation with Formik:
```js
// Synchronous validation
const validate = (values, props /* only available when using withFormik */) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -46,7 +46,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values, props /* only available when using withFormik */) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -115,7 +115,7 @@ const Basic = () => (
<Formik
initialValues={{ email: '', password: '' }}
validate={values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
} else if (
@@ -186,7 +186,7 @@ const Basic = () => (
<Formik
initialValues={{ email: '', password: '' }}
validate={values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
} else if (
@@ -334,7 +334,7 @@ Validate the form's `values` with function. This function can either be:
```js
// Synchronous validation
const validate = values => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -356,7 +356,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = values => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -148,7 +148,7 @@ Validate the form's `values` with function. This function can either be:
```js
// Synchronous validation
const validate = (values, props) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -170,7 +170,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values, props) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}
@@ -28,7 +28,7 @@ There are 2 ways to do form-level validation with Formik:
```js
// Synchronous validation
const validate = (values, props /* only available when using withFormik */) => {
let errors = {};
const errors = {};
if (!values.email) {
errors.email = 'Required';
@@ -46,7 +46,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const validate = (values, props /* only available when using withFormik */) => {
return sleep(2000).then(() => {
let errors = {};
const errors = {};
if (['admin', 'null', 'god'].includes(values.username)) {
errors.username = 'Nice try';
}

0 comments on commit a4ebf84

Please sign in to comment.
You can’t perform that action at this time.