Skip to content

Commit

Permalink
Add tslint and fix errors (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
jubeatwww authored and kevinptt0323 committed Nov 5, 2019
1 parent 1783ca4 commit 1b38c50
Show file tree
Hide file tree
Showing 12 changed files with 269 additions and 114 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"cross-env": "^5.2.0",
"mocha": "^6.1.4",
"ts-node": "^8.3.0",
"tslint": "^6.0.0-beta0",
"typescript": "^3.5.3"
}
}
14 changes: 13 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
export default interface Config {
name: string;
url: string;
charset: string;
origin: string;
protocol: string;
timeout: number;
blobSize: number;
preventIdleTimeout: number;
terminal: {
columns: number;
rows: number;
};
[key: string]: any;
};
}
8 changes: 4 additions & 4 deletions src/sites/ptt/Article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export class Article {
}

static fromLine(line: string): Article {
let article = new Article();
article.sn =+substrWidth('dbcs', line, 1, 7).trim();
const article = new Article();
article.sn = +substrWidth('dbcs', line, 1, 7).trim();
article.push = substrWidth('dbcs', line, 9, 2).trim();
article.date = substrWidth('dbcs', line, 11, 5).trim();
article.author = substrWidth('dbcs', line, 17, 12).trim();
Expand All @@ -27,7 +27,7 @@ export class Article {
return article;
}

get content(): ReadonlyArray<string> {
get content(): ReadonlyArray<string> {
return this._content;
}
set content(data: ReadonlyArray<string>) {
Expand All @@ -42,6 +42,6 @@ export class Article {
set lines(data: ReadonlyArray<string>) {
this.content = data;
}
};
}

export default Article;
10 changes: 5 additions & 5 deletions src/sites/ptt/Board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ export class Board {
title: string;
users: string;
admin: string;
folder: boolean = false;
divider: boolean = false;
folder = false;
divider = false;

constructor() {
}

static fromLine(line: string): Board {
let board = new Board();
board.bn =+substrWidth('dbcs', line, 3, 4).trim();
const board = new Board();
board.bn = +substrWidth('dbcs', line, 3, 4).trim();
board.read = substrWidth('dbcs', line, 8, 2).trim() === '';
board.boardname = substrWidth('dbcs', line, 10, 12).trim();
board.category = substrWidth('dbcs', line, 23, 4).trim();
Expand All @@ -42,4 +42,4 @@ export class Board {
return board;
}

};
}
Loading

0 comments on commit 1b38c50

Please sign in to comment.