mirror of
https://github.com/daniel-j/fimfic2epub.git
synced 2024-09-28 07:11:16 +12:00
more linting
This commit is contained in:
parent
01c60253fd
commit
99c4cca20c
3 changed files with 28 additions and 25 deletions
|
@ -1,25 +1,27 @@
|
||||||
|
/* global chrome */
|
||||||
|
'use strict'
|
||||||
|
|
||||||
function fetch(url, cb, type) {
|
function fetch (url, cb, type) {
|
||||||
if (url.indexOf('//') === 0) {
|
if (url.indexOf('//') === 0) {
|
||||||
url = 'http:'+url
|
url = 'http:' + url
|
||||||
}
|
}
|
||||||
let x = new XMLHttpRequest()
|
let x = new XMLHttpRequest()
|
||||||
x.open('get', url, true)
|
x.open('get', url, true)
|
||||||
if (type) {
|
if (type) {
|
||||||
x.responseType = type
|
x.responseType = type
|
||||||
}
|
}
|
||||||
x.onload = function () {
|
x.onload = function () {
|
||||||
console.log(x.getResponseHeader('content-type'))
|
console.log(x.getResponseHeader('content-type'))
|
||||||
cb(URL.createObjectURL(x.response), x.getResponseHeader('content-type'))
|
cb(URL.createObjectURL(x.response), x.getResponseHeader('content-type'))
|
||||||
}
|
}
|
||||||
x.onerror = function () {
|
x.onerror = function () {
|
||||||
console.error('error')
|
console.error('error')
|
||||||
cb(null)
|
cb(null)
|
||||||
}
|
}
|
||||||
x.send()
|
x.send()
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
|
chrome.extension.onMessage.addListener(function (request, sender, sendResponse) {
|
||||||
fetch(request, sendResponse, 'blob')
|
fetch(request, sendResponse, 'blob')
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,6 +7,7 @@ import del from 'del'
|
||||||
import Sequence from 'run-sequence'
|
import Sequence from 'run-sequence'
|
||||||
import watch from 'gulp-watch'
|
import watch from 'gulp-watch'
|
||||||
import lazypipe from 'lazypipe'
|
import lazypipe from 'lazypipe'
|
||||||
|
import filter from 'gulp-filter'
|
||||||
|
|
||||||
// script
|
// script
|
||||||
import standard from 'gulp-standard'
|
import standard from 'gulp-standard'
|
||||||
|
@ -61,10 +62,9 @@ function webpackTask (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let lintPipe = lazypipe()
|
let lintPipe = lazypipe()
|
||||||
|
.pipe(filter, ['**/*', '!extension/fimfic2epub.js', '!extension/tidy.js'])
|
||||||
.pipe(standard)
|
.pipe(standard)
|
||||||
.pipe(standard.reporter, 'default', {
|
.pipe(standard.reporter, 'default', { breakOnError: false })
|
||||||
breakOnError: false
|
|
||||||
})
|
|
||||||
|
|
||||||
// Cleanup task
|
// Cleanup task
|
||||||
gulp.task('clean', () => del('extension/fimfic2epub.js'))
|
gulp.task('clean', () => del('extension/fimfic2epub.js'))
|
||||||
|
@ -79,7 +79,7 @@ gulp.task('watch:script', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
gulp.task('lint', () => {
|
gulp.task('lint', () => {
|
||||||
return gulp.src(['gulpfile.babel.js', 'webpack.config.babel.js', 'src/**/*.js']).pipe(lintPipe())
|
return gulp.src(['gulpfile.babel.js', 'webpack.config.babel.js', 'src/**/*.js', 'extension/**/*.js']).pipe(lintPipe())
|
||||||
})
|
})
|
||||||
gulp.task('watch:lint', () => {
|
gulp.task('watch:lint', () => {
|
||||||
return watch(['src/**/*.js'], watchOpts, function (file) {
|
return watch(['src/**/*.js'], watchOpts, function (file) {
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"babel-preset-node6": "^11.0.0",
|
"babel-preset-node6": "^11.0.0",
|
||||||
"del": "^2.2.0",
|
"del": "^2.2.0",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
|
"gulp-filter": "^4.0.0",
|
||||||
"gulp-standard": "^7.0.1",
|
"gulp-standard": "^7.0.1",
|
||||||
"gulp-util": "^3.0.7",
|
"gulp-util": "^3.0.7",
|
||||||
"gulp-watch": "^4.3.8",
|
"gulp-watch": "^4.3.8",
|
||||||
|
|
Loading…
Reference in a new issue