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

@ -73,7 +73,7 @@ export default async (url: URL.Url): Promise<Summary> => {
let icon =
$('link[rel="shortcut icon"]').attr('href') ||
$('link[rel="icon"]').attr('href');
if (icon == null) {
const favicon = '/favicon.ico';

View File

@ -1,10 +1,11 @@
import * as URL from 'url';
import * as client from 'cheerio-httpcli';
import summary from '../summary';
client.set('referer', false);
client.set('timeout', 10000);
export function test(url: URL.Url) {
export function test(url: URL.Url): boolean {
return url.hostname === 'www.amazon.com' ||
url.hostname === 'www.amazon.co.jp' ||
url.hostname === 'www.amazon.ca' ||
@ -18,10 +19,10 @@ export function test(url: URL.Url) {
url.hostname === 'www.amazon.nl' ||
url.hostname === 'www.amazon.cn' ||
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.$;

View File

@ -1,15 +1,16 @@
import * as URL from 'url';
import * as request from 'request';
import * as debug from 'debug';
import summary from '../summary';
import clip from './../utils/clip';
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);
};
export function summarize(url: URL.Url) {
export function summarize(url: URL.Url): Promise<summary> {
return new Promise((res, rej) => {
const lang = url.host.split('.')[0];
const title = url.pathname.split('/')[2];

View File

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

View File

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

View File

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

View File

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