Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ add `@babel/preset-flow` to the `presets`-section.

### TypeScript Support

If the `tsconfig.json`-file is present in the project root directory and the
If the `tsconfig.json`-file is present in the project root directory and
`typescript` is a dependency the `@babel/preset-typescript` will automatically
get loaded when you use the default babel config that comes with `kcd-scripts`.
If you customised your `.babelrc`-file you might need to manually add
Expand All @@ -134,6 +134,8 @@ If you customised your `.babelrc`-file you might need to manually add
`kcd-scripts` will automatically load any `.ts` and `.tsx` files, including the
default entry point, so you don't have to worry about any rollup configuration.

`tsc --noemit` will run during lint-staged to verify that files will compile.

## Inspiration

This is inspired by `react-scripts`.
Expand Down
3 changes: 2 additions & 1 deletion src/config/lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {resolveKcdScripts, resolveBin} = require('../utils')
const {resolveKcdScripts, resolveBin, ifTypescript} = require('../utils')

const kcdScripts = resolveKcdScripts()
const doctoc = resolveBin('doctoc')
Expand All @@ -10,4 +10,5 @@ module.exports = {
`${kcdScripts} lint`,
`${kcdScripts} test --findRelatedTests`,
],
'*.+(ts|tsx)': ifTypescript ? [`tsc --noEmit`] : undefined,
}