Skip to content

Instantly share code, notes, and snippets.

@vvakame
Last active July 13, 2016 16:17
Show Gist options
  • Save vvakame/d606a83767959473d8a90f5facde8919 to your computer and use it in GitHub Desktop.
Save vvakame/d606a83767959473d8a90f5facde8919 to your computer and use it in GitHub Desktop.
$ git clone https://gist.github.com/d606a83767959473d8a90f5facde8919.git
$ cd d606a83767959473d8a90f5facde8919
$ curl https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b66d6115d7a8cd74af45e59d36c4447e5d1e9a52/node/node.d.ts > node.d.ts
$ npm install && npm run test

{ fileName: 'test.ts',
  options:
   { IndentSize: 4,
     TabSize: 4,
     IndentStyle: 2,
     NewLineCharacter: '\r\n',
     ConvertTabsToSpaces: true,
     InsertSpaceAfterCommaDelimiter: true,
     InsertSpaceAfterSemicolonInForStatements: true,
     InsertSpaceBeforeAndAfterBinaryOperators: true,
     InsertSpaceAfterKeywordsInControlFlowStatements: true,
     InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
     InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
     InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
     InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
     PlaceOpenBraceOnNewLineForFunctions: false,
     PlaceOpenBraceOnNewLineForControlBlocks: false },
  message: 'console.log(1);\r\n',
  error: false,
  src: 'console.log(  1  );',
  dest: 'console.log(1);\r\n' }
import * as tsfmt from "typescript-formatter";
tsfmt.processString("test.ts", "console.log( 1 );", {
replace: false,
verify: false,
tsconfig: false,
tslint: false,
editorconfig: false,
tsfmt: false,
}).then(v => console.log(v));
{
"name": "issue2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "tsc -p ./ && node index.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"typescript": "^1.8.10",
"typescript-formatter": "^2.2.1"
}
}
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"sourceMap": false
},
"exclude": [
"node_modules"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment