Follow lint

This commit is contained in:
syuilo 2017-03-11 10:40:20 +09:00
parent 9374664cbc
commit 2b01979fb2
7 changed files with 13 additions and 11 deletions

View File

@ -1,10 +1,11 @@
import * as URL from 'url'; import * as URL from 'url';
import * as client from 'cheerio-httpcli'; import * as client from 'cheerio-httpcli';
import summary from '../summary';
client.set('referer', false); client.set('referer', false);
client.set('timeout', 10000); client.set('timeout', 10000);
export function test(url: URL.Url) { export function test(url: URL.Url): boolean {
return url.hostname === 'www.amazon.com' || return url.hostname === 'www.amazon.com' ||
url.hostname === 'www.amazon.co.jp' || url.hostname === 'www.amazon.co.jp' ||
url.hostname === 'www.amazon.ca' || url.hostname === 'www.amazon.ca' ||
@ -18,10 +19,10 @@ export function test(url: URL.Url) {
url.hostname === 'www.amazon.nl' || url.hostname === 'www.amazon.nl' ||
url.hostname === 'www.amazon.cn' || url.hostname === 'www.amazon.cn' ||
url.hostname === 'www.amazon.in' || url.hostname === 'www.amazon.in' ||
url.hostname === 'www.amazon.au' url.hostname === 'www.amazon.au';
}; };
export async function summarize(url: URL.Url) { export async function summarize(url: URL.Url): Promise<summary> {
const res = await client.fetch(url.href); const res = await client.fetch(url.href);
const $ = res.$; const $ = res.$;

View File

@ -1,15 +1,16 @@
import * as URL from 'url'; import * as URL from 'url';
import * as request from 'request'; import * as request from 'request';
import * as debug from 'debug'; import * as debug from 'debug';
import summary from '../summary';
import clip from './../utils/clip'; import clip from './../utils/clip';
const log = debug('summaly:plugins:wikipedia'); const log = debug('summaly:plugins:wikipedia');
export function test(url: URL.Url) { export function test(url: URL.Url): boolean {
return /\.wikipedia\.org$/.test(url.hostname); return /\.wikipedia\.org$/.test(url.hostname);
}; };
export function summarize(url: URL.Url) { export function summarize(url: URL.Url): Promise<summary> {
return new Promise((res, rej) => { return new Promise((res, rej) => {
const lang = url.host.split('.')[0]; const lang = url.host.split('.')[0];
const title = url.pathname.split('/')[2]; const title = url.pathname.split('/')[2];

View File

@ -23,6 +23,6 @@ type Summary = {
* The title of that web page * The title of that web page
*/ */
title: string; title: string;
} };
export default Summary; export default Summary;

View File

@ -1,6 +1,6 @@
import nullOrEmpty from './null-or-empty'; import nullOrEmpty from './null-or-empty';
export default function(s: string, max: number) { export default function(s: string, max: number): string {
if (nullOrEmpty(s)) { if (nullOrEmpty(s)) {
return s; return s;
} }

View File

@ -1,4 +1,4 @@
export default function(val: string) { export default function(val: string): boolean {
if (val === undefined) { if (val === undefined) {
return true; return true;
} else if (val === null) { } else if (val === null) {

View File

@ -61,7 +61,7 @@
"radix": true, "radix": true,
"semicolon": true, "semicolon": true,
"switch-default": false, "switch-default": false,
"triple-equals": true, "triple-equals": false,
"typedef": [true, "typedef": [true,
"call-signature", "call-signature",
"property-declaration" "property-declaration"