JSPM

  • Created
  • Published
  • Downloads 64054
  • Score
    100M100P100Q144861F
  • License MIT

Formatter of TypeScript code

Package Exports

  • typescript-formatter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (typescript-formatter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

TypeScript Formatter (tsfmt)

A TypeScript code formatter powered by TypeScript Compiler Service.

$ tsfmt

  Usage: tsfmt [options] <file ...>

  Options:

    -h, --help     output usage information
    -V, --version  output the version number
    -r, --replace  Replace .ts file

Installation

npm install -g typescript-formatter

Usage

$ cat sample.ts
class Sample {hello(word="world"){return "Hello, "+word;}}
new Sample().hello("TypeScript");
# basic. read file, output to stdout.
$ tsfmt sample.ts
class Sample { hello(word= "world") { return "Hello, " + word; } }
new Sample().hello("TypeScript");
# replace. read file, and replace file.
$ tsfmt -r sample.ts
replaced sample.ts
$ cat sample.ts
class Sample { hello(word= "world") { return "Hello, " + word; } }
new Sample().hello("TypeScript");

Future plan

  • Support read format settings from tslint.json
  • Support read format settings from .editorconfig