Skip to content

Commit a2a07ed

Browse files
Add linting
1 parent cbfdd30 commit a2a07ed

9 files changed

+45
-16
lines changed

conversions.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export namespace conversions {
2+
3+
function formdataToObject (formData) {
4+
const o = {}
5+
for (let pair of formData.entries()) {
6+
o[pair[0]] = pair[1]
7+
console.log(pair)
8+
}
9+
return o
10+
}
11+
12+
}

events/ApplicationEvents.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
export class ApplicationEvents {
66

7-
static readonly USER_HAS_LOGGED_IN = "USER_HAS_LOGGED_IN"
8-
static readonly USER_HAS_LOGGED_OUT = "USER_HAS_LOGGED_OUT"
7+
static readonly USER_HAS_LOGGED_IN = 'USER_HAS_LOGGED_IN'
8+
static readonly USER_HAS_LOGGED_OUT = 'USER_HAS_LOGGED_OUT'
99
}

events/KeyCodes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ export let KeyCodes = {
2222
k: 75,
2323
m: 77,
2424

25-
WIN_or_CMD:91 //to detect cmd on key up use this, on keydown you can use event.metaKey
25+
WIN_or_CMD: 91 // to detect cmd on key up use this, on keydown you can use event.metaKey
2626
}

index.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
export {IComponent} from "./interfaces/IComponent";
2-
export {IAttachableComponent} from "./interfaces/IAttachableComponent";
3-
export {KeyCodes} from "./events/KeyCodes";
4-
export {ApplicationEvents} from "./events/ApplicationEvents";
1+
export {IComponent} from './interfaces/IComponent'
2+
export {IAttachableComponent} from './interfaces/IAttachableComponent'
3+
export {KeyCodes} from './events/KeyCodes'
4+
export {ApplicationEvents} from './events/ApplicationEvents'
5+
export {conversions} from './conversions'

interfaces/CommonExtensions.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
//common extensions to go in here
1+
// common extensions to go in here
2+
interface ArrayConstructor {
3+
from (arrayLike: any, mapFn?, thisArg?): Array<any>
4+
}

interfaces/IAttachableComponent.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* Try and modify as little of the exiting dom's html as possible
77
*/
88

9-
109
export interface IAttachableComponent {
11-
attach: ()=>void
12-
detach: ()=>void
10+
attach: () => void
11+
detach: () => void
1312
}

interfaces/IComponent.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
*/
88

99
export interface IComponent {
10-
destroy: ()=>void
11-
show: ()=>void
10+
destroy: () => void
11+
show: () => void
1212
}

package.json

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "vanilla-typescript",
3-
"version": "0.3.2",
3+
"version": "0.3.5",
44
"description": "",
55
"main": "index.ts",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "npm run lint",
8+
"lint": "tslint **/*.ts"
89
},
910
"repository": {
1011
"type": "git",
@@ -16,5 +17,12 @@
1617
"bugs": {
1718
"url": "https://github.com/quantumjs/vanilla-typescript/issues"
1819
},
19-
"homepage": "https://github.com/quantumjs/vanilla-typescript#readme"
20+
"homepage": "https://github.com/quantumjs/vanilla-typescript#readme",
21+
"devDependencies": {
22+
"pre-commit": "^1.2.2",
23+
"tslint": "^5.1.0",
24+
"tslint-config-standard": "^5.0.2",
25+
"typescript": "^2.2.2"
26+
},
27+
"pre-commit": "test"
2028
}

tslint.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "tslint-config-standard",
3+
"rules": {
4+
"no-use-before-declare": false
5+
}
6+
}

0 commit comments

Comments
 (0)