Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cschroeter/ts-strictify
Incrementally enable TypeScript's strict mode
https://github.com/cschroeter/ts-strictify
Last synced: 14 days ago
JSON representation
Incrementally enable TypeScript's strict mode
- Host: GitHub
- URL: https://github.com/cschroeter/ts-strictify
- Owner: cschroeter
- Created: 2019-09-26T13:44:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T16:20:20.000Z (almost 2 years ago)
- Last Synced: 2024-10-23T11:39:06.772Z (21 days ago)
- Language: TypeScript
- Homepage:
- Size: 1.54 MB
- Stars: 81
- Watchers: 7
- Forks: 17
- Open Issues: 33
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# ts-strictify
> Runs [TypeScript](hhttp://www.typescriptlang.org/) in strict mode on your changed files.
![Demo](./docs/assets/preview.png)
## Background
TBD
## How it works
When you start working on a new feature or fixing a bug, you will modify the code base in one way or another. `ts-strictify` will take a look at these changes - and only these changes (!) and will complain, if the files you have touched are not strict compliant.
That is different than TypeScript works. You could check a single file against the compiler, but the compiler would also look up the imports and the imports of the imports. Not exactly what you want, when you are looking for incrementally update path.
Head over to https://cschroeter.net/moving-to-strict-typescript/ for more insights.
## Install
With `yarn`:
```shellsession
yarn add --dev ts-strictify
```With `npm`:
```shellsession
npm install --save-dev ts-strictify
```## Usage
With `yarn`:
```shellsession
yarn ts-strictify
```You can also disable a compiler flag, for example you want to disable `strictNullChecks`
```shellsession
yarn ts-strictify --strictNullChecks false
```You can find a list of all available options [`here`](#options).
With [`npx`](https://npm.im/npx):
```shellsession
npx ts-strictify
```With `npm`:
1. Add `"ts-strictify": "ts-strictify"` to the scripts section of `package.json`.
2. `npm run ts-strictify`## Pre-Commit Hook
You can run `ts-strictify` as a pre-commit hook using [`husky`](https://github.com/typicode/husky).
```shellstream
yarn add --dev husky
```In `package.json`, add:
```
"husky": {
"hooks": {
"pre-commit": "ts-strictify"
}
}
```## Options
```bash
Options:
--help Show help [boolean]
--version Show version number [boolean]
--noImplicitAny [boolean] [default: true]
--noImplicitThis [boolean] [default: true]
--alwaysStrict [boolean] [default: true]
--strictBindCallApply [boolean] [default: true]
--strictNullChecks [boolean] [default: true]
--strictFunctionTypes [boolean] [default: true]
--strictPropertyInitialization [boolean] [default: true]
--noEmit [boolean] [default: true]
--targetBranch [string] [default: "master"]
--commitedFiles [boolean] [default: true]
--stagedFiles [boolean] [default: true]
--modifiedFiles [boolean] [default: true]
--untrackedFiles [boolean] [default: true]
--createdFiles [boolean] [default: true]
```## Supported SCM
- Git