Skip to content

Commit d8f2105

Browse files
committedMar 27, 2014
change project structure and add typescript-formatter.d.ts
1 parent 6e23a05 commit d8f2105

File tree

4 files changed

+55
-6
lines changed

4 files changed

+55
-6
lines changed
 

‎bin/tsfmt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env node
2+
3+
require("../lib/cli");

‎index.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
#!/usr/bin/env node
2-
3-
require("./lib/cli");
1+
module.exports = require("./lib/lib");

‎package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "typescript-formatter",
33
"version": "0.1.1",
44
"description": "Formatter of TypeScript code",
5-
"main": "index.js",
5+
"main": "./index",
66
"bin": {
7-
"tsfmt": "./index.js"
7+
"tsfmt": "./bin/tsfmt"
88
},
99
"scripts": {
1010
"build": "grunt default",
@@ -45,4 +45,4 @@
4545
"grunt-exec": "0.4.5",
4646
"matchdep": "0.3.0"
4747
}
48-
}
48+
}

‎typescript-formatter.d.ts

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
declare module "typescript-formatter" {
2+
interface IOptions {
3+
// default false
4+
dryRun?: boolean;
5+
// default false
6+
verbose?: boolean;
7+
// default false
8+
replace: boolean;
9+
// default true
10+
tslint: boolean;
11+
// default true
12+
editorconfig: boolean;
13+
// default true
14+
tsfmt: boolean;
15+
}
16+
interface IResultMap {
17+
[fileName: string]: IResult;
18+
}
19+
interface IResult {
20+
fileName: string;
21+
options: TypeScript.Services.FormatCodeOptions;
22+
src: string;
23+
dest: string;
24+
}
25+
26+
function processFiles(files: string[], opts: IOptions): IResultMap;
27+
28+
module TypeScript.Services {
29+
class EditorOptions {
30+
public IndentSize: number;
31+
public TabSize: number;
32+
public NewLineCharacter: string;
33+
public ConvertTabsToSpaces: boolean;
34+
static clone(objectToClone: EditorOptions): EditorOptions;
35+
}
36+
class FormatCodeOptions extends EditorOptions {
37+
public InsertSpaceAfterCommaDelimiter: boolean;
38+
public InsertSpaceAfterSemicolonInForStatements: boolean;
39+
public InsertSpaceBeforeAndAfterBinaryOperators: boolean;
40+
public InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
41+
public InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
42+
public InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
43+
public PlaceOpenBraceOnNewLineForFunctions: boolean;
44+
public PlaceOpenBraceOnNewLineForControlBlocks: boolean;
45+
static clone(objectToClone: FormatCodeOptions): FormatCodeOptions;
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)