Skip to content

Commit 4141432

Browse files
committed
Add tslint and fix linting errors
1 parent 00e588d commit 4141432

File tree

28 files changed

+1120
-1014
lines changed

28 files changed

+1120
-1014
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ language: node_js
22
node_js:
33
- "4.1"
44
- "4.0"
5+
script:
6+
- npm run lint
7+
- npm run test

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
"type": "git",
1717
"url": "[email protected]:YousefED/typescript-json-schema.git"
1818
},
19-
"licenses": [{
20-
"type": "Apache",
21-
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
22-
}],
19+
"licenses": [
20+
{
21+
"type": "Apache",
22+
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
23+
}
24+
],
2325
"optionalDependencies": {},
2426
"keywords": [
2527
"typescript",
@@ -36,10 +38,12 @@
3638
"devDependencies": {
3739
"chai": "^3.5.0",
3840
"mocha": "^2.4.5",
39-
"source-map-support": "^0.4.0"
41+
"source-map-support": "^0.4.0",
42+
"tslint": "^3.15.1"
4043
},
4144
"scripts": {
4245
"test": "npm run build && mocha -t 5000 --require source-map-support/register test",
43-
"build": "tsc -p ."
46+
"build": "tsc -p .",
47+
"lint": "tslint -c tslint.json 'typescript-json-schema.ts' 'test/**/*.ts' --exclude '**/*.d.ts'"
4448
}
4549
}

test/programs/array-and-description/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ export interface MyObject {
55
name?: string;
66
description?: string;
77
test: any[];
8-
}
8+
}

test/programs/array-types/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
interface MyArray {
22
[index: number]: string | number;
3-
}
3+
}

test/programs/comments-override/main.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
* @additionalProperties true
55
*/
66
export interface MySubObject {
7-
value : string;
7+
value: string;
88
}
99

1010
export interface MyObject {
11-
list : MySubObject[];
12-
13-
sub1 : MySubObject;
11+
list: MySubObject[];
12+
13+
sub1: MySubObject;
1414

1515
/**
1616
* Property-level description
1717
* @additionalProperties false
1818
*/
19-
sub2 : MySubObject;
20-
}
19+
sub2: MySubObject;
20+
}

test/programs/comments/main.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ interface MyObject {
2323
* @minimum 0
2424
* @maximum 100
2525
*/
26-
opacity : number;
27-
26+
opacity: number;
27+
2828
/**
2929
* Description of field position, of aliased type Vector3D, which should inherit its annotations
3030
*/
31-
position : Vector3D;
32-
31+
position: Vector3D;
32+
3333
/**
3434
* Description of rotation, a field with an anonymous type
3535
*/
@@ -40,7 +40,5 @@ interface MyObject {
4040
* @maximum 90
4141
*/
4242
yaw: number;
43-
}
44-
43+
};
4544
}
46-

test/programs/enums-mixed/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
enum Enum {
22
A, // = 0
3-
B = 1,
4-
C = true as any,
5-
D = 'str' as any,
3+
B = 1,
4+
C = true as any,
5+
D = "str" as any,
66
E = null
77
}
88

99
interface MyObject {
10-
foo: Enum
10+
foo: Enum;
1111
}

test/programs/enums-number/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ enum Enum {
44
}
55

66
interface MyObject {
7-
foo: Enum
7+
foo: Enum;
88
}

test/programs/enums-string/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
enum Enum {
2-
X = 'x' as any,
3-
Y = 'y' as any
2+
X = "x" as any,
3+
Y = "y" as any
44
}
55

66
interface MyObject {
7-
foo: Enum
7+
foo: Enum;
88
}

test/programs/map-types/main.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
interface MyType {}
33

44
interface MyMap1 {
5-
[id : string] : MyType;
5+
[id: string]: MyType;
66
}
77

88
/**
99
* The additionalProperties annotation should be ignored
1010
* @additionalProperties false
1111
*/
1212
interface MyMap2 {
13-
[id : string] : (string | number);
13+
[id: string]: (string | number);
1414
}
1515

1616
interface MyObject {
17-
map1 : MyMap1;
18-
map2 : MyMap2;
19-
}
17+
map1: MyMap1;
18+
map2: MyMap2;
19+
}

0 commit comments

Comments
 (0)