Skip to content

Commit 96ae391

Browse files
committed
style: make the code linter happy
1 parent 1c0398b commit 96ae391

File tree

6 files changed

+15
-13
lines changed

6 files changed

+15
-13
lines changed

sources/academy/webscraping/scraping_basics_javascript/exercises/cnn_sports_shortest_article.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const listingUrl = 'https://edition.cnn.com/sport';
1313
const $ = await download(listingUrl);
1414

1515
const results = await Promise.all(
16-
$('.layout__main .card').toArray().map(async element => {
16+
$('.layout__main .card').toArray().map(async (element) => {
1717
const $element = $(element);
1818
const $link = $element.find('a').first();
1919
if (!$link.length) {
@@ -29,10 +29,10 @@ const results = await Promise.all(
2929
}
3030

3131
return { url: articleUrl, length: content.length };
32-
})
32+
}),
3333
);
3434

35-
const nonEmpty = results.filter(item => item && item.length > 0);
35+
const nonEmpty = results.filter((item) => item && item.length > 0);
3636
nonEmpty.sort((a, b) => a.length - b.length);
3737

3838
if (nonEmpty.length > 0) {

sources/academy/webscraping/scraping_basics_javascript/exercises/crawlee_netflix_ratings.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { CheerioCrawler, Request } from 'crawlee';
21
import { escape } from 'node:querystring';
32

3+
import { CheerioCrawler, Request } from 'crawlee';
4+
45
const crawler = new CheerioCrawler({
56
async requestHandler({ $, request, enqueueLinks, pushData, addRequests }) {
67
if (request.label === 'IMDB') {
@@ -16,7 +17,7 @@ const crawler = new CheerioCrawler({
1617
} else if (request.label === 'IMDB_SEARCH') {
1718
await enqueueLinks({ selector: '.find-result-item a', label: 'IMDB', limit: 1 });
1819
} else if (request.label === 'NETFLIX') {
19-
const requests = $("[data-uia='top10-table-row-title'] button").toArray().map(buttonElement => {
20+
const requests = $("[data-uia='top10-table-row-title'] button").toArray().map((buttonElement) => {
2021
const name = $(buttonElement).text().trim();
2122
const imdbSearchUrl = `https://www.imdb.com/find/?q=${escape(name)}&s=tt&ttype=ft`;
2223
return new Request({ url: imdbSearchUrl, label: 'IMDB_SEARCH' });

sources/academy/webscraping/scraping_basics_javascript/exercises/guardian_f1_authors.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async function download(url) {
1212
const listingUrl = 'https://www.theguardian.com/sport/formulaone';
1313
const $ = await download(listingUrl);
1414

15-
const promises = $('#maincontent ul li').toArray().map(async element => {
15+
const promises = $('#maincontent ul li').toArray().map(async (element) => {
1616
const $item = $(element);
1717
const $link = $item.find('a').first();
1818
if (!$link.length) {

sources/academy/webscraping/scraping_basics_javascript/exercises/npm_llm_packages.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function parseNumber(text) {
1616
const listingUrl = 'https://www.npmjs.com/search?page=0&q=keywords%3Allm&sortBy=dependent_count';
1717
const $ = await download(listingUrl);
1818

19-
const promises = $('section').toArray().map(async element => {
19+
const promises = $('section').toArray().map(async (element) => {
2020
const $card = $(element);
2121
const $link = $card.find('a').first();
2222
if (!$link.length) {
@@ -30,7 +30,7 @@ const promises = $('section').toArray().map(async element => {
3030
.last()
3131
.text()
3232
.split('•')
33-
.map(item => item.trim());
33+
.map((item) => item.trim());
3434

3535
const updatedText = details[2] ?? '';
3636
const dependentsText = details[3] ?? '';
@@ -57,5 +57,5 @@ const promises = $('section').toArray().map(async element => {
5757
return { name, url, description, dependents, downloads };
5858
});
5959

60-
const data = (await Promise.all(promises)).filter(item => item);
60+
const data = (await Promise.all(promises)).filter((item) => item);
6161
console.log(data.slice(0, 5));

sources/academy/webscraping/scraping_basics_javascript/exercises/process_products_json.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ const jsonData = await readFile('products.json', 'utf8');
44
const data = JSON.parse(jsonData);
55

66
data
7-
.filter(row => row.minPrice > 50000)
8-
.forEach(row => console.log(row));
7+
.filter((row) => row.minPrice > 50000)
8+
.forEach((row) => console.log(row));

sources/academy/webscraping/scraping_basics_javascript/exercises/wikipedia_calling_codes.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const listingUrl = 'https://en.wikipedia.org/wiki/List_of_sovereign_states_and_d
1313
const $ = await download(listingUrl);
1414

1515
const cells = $('.wikitable tr td:nth-child(3)');
16-
const promises = cells.toArray().map(async element => {
16+
const promises = cells.toArray().map(async (element) => {
1717
const $nameCell = $(element);
1818
const $link = $nameCell.find('a').first();
1919
if (!$link.length) {
@@ -27,7 +27,8 @@ const promises = cells.toArray().map(async element => {
2727
.first();
2828

2929
const callingCode = $label.length
30-
? $label.parent().find('td.infobox-data').first().text().trim()
30+
? $label.parent().find('td.infobox-data').first().text()
31+
.trim()
3132
: '';
3233

3334
console.log(`${countryUrl} ${callingCode || null}`);

0 commit comments

Comments
 (0)