Skip to content

Commit 147bd62

Browse files
authored
Upgrade deps (#943)
* Upgraded deps * Upgraded react in examples * Upgraded FF and RFF in examples * Prettier * Node version * Travis and Github actions * Removed glow dep * Maybe fix CS CI bug?
1 parent 6658232 commit 147bd62

File tree

193 files changed

+4856
-4772
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+4856
-4772
lines changed

.babelrc.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
const { NODE_ENV } = process.env
2-
const test = NODE_ENV === 'test'
3-
const loose = true
1+
const { NODE_ENV } = process.env;
2+
const test = NODE_ENV === "test";
3+
const loose = true;
44

55
module.exports = {
66
presets: [
77
[
8-
'@babel/preset-env',
8+
"@babel/preset-env",
99
{
1010
loose,
11-
...(test ? { targets: { node: '8' } } : {})
12-
}
11+
...(test ? { targets: { node: "8" } } : {}),
12+
},
1313
],
14-
'@babel/preset-react',
15-
'@babel/preset-flow'
14+
"@babel/preset-react",
15+
"@babel/preset-flow",
1616
],
1717
plugins: [
18-
'@babel/plugin-transform-flow-strip-types',
19-
'@babel/plugin-syntax-dynamic-import',
20-
'@babel/plugin-syntax-import-meta',
21-
['@babel/plugin-proposal-class-properties', { loose }],
22-
'@babel/plugin-proposal-json-strings',
18+
"@babel/plugin-transform-flow-strip-types",
19+
"@babel/plugin-syntax-dynamic-import",
20+
"@babel/plugin-syntax-import-meta",
21+
["@babel/plugin-proposal-class-properties", { loose }],
22+
"@babel/plugin-proposal-json-strings",
2323
[
24-
'@babel/plugin-proposal-decorators',
24+
"@babel/plugin-proposal-decorators",
2525
{
26-
legacy: true
27-
}
26+
legacy: true,
27+
},
2828
],
29-
'@babel/plugin-proposal-function-sent',
30-
'@babel/plugin-proposal-export-namespace-from',
31-
'@babel/plugin-proposal-numeric-separator',
32-
'@babel/plugin-proposal-throw-expressions',
33-
test && '@babel/plugin-transform-react-jsx-source'
34-
].filter(Boolean)
35-
}
29+
"@babel/plugin-proposal-function-sent",
30+
"@babel/plugin-proposal-export-namespace-from",
31+
"@babel/plugin-proposal-numeric-separator",
32+
"@babel/plugin-proposal-throw-expressions",
33+
test && "@babel/plugin-transform-react-jsx-source",
34+
].filter(Boolean),
35+
};

.codesandbox/ci.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"/examples/field-level-validation",
66
"/examples/submission-errors",
77
"/examples/subscriptions"
8-
]
8+
],
9+
"node": "14"
910
}

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"rules": {
55
"jsx-a11y/href-no-hash": 0,
66
"react-hooks/rules-of-hooks": "error",
7-
"react-hooks/exhaustive-deps": "warn"
7+
"react-hooks/exhaustive-deps": "warn",
8+
"import/no-anonymous-default-export": 0
89
}
910
}

.github/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
lint:
7+
name: Prettier Check
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Use Node.js ${{ matrix.node_version }}
13+
uses: actions/setup-node@v2
14+
with:
15+
node-version: "14"
16+
- name: Prepare env
17+
run: yarn install --ignore-scripts --frozen-lockfile
18+
- name: Run linter
19+
run: yarn start lint
20+
21+
prettier:
22+
name: Prettier Check
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Use Node.js ${{ matrix.node_version }}
28+
uses: actions/setup-node@v2
29+
with:
30+
node-version: "14"
31+
- name: Prepare env
32+
run: yarn install --ignore-scripts --frozen-lockfile
33+
- name: Run prettier
34+
run: yarn start prettier
35+
36+
test:
37+
name: Unit Tests
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- uses: actions/checkout@v2
42+
- name: Use Node.js ${{ matrix.node_version }}
43+
uses: actions/setup-node@v2
44+
with:
45+
node-version: "14"
46+
- name: Prepare env
47+
run: yarn install --ignore-scripts --frozen-lockfile
48+
- name: Run unit tests
49+
run: yarn start test
50+
- name: Run code coverage
51+
run: npx codecov

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage
2+
dist
3+
node_modules

.prettierrc

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
11
{
2-
"semi": false,
3-
"singleQuote": true,
4-
"trailingComma": "none",
5-
"arrowParens": "avoid",
6-
"overrides": [
7-
{
8-
"files": [".prettierrc"],
9-
"options": { "parser": "json" }
10-
},
11-
{
12-
"files": ["*.ts*"],
13-
"options": {
14-
"semi": true
15-
}
16-
}
17-
]
2+
"trailingComma": "all"
183
}

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ cache:
88
notifications:
99
email: false
1010
node_js:
11-
- '10'
12-
- '12'
13-
- '14'
11+
- "10"
12+
- "12"
13+
- "14"
1414
script:
1515
- npm start validate
1616
after_success:
1717
- npx codecov
1818
branches:
1919
only:
20-
- master
20+
- main

examples/async-field-level-validation/Styles.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ const btn = (light, dark) => css`
2727
}
2828
`;
2929

30-
const btnDefault = css`${btn("#ffffff", "#d5d5d5")} color: #555;`;
30+
const btnDefault = css`
31+
${btn("#ffffff", "#d5d5d5")} color: #555;
32+
`;
3133

3234
const btnPrimary = btn("#4f93ce", "#285f8f");
3335

examples/async-field-level-validation/index.js

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,58 @@
1-
import React from 'react'
2-
import { render } from 'react-dom'
3-
import Styles from './Styles'
4-
import Spinner from './Spinner'
5-
import { Form, Field } from 'react-final-form'
1+
import React from "react";
2+
import { render } from "react-dom";
3+
import Styles from "./Styles";
4+
import Spinner from "./Spinner";
5+
import { Form, Field } from "react-final-form";
66

7-
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
7+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
88

9-
const onSubmit = async values => {
10-
await sleep(300)
11-
window.alert(JSON.stringify(values, undefined, 2))
12-
}
9+
const onSubmit = async (values) => {
10+
await sleep(300);
11+
window.alert(JSON.stringify(values, undefined, 2));
12+
};
1313

14-
const required = value => (value ? undefined : 'Required')
15-
const mustBeNumber = value => (isNaN(value) ? 'Must be a number' : undefined)
16-
const minValue = min => value =>
17-
isNaN(value) || value >= min ? undefined : `Should be greater than ${min}`
18-
const composeValidators = (...validators) => value =>
19-
validators.reduce((error, validator) => error || validator(value), undefined)
14+
const required = (value) => (value ? undefined : "Required");
15+
const mustBeNumber = (value) => (isNaN(value) ? "Must be a number" : undefined);
16+
const minValue = (min) => (value) =>
17+
isNaN(value) || value >= min ? undefined : `Should be greater than ${min}`;
18+
const composeValidators =
19+
(...validators) =>
20+
(value) =>
21+
validators.reduce(
22+
(error, validator) => error || validator(value),
23+
undefined,
24+
);
2025

21-
const simpleMemoize = fn => {
22-
let lastArg
23-
let lastResult
24-
return arg => {
26+
const simpleMemoize = (fn) => {
27+
let lastArg;
28+
let lastResult;
29+
return (arg) => {
2530
if (arg !== lastArg) {
26-
lastArg = arg
27-
lastResult = fn(arg)
31+
lastArg = arg;
32+
lastResult = fn(arg);
2833
}
29-
return lastResult
30-
}
31-
}
34+
return lastResult;
35+
};
36+
};
3237

33-
const usernameAvailable = simpleMemoize(async value => {
38+
const usernameAvailable = simpleMemoize(async (value) => {
3439
if (!value) {
35-
return 'Required'
40+
return "Required";
3641
}
37-
await sleep(400)
42+
await sleep(400);
3843
if (
39-
~['john', 'paul', 'george', 'ringo'].indexOf(value && value.toLowerCase())
44+
~["john", "paul", "george", "ringo"].indexOf(value && value.toLowerCase())
4045
) {
41-
return 'Username taken!'
46+
return "Username taken!";
4247
}
43-
})
48+
});
4449

4550
const App = () => (
4651
<Styles>
4752
<h1>
4853
<span role="img" aria-label="final form flag">
4954
🏁
50-
</span>{' '}
55+
</span>{" "}
5156
React Final Form Example
5257
</h1>
5358
<h2>Asynchronous Field-Level Validation</h2>
@@ -107,6 +112,6 @@ const App = () => (
107112
)}
108113
/>
109114
</Styles>
110-
)
115+
);
111116

112-
render(<App />, document.getElementById('root'))
117+
render(<App />, document.getElementById("root"));

examples/async-field-level-validation/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
],
1212
"main": "index.js",
1313
"dependencies": {
14-
"final-form": "4.16.1",
15-
"react": "16.8.6",
16-
"react-dom": "16.8.6",
17-
"react-final-form": "6.3.0",
14+
"final-form": "4.20.2",
15+
"react": "17.0.2",
16+
"react-dom": "17.0.2",
17+
"react-final-form": "6.5.3",
1818
"styled-components": "4.2.0"
1919
}
20-
}
20+
}

0 commit comments

Comments
 (0)