Skip to content

Commit 6661770

Browse files
committed
update whitespace rules in tslint.json and apply
* curly: true - enforce curly braces on if/while/etc. blocks * no-consecutive-blank-lines: true * one-line - make sure { is on the same line * make sure there is a space before type definitions
1 parent 88263da commit 6661770

File tree

112 files changed

+1852
-2300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1852
-2300
lines changed

src/lib/application.ts

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {AbstractComponent, ChildableComponent, Component, Option} from './utils/
2020
import {Options, OptionsReadMode, IOptionsReadResult} from './utils/options/index';
2121
import {ParameterType} from './utils/options/declaration';
2222

23-
2423
/**
2524
* The default TypeDoc main application class.
2625
*
@@ -35,63 +34,60 @@ import {ParameterType} from './utils/options/declaration';
3534
* and emit a series of events while processing the project. Subscribe to these Events
3635
* to control the application flow or alter the output.
3736
*/
38-
@Component({name:'application', internal:true})
39-
export class Application extends ChildableComponent<Application, AbstractComponent<Application>>
40-
{
41-
options:Options;
37+
@Component({name: 'application', internal: true})
38+
export class Application extends ChildableComponent<Application, AbstractComponent<Application>> {
39+
options: Options;
4240

4341
/**
4442
* The converter used to create the declaration reflections.
4543
*/
46-
converter:Converter;
44+
converter: Converter;
4745

4846
/**
4947
* The renderer used to generate the documentation output.
5048
*/
51-
renderer:Renderer;
49+
renderer: Renderer;
5250

5351
/**
5452
* The logger that should be used to output messages.
5553
*/
56-
logger:Logger;
54+
logger: Logger;
5755

58-
plugins:PluginHost;
56+
plugins: PluginHost;
5957

6058
@Option({
6159
name: 'logger',
6260
help: 'Specify the logger that should be used, \'none\' or \'console\'',
6361
defaultValue: 'console',
6462
type: ParameterType.Mixed
6563
})
66-
loggerType:string|Function;
64+
loggerType: string|Function;
6765

6866
@Option({
6967
name: 'ignoreCompilerErrors',
7068
help: 'Should TypeDoc generate documentation pages even after the compiler has returned errors?',
7169
type: ParameterType.Boolean
7270
})
73-
ignoreCompilerErrors:boolean;
71+
ignoreCompilerErrors: boolean;
7472

7573
@Option({
7674
name: 'exclude',
7775
help: 'Define a pattern for excluded files when specifying paths.',
7876
type: ParameterType.String
7977
})
80-
exclude:string;
78+
exclude: string;
8179

8280
/**
8381
* The version number of TypeDoc.
8482
*/
8583
static VERSION = '{{ VERSION }}';
8684

87-
88-
8985
/**
9086
* Create a new TypeDoc application instance.
9187
*
9288
* @param options An object containing the options that should be used.
9389
*/
94-
constructor(options?:Object) {
90+
constructor(options?: Object) {
9591
super(null);
9692

9793
this.logger = new ConsoleLogger();
@@ -103,18 +99,17 @@ export class Application extends ChildableComponent<Application, AbstractCompone
10399
this.bootstrap(options);
104100
}
105101

106-
107102
/**
108103
* Initialize TypeDoc with the given options object.
109104
*
110105
* @param options The desired options to set.
111106
*/
112-
protected bootstrap(options?:Object):IOptionsReadResult {
107+
protected bootstrap(options?: Object): IOptionsReadResult {
113108
this.options.read(options, OptionsReadMode.Prefetch);
114109

115110
const logger = this.loggerType;
116111
if (typeof logger === 'function') {
117-
this.logger = new CallbackLogger(<any>logger);
112+
this.logger = new CallbackLogger(<any> logger);
118113
} else if (logger === 'none') {
119114
this.logger = new Logger();
120115
}
@@ -123,42 +118,37 @@ export class Application extends ChildableComponent<Application, AbstractCompone
123118
return this.options.read(options, OptionsReadMode.Fetch);
124119
}
125120

126-
127121
/**
128122
* Return the application / root component instance.
129123
*/
130-
get application():Application {
124+
get application(): Application {
131125
return this;
132126
}
133127

134-
135-
get isCLI():boolean {
128+
get isCLI(): boolean {
136129
return false;
137130
}
138131

139-
140132
/**
141133
* Return the path to the TypeScript compiler.
142134
*/
143-
public getTypeScriptPath():string {
135+
public getTypeScriptPath(): string {
144136
return Path.dirname(require.resolve('typescript'));
145137
}
146138

147-
148-
public getTypeScriptVersion():string {
139+
public getTypeScriptVersion(): string {
149140
const tsPath = this.getTypeScriptPath();
150141
const json = JSON.parse(FS.readFileSync(Path.join(tsPath, '..', 'package.json'), 'utf8'));
151142
return json.version;
152143
}
153144

154-
155145
/**
156146
* Run the converter for the given set of files and return the generated reflections.
157147
*
158148
* @param src A list of source that should be compiled and converted.
159149
* @returns An instance of ProjectReflection on success, NULL otherwise.
160150
*/
161-
public convert(src:string[]):ProjectReflection {
151+
public convert(src: string[]): ProjectReflection {
162152
this.logger.writeln('Using TypeScript %s from %s', this.getTypeScriptVersion(), this.getTypeScriptPath());
163153

164154
const result = this.converter.convert(src);
@@ -175,26 +165,27 @@ export class Application extends ChildableComponent<Application, AbstractCompone
175165
}
176166
}
177167

178-
179168
/**
180169
* @param src A list of source files whose documentation should be generated.
181170
*/
182-
public generateDocs(src:string[], out:string):boolean;
171+
public generateDocs(src: string[], out: string): boolean;
183172

184173
/**
185174
* @param project The project the documentation should be generated for.
186175
*/
187-
public generateDocs(project:ProjectReflection, out:string):boolean;
176+
public generateDocs(project: ProjectReflection, out: string): boolean;
188177

189178
/**
190179
* Run the documentation generator for the given set of files.
191180
*
192181
* @param out The path the documentation should be written to.
193182
* @returns TRUE if the documentation could be generated successfully, otherwise FALSE.
194183
*/
195-
public generateDocs(input:any, out:string):boolean {
184+
public generateDocs(input: any, out: string): boolean {
196185
const project = input instanceof ProjectReflection ? input : this.convert(input);
197-
if (!project) return false;
186+
if (!project) {
187+
return false;
188+
}
198189

199190
out = Path.resolve(out);
200191
this.renderer.render(project, out);
@@ -207,26 +198,27 @@ export class Application extends ChildableComponent<Application, AbstractCompone
207198
return true;
208199
}
209200

210-
211201
/**
212202
* @param src A list of source that should be compiled and converted.
213203
*/
214-
public generateJson(src:string[], out:string):boolean;
204+
public generateJson(src: string[], out: string): boolean;
215205

216206
/**
217207
* @param project The project that should be converted.
218208
*/
219-
public generateJson(project:ProjectReflection, out:string):boolean;
209+
public generateJson(project: ProjectReflection, out: string): boolean;
220210

221211
/**
222212
* Run the converter for the given set of files and write the reflections to a json file.
223213
*
224214
* @param out The path and file name of the target file.
225215
* @returns TRUE if the json file could be written successfully, otherwise FALSE.
226216
*/
227-
public generateJson(input:any, out:string):boolean {
217+
public generateJson(input: any, out: string): boolean {
228218
const project = input instanceof ProjectReflection ? input : this.convert(input);
229-
if (!project) return false;
219+
if (!project) {
220+
return false;
221+
}
230222

231223
out = Path.resolve(out);
232224
writeFile(out, JSON.stringify(project.toObject(), null, '\t'), false);
@@ -235,7 +227,6 @@ export class Application extends ChildableComponent<Application, AbstractCompone
235227
return true;
236228
}
237229

238-
239230
/**
240231
* Expand a list of input files.
241232
*
@@ -246,13 +237,13 @@ export class Application extends ChildableComponent<Application, AbstractCompone
246237
* @param inputFiles The list of files that should be expanded.
247238
* @returns The list of input files with expanded directories.
248239
*/
249-
public expandInputFiles(inputFiles?:string[]):string[] {
250-
let exclude:IMinimatch, files:string[] = [];
240+
public expandInputFiles(inputFiles?: string[]): string[] {
241+
let exclude: IMinimatch, files: string[] = [];
251242
if (this.exclude) {
252243
exclude = new Minimatch(this.exclude);
253244
}
254245

255-
function add(dirname:string) {
246+
function add(dirname: string) {
256247
FS.readdirSync(dirname).forEach((file) => {
257248
const realpath = Path.join(dirname, file);
258249
if (FS.statSync(realpath).isDirectory()) {
@@ -279,7 +270,6 @@ export class Application extends ChildableComponent<Application, AbstractCompone
279270
return files;
280271
}
281272

282-
283273
/**
284274
* Print the version number.
285275
*/

src/lib/cli.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,49 @@ import {IOptionsReadResult} from './utils/options/options';
66
import {ParameterHint, ParameterType} from './utils/options/declaration';
77
import {getOptionsHelp} from './utils/options/help';
88

9-
10-
export const enum ExitCode
11-
{
9+
export const enum ExitCode {
1210
OptionError = 1,
1311
NoInputFiles = 2,
1412
NoOutput = 3,
1513
CompileError = 4,
1614
OutputError = 5
1715
}
1816

19-
20-
export class CliApplication extends Application
21-
{
17+
export class CliApplication extends Application {
2218
@Option({
2319
name: 'out',
2420
help: 'Specifies the location the documentation should be written to.',
2521
hint: ParameterHint.Directory
2622
})
27-
out:string;
23+
out: string;
2824

2925
@Option({
3026
name: 'json',
3127
help: 'Specifies the location and file name a json file describing the project is written to.',
3228
hint: ParameterHint.File
3329
})
34-
json:string;
30+
json: string;
3531

3632
@Option({
3733
name: 'version',
3834
short: 'v',
3935
help: 'Print the TypeDoc\'s version.',
4036
type: ParameterType.Boolean
4137
})
42-
version:boolean;
38+
version: boolean;
4339

4440
@Option({
4541
name: 'help',
4642
short: 'h',
4743
help: 'Print this message.',
4844
type: ParameterType.Boolean
4945
})
50-
help:boolean;
51-
52-
46+
help: boolean;
5347

5448
/**
5549
* Run TypeDoc from the command line.
5650
*/
57-
protected bootstrap(options?:Object):IOptionsReadResult {
51+
protected bootstrap(options?: Object): IOptionsReadResult {
5852
const result = super.bootstrap(options);
5953
if (result.hasErrors) {
6054
process.exit(ExitCode.OptionError);
@@ -75,8 +69,12 @@ export class CliApplication extends Application
7569
const src = this.expandInputFiles(result.inputFiles);
7670
const project = this.convert(src);
7771
if (project) {
78-
if (this.out) this.generateDocs(project, this.out);
79-
if (this.json) this.generateJson(project, this.json);
72+
if (this.out) {
73+
this.generateDocs(project, this.out);
74+
}
75+
if (this.json) {
76+
this.generateJson(project, this.json);
77+
}
8078
if (this.logger.hasErrors()) {
8179
process.exit(ExitCode.OutputError);
8280
}
@@ -88,8 +86,7 @@ export class CliApplication extends Application
8886
return result;
8987
}
9088

91-
92-
get isCLI():boolean {
89+
get isCLI(): boolean {
9390
return true;
9491
}
9592
}

0 commit comments

Comments
 (0)