kourge / kvikk-fix

Apply prettier to all TypeScript files in your project
MIT License
1 stars 0 forks source link

kvikk-fix

A CLI tool for applying prettier to all TypeScript files in your project. It automatically reads your tsconfig.json from the current working directory, expands a list from that config file, and rewrites every file in that list. This tool runs in two modes:

Stability

This tool is still in its infancy (version 0.0.x), so command line options may change between patch releases. Use this tool with a locked-down version to avoid drift between releases.

Try it out

If you are using npm@5.0.0 or above, you can run the following command instead of kvikk-fix:

npx -p prettier -p typescript -p kvikk-fix kvikk-fix

This lets you reformat the entire codebase without ever having to change any of your project's dependencies. Please do not do this on a codebase that is not under version control! That would irrevocably rewrite everything with no way to undo it.

Installation

Run:

npm install --save-dev kvikk-fix

Make sure the peer dependencies prettier and typescript are fulfilled first, e.g. by having them as dev dependencies in your project. As of writing, kvikk-fix requires at least prettier@1.6.0 and typescript@2.1.0.

Errors and Exit Status

Here is a list of exit statuses common across both modes:

The exit status 3 is exclusive to check mode. It occurs when there are files that do not conform to prettier's standards, and would have been rewritten by it.

Configuration

Unlike the vanilla prettier CLI utility, kvikk-fix does not allow configuring formatting options using command line options. Instead, the config file resolution process is used. See the [prettier README] (https://github.com/prettier/prettier/blob/master/README.md#configuration-file) for more details.

Name

The word "kvikk" means "quick" in Norwegian.