Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update eslint-config-airbnb to the latest version 🚀 #281

Merged
merged 4 commits into from
Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions examples/custom-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,28 @@ class FsCache extends BaseCache {
fs.writeFileSync(this._settings.file, '{}');
return Promise.resolve();
}

clear() {
fs.unlinkSync(this._settings.file);
return Promise.resolve();
}

close() {
return Promise.resolve();
}

get(key) {
const obj = JSON.parse(fs.readFileSync(this._settings.file));
return Promise.resolve(obj[key] || null);
}

set(key, value) {
const obj = JSON.parse(fs.readFileSync(this._settings.file));
obj[key] = value;
fs.writeFileSync(this._settings.file, JSON.stringify(obj));
return Promise.resolve();
}

enqueue(key, value, priority) {
const obj = JSON.parse(fs.readFileSync(this._settings.file));
const queue = obj[key] || [];
Expand All @@ -37,6 +42,7 @@ class FsCache extends BaseCache {
fs.writeFileSync(this._settings.file, JSON.stringify(obj));
return Promise.resolve();
}

dequeue(key) {
const obj = JSON.parse(fs.readFileSync(this._settings.file));
const queue = obj[key] || [];
Expand All @@ -45,11 +51,13 @@ class FsCache extends BaseCache {
if (!item) return Promise.resolve(null);
return Promise.resolve(item.value);
}

size(key) {
const obj = JSON.parse(fs.readFileSync(this._settings.file));
if (!obj[key]) return Promise.resolve(0);
return Promise.resolve(obj[key].length);
}

remove(key) {
const obj = JSON.parse(fs.readFileSync(this._settings.file));
delete obj[key];
Expand Down
1 change: 1 addition & 0 deletions examples/custom-exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class InspectExporter extends BaseExporter {
}

writeHeader() {}

writeFooter() {}
}

Expand Down
1 change: 1 addition & 0 deletions lib/hccrawler.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ class HCCrawler extends EventEmitter {
const page = await this._browser.newPage();
return new Crawler(page, options, depth, previousUrl);
}

/**
* @param {!Crawler} crawler
* @return {!Promise<!Object>}
Expand Down
2 changes: 1 addition & 1 deletion lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Helper {
const { protocol } = parse(url);
if (includes(['http:', 'https:'], protocol)) {
return url.split('#')[0];
} else if (!protocol) {
} else if (!protocol) { // eslint-disable-line no-else-return
return resolve(baseUrl, url).split('#')[0];
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion lib/priority-queue.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const AsyncEventEmitter = require('./async-events');
const noop = require('lodash/noop');
const AsyncEventEmitter = require('./async-events');
const { tracePublicAPI } = require('./helper');

const KEY = 'queue';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@types/puppeteer": "1.3.4",
"@types/request-promise": "4.1.41",
"eslint": "5.0.0",
"eslint-config-airbnb": "16.1.0",
"eslint-config-airbnb": "17.0.0",
"eslint-plugin-import": "2.12.0",
"greenkeeper-lockfile": "1.15.1",
"husky": "0.14.3",
Expand Down
Loading