Skip to content

Commit bd6b46f

Browse files
improve build settings (#33)
* update peerDeps * improve eslint and prettier setting * add husky and lint-staged * improve npm-scripts * update package.json * improve github workflow * improve rollup setting * fix example app
1 parent 5308513 commit bd6b46f

32 files changed

+806
-1494
lines changed

.eslintignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/app
2+
/node_modules
3+
/dist
4+
/esm
5+
/coverage
6+
!.*.js

.eslintrc.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
11
module.exports = {
22
parser: '@typescript-eslint/parser',
3+
plugins: ['@typescript-eslint', 'react-hooks'],
34
extends: [
4-
'plugin:@typescript-eslint/recommended',
55
'plugin:react/recommended',
6+
'plugin:@typescript-eslint/recommended',
7+
'prettier/@typescript-eslint',
8+
'plugin:prettier/recommended',
69
],
10+
parser: '@typescript-eslint/parser',
711
parserOptions: {
8-
ecmaVersion: 2018,
12+
ecmaVersion: 2020,
913
sourceType: 'module',
14+
ecmaFeatures: {
15+
jsx: true,
16+
},
1017
},
11-
plugins: ['react-hooks'],
1218
rules: {
1319
curly: 'error',
14-
'@typescript-eslint/indent': 'off',
20+
'@typescript-eslint/ban-types': 'off',
1521
'@typescript-eslint/no-non-null-assertion': 'off',
1622
'@typescript-eslint/no-explicit-any': 'off',
17-
'@typescript-eslint/explicit-function-return-type': 'off',
23+
'@typescript-eslint/explicit-module-boundary-types': 'off',
1824
'@typescript-eslint/no-object-literal-type-assertion': 'off',
1925
'react-hooks/rules-of-hooks': 'error',
2026
'react-hooks/exhaustive-deps': 'error',
2127
'no-console': 'error',
2228
},
2329
settings: {
2430
react: {
25-
pragma: 'React',
2631
version: 'detect',
2732
},
2833
},

.github/workflows/blank.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
paths-ignore:
10+
- ".gitignore"
11+
- ".npmignore"
12+
- "*.md"
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
node-version: [12.x]
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v1
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
- name: Install dependencies
26+
run: yarn install --frozen-lockfile
27+
- name: Lint
28+
run: |
29+
npm run lint:types
30+
npm run lint
31+
- name: Test
32+
run: npm test
33+
env:
34+
CI: true
35+
- name: Build
36+
run: npm run build

.prettierrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

.prettierrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
singleQuote: true,
3+
trailingComma: 'all',
4+
};

.vscode/settings.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
{
2-
"eslint.validate": [
3-
"javascript",
4-
"javascriptreact",
5-
"typescript",
6-
"typescriptreact"
7-
],
8-
"prettier.configPath": "./.prettierrc",
9-
"eslint.enable": true,
10-
"editor.formatOnSave": true,
112
"editor.codeActionsOnSave": {
123
"source.fixAll.eslint": true
134
},
145
"typescript.tsdk": "node_modules/typescript/lib"
15-
}
6+
}

app/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,18 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@emotion/core": "^10.0.27",
7-
"@emotion/styled": "^10.0.27",
6+
"@hookform/devtools": "^2.0.0-beta.2",
87
"@testing-library/jest-dom": "^4.2.4",
98
"@testing-library/react": "^9.3.2",
109
"@testing-library/user-event": "^7.1.2",
1110
"@types/jest": "^24.0.0",
12-
"@types/lodash": "^4.14.149",
1311
"@types/node": "^12.0.0",
1412
"@types/react": "^16.9.0",
1513
"@types/react-dom": "^16.9.0",
16-
"little-state-machine": "^2.11.3",
17-
"lodash": "^4.17.15",
1814
"react": "^16.12.0",
1915
"react-dom": "^16.12.0",
20-
"react-hook-form": "^5.6.1",
21-
"react-hook-form-devtools": "1.0.1-beta.1",
16+
"react-hook-form": "^6.0.0-rc.4",
2217
"react-scripts": "3.3.1",
23-
"react-simple-animate": "^3.3.6",
2418
"typescript": "~3.7.2"
2519
},
2620
"scripts": {

app/src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { useForm } from 'react-hook-form';
3-
import { DevTool } from './devTool';
3+
import { DevTool } from '@hookform/devtools';
44
import './App.css';
55

66
const App = () => {
@@ -13,7 +13,7 @@ const App = () => {
1313
});
1414

1515
React.useEffect(() => {
16-
register('customInput');
16+
register('custom');
1717
}, [register]);
1818

1919
console.log('app', formState.touched);

app/src/devTool/colors.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)