ts-strictify

    1.6.0 • Public • Published

    ts-strictify

    Runs TypeScript in strict mode on your changed files.

    Demo

    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:

    yarn add --dev ts-strictify

    With npm:

    npm install --save-dev ts-strictify

    Usage

    With yarn:

    yarn ts-strictify

    You can also disable a compiler flag, for example you want to disable strictNullChecks

    yarn ts-strictify --strictNullChecks false

    You can find a list of all available options here.

    With npx:

    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.

    yarn add --dev husky

    In package.json, add:

    "husky": {
      "hooks": {
        "pre-commit": "ts-strictify"
      }
    }
    

    Options

    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

    Install

    npm i ts-strictify

    DownloadsWeekly Downloads

    2,102

    Version

    1.6.0

    License

    MIT

    Unpacked Size

    18.7 kB

    Total Files

    7

    Last publish

    Collaborators

    • schroetier