Skip to content

Commit

Permalink
#6: More restrictive verifications before commit
Browse files Browse the repository at this point in the history
- Invoke TSLint
- Invoke tsc to type-check tests (facebook/create-react-app#5626)
  • Loading branch information
netzwerg committed Sep 11, 2019
1 parent 9361cfc commit e8b11dc
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 8 deletions.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"tslint-react": "4.0.0",
"tslint-react-hooks": "2.2.1",
"react-scripts": "3.1.1",
"typescript": "3.6.2"
"typescript": "3.6.2",
"yarpm": "^0.2.1"
},
"resolutions": {
"eslint-utils": "^1.4.2"
Expand All @@ -38,7 +39,8 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"lint": "tslint --project ."
},
"browserslist": {
"production": [
Expand All @@ -60,7 +62,7 @@
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
"pre-commit": "lint-staged && tsc && yarpm-yarn run lint"
}
}
}
2 changes: 1 addition & 1 deletion src/__tests__/store/reducer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('root reducer', () => {
it(`should handle ${ADD_MESSAGE} action`, () => {
const text = 'hey there'
const action: AddMessageAction = addMessage(text)
let state = rootReducer(initialState, action)
const state = rootReducer(initialState, action)
expect(state.chat.messages.size).toEqual(1)
expect(state.chat.messages.get(0)!.text).toEqual(text)
})
Expand Down
3 changes: 2 additions & 1 deletion src/__tests__/theme/components/ThemeSwitch.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import React from 'react'
import ReactDOM from 'react-dom'
import { ThemeSwitch } from '../../../theme/components/ThemeSwitch'
import { lightTheme } from '../../../theme'
import { noOp } from '../../utils'

it('renders without crashing', () => {
const div = document.createElement('div')
ReactDOM.render(<ThemeSwitch theme={lightTheme} onToggleTheme={() => void {}} />, div)
ReactDOM.render(<ThemeSwitch theme={lightTheme} onToggleTheme={noOp} />, div)
ReactDOM.unmountComponentAtNode(div)
})
8 changes: 6 additions & 2 deletions src/__tests__/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export const noOp = () => {}
export const noOp = () => {
/* */
}

// make jest happy ("Your test suite must contain at least one test")
test.skip('skip', () => {})
test.skip('skip', () => {
/* */
})
2 changes: 1 addition & 1 deletion src/chat/components/ChatErrors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const ChatErrors = ({ errors, onDismissErrors }: Props) => {
<CloseIcon />
</IconButton>
]}
></SnackbarContent>
/>
</Snackbar>
)
}
40 changes: 40 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2784,6 +2784,11 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:
dependencies:
delayed-stream "~1.0.0"

command-exists@^1.2.2:
version "1.2.8"
resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.8.tgz#715acefdd1223b9c9b37110a149c6392c2852291"
integrity sha512-PM54PkseWbiiD/mMsbvW351/u+dafwTJ0ye2qB60G1aGQP9j3xK2gmMDc+R34L3nDtx4qMCitXT75mkbkGJDLw==

commander@2.17.x:
version "2.17.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
Expand Down Expand Up @@ -3019,6 +3024,15 @@ cross-spawn@6.0.5, cross-spawn@^6.0.0, cross-spawn@^6.0.5:
shebang-command "^1.2.0"
which "^1.2.9"

cross-spawn@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=
dependencies:
lru-cache "^4.0.1"
shebang-command "^1.2.0"
which "^1.2.9"

crypto-browserify@^3.11.0:
version "3.12.0"
resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec"
Expand Down Expand Up @@ -6598,6 +6612,14 @@ lower-case@^1.1.1:
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"
integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw=

lru-cache@^4.0.1:
version "4.1.5"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd"
integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==
dependencies:
pseudomap "^1.0.2"
yallist "^2.1.2"

lru-cache@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"
Expand Down Expand Up @@ -8558,6 +8580,11 @@ prr@~1.0.1:
resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"
integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY=

pseudomap@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM=

psl@^1.1.24, psl@^1.1.28:
version "1.3.0"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.3.0.tgz#e1ebf6a3b5564fa8376f3da2275da76d875ca1bd"
Expand Down Expand Up @@ -11003,6 +11030,11 @@ xtend@^4.0.0, xtend@~4.0.1:
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==

yallist@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=

yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9"
Expand Down Expand Up @@ -11058,3 +11090,11 @@ yargs@^12.0.2:
which-module "^2.0.0"
y18n "^3.2.1 || ^4.0.0"
yargs-parser "^11.1.1"

yarpm@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/yarpm/-/yarpm-0.2.1.tgz#5ff9bab743cdd3e77adfe1f6d6cf3396fa481e64"
integrity sha1-X/m6t0PN0+d63+H21s8zlvpIHmQ=
dependencies:
command-exists "^1.2.2"
cross-spawn "^5.1.0"

0 comments on commit e8b11dc

Please sign in to comment.