Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Fix lint issues and misnamings

Ondra Urban04e083a8e18b
diff --git a/src/request_list.js b/src/request_list.js
index ede4342a1..b95a9b023 100644
--- a/src/request_list.js
+++ b/src/request_list.js
@@ -2,7 +2,6 @@ import { checkParamOrThrow } from 'apify-client/build/utils';
import log from 'apify-shared/log';
import _ from 'underscore';
import Promise from 'bluebird';
-import requestPromise from 'request-promise';
import Request from './request';
import events from './events';
import { ACTOR_EVENT_NAMES } from './constants';
diff --git a/src/utils.js b/src/utils.js
index 705732642..866901b2d 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -353,7 +353,7 @@ const sleep = (millis) => {
*/
export const downloadListOfUrls = ({ url, encoding = 'utf8', urlRegExp = URL_NO_COMMAS_REGEX }) => {
try {
- checkParamOrThrow(string, 'string', 'String');
+ checkParamOrThrow(url, 'url', 'String');
checkParamOrThrow(encoding, 'string', 'String');
checkParamOrThrow(urlRegExp, 'urlRegExp', 'RegExp');
} catch (err) {
diff --git a/test/puppeteer_live_view_server.js b/test/puppeteer_live_view_server.js
index 43a8f3d97..3059c86d6 100644
--- a/test/puppeteer_live_view_server.js
+++ b/test/puppeteer_live_view_server.js
@@ -3,8 +3,8 @@ import { expect, assert } from 'chai';
import Promise from 'bluebird';
import puppeteer from 'puppeteer';
import Apify from '../build/index';
-import PuppeteerLiveViewServer, { PuppeteerLiveViewBrowser } from '../src/puppeteer_live_view_server';
-import { ENV_VARS } from '../src/constants';
+import PuppeteerLiveViewServer, { PuppeteerLiveViewBrowser } from '../build/puppeteer_live_view_server';
+import { ENV_VARS } from '../build/constants';
const PORT = 0;
const URL = 'thisshouldfailonclientonly';
diff --git a/test/utils.js b/test/utils.js
index 087f5503d..78a87fa0f 100644
--- a/test/utils.js
+++ b/test/utils.js
@@ -72,8 +72,8 @@ describe('utils.isProduction()', () => {
describe('utils.isDocker()', () => {
it('works for dockerenv && cgroup', () => {
- sinon.stub(fs, 'stat').callsFake((path, callback) => callback(null));
- sinon.stub(fs, 'readFile').callsFake((path, encoding, callback) => callback(null, 'something ... docker ... something'));
+ sinon.stub(fs, 'stat').callsFake((filePath, callback) => callback(null));
+ sinon.stub(fs, 'readFile').callsFake((filePath, encoding, callback) => callback(null, 'something ... docker ... something'));
return utils
.isDocker(true)
@@ -85,8 +85,8 @@ describe('utils.isDocker()', () => {
});
it('works for dockerenv', () => {
- sinon.stub(fs, 'stat').callsFake((path, callback) => callback(null));
- sinon.stub(fs, 'readFile').callsFake((path, encoding, callback) => callback(null, 'something ... ... something'));
+ sinon.stub(fs, 'stat').callsFake((filePath, callback) => callback(null));
+ sinon.stub(fs, 'readFile').callsFake((filePath, encoding, callback) => callback(null, 'something ... ... something'));
return utils
.isDocker(true)
@@ -98,8 +98,8 @@ describe('utils.isDocker()', () => {
});
it('works for cgroup', () => {
- sinon.stub(fs, 'stat').callsFake((path, callback) => callback(new Error()));
- sinon.stub(fs, 'readFile').callsFake((path, encoding, callback) => callback(null, 'something ... docker ... something'));
+ sinon.stub(fs, 'stat').callsFake((filePath, callback) => callback(new Error()));
+ sinon.stub(fs, 'readFile').callsFake((filePath, encoding, callback) => callback(null, 'something ... docker ... something'));
return utils
.isDocker(true)
@@ -111,8 +111,8 @@ describe('utils.isDocker()', () => {
});
it('works for nothing', () => {
- sinon.stub(fs, 'stat').callsFake((path, callback) => callback(new Error()));
- sinon.stub(fs, 'readFile').callsFake((path, encoding, callback) => callback(null, 'something ... ... something'));
+ sinon.stub(fs, 'stat').callsFake((filePath, callback) => callback(new Error()));
+ sinon.stub(fs, 'readFile').callsFake((filePath, encoding, callback) => callback(null, 'something ... ... something'));
return utils
.isDocker(true)
@@ -170,9 +170,9 @@ describe('utils.getMemoryInfo()', () => {
sinon
.stub(fs, 'readFile')
- .callsFake((path, callback) => {
- if (path === '/sys/fs/cgroup/memory/memory.limit_in_bytes') callback(null, '333');
- else if (path === '/sys/fs/cgroup/memory/memory.usage_in_bytes') callback(null, '111');
+ .callsFake((filePath, callback) => {
+ if (filePath === '/sys/fs/cgroup/memory/memory.limit_in_bytes') callback(null, '333');
+ else if (filePath === '/sys/fs/cgroup/memory/memory.usage_in_bytes') callback(null, '111');
else throw new Error('Invalid path');
});
@@ -239,9 +239,9 @@ describe('utils.getMemoryInfo()', () => {
sinon
.stub(fs, 'readFile')
- .callsFake((path, callback) => {
- if (path === '/sys/fs/cgroup/memory/memory.limit_in_bytes') callback(null, '333');
- else if (path === '/sys/fs/cgroup/memory/memory.usage_in_bytes') callback(null, '111');
+ .callsFake((filePath, callback) => {
+ if (filePath === '/sys/fs/cgroup/memory/memory.limit_in_bytes') callback(null, '333');
+ else if (filePath === '/sys/fs/cgroup/memory/memory.usage_in_bytes') callback(null, '111');
else throw new Error('Invalid path');
});
@@ -498,13 +498,10 @@ describe('utils.extractUrls()', () => {
});
describe('utils.downloadListOfUrls()', () => {
-
let stub;
-
beforeEach(() => {
stub = sinon.stub(requestPromise, 'get');
});
-
afterEach(() => {
requestPromise.get.restore();
});