feat: enforcing line break rules in linter

pull/17/head
Adam Pash 8 years ago
parent 4d1d950807
commit 65c641a879

@ -24,6 +24,15 @@
// "no-useless-escape": 0,
"no-confusing-arrow": 0,
"camelcase": 0,
"no-multiple-empty-lines": [
"error", {"max": 1, "maxEOF": 0, "maxBOF": 0}
],
},
"options": {
"no-multiple-empty-lines": {
"max": 1,
"maxEOF": 0,
},
},
"settings": {
"import/resolver": {

@ -59,4 +59,3 @@ describe('cleanDateString(dateString)', () => {
assert.equal(date1, '15 Apr 2016 10:59');
});
});

@ -14,7 +14,6 @@ const Cleaners = {
title: cleanTitle,
};
export default Cleaners;
export { cleanAuthor };

@ -23,4 +23,3 @@ export default function cleanTitle(title, { url, $ }) {
// strip any html tags in the title text
return stripTags(title, $).trim();
}

@ -33,4 +33,3 @@ describe('cleanTitle(title, { url, $ })', () => {
assert.equal(cleanTitle(title, { url: '', $ }), title.trim());
});
});

@ -36,7 +36,6 @@ describe('DeadspinExtractor', () => {
assert.equal(title, 'The Nationals Are Stuck With Danny Espinosa Tonight, Unless They Opt For The Only Thing Worse');
});
it('returns the author', async () => {
// To pass this test, fill out the author selector
// in ./src/extractors/custom/deadspin.com/index.js.
@ -53,7 +52,6 @@ describe('DeadspinExtractor', () => {
assert.equal(author, 'Chris Thompson');
});
it('returns the date_published', async () => {
// To pass this test, fill out the date_published selector
// in ./src/extractors/custom/deadspin.com/index.js.
@ -70,7 +68,6 @@ describe('DeadspinExtractor', () => {
assert.equal(date_published, '2016-10-13T16:34:00.000Z');
});
it('returns the lead_image_url', async () => {
// To pass this test, fill out the lead_image_url selector
// in ./src/extractors/custom/deadspin.com/index.js.

@ -37,7 +37,6 @@ describe('WikiaExtractor', () => {
assert.equal(title, 'Box Office: Its Good to Be Peculiar');
});
it('returns the author', async () => {
// To pass this test, fill out the author selector
// in ./src/extractors/custom/fandom.wikia.com/index.js.
@ -54,7 +53,6 @@ describe('WikiaExtractor', () => {
assert.equal(author, 'Drew Dietsch');
});
it('returns the date_published', async () => {
// To pass this test, fill out the date_published selector
// in ./src/extractors/custom/fandom.wikia.com/index.js.
@ -87,7 +85,6 @@ describe('WikiaExtractor', () => {
assert.equal(lead_image_url, 'http://fandom.wikia.com/wp-content/uploads/2016/10/box-office-peculiar-feature-hero.jpg');
});
it('returns the content', async () => {
// To pass this test, fill out the content selector
// in ./src/extractors/custom/fandom.wikia.com/index.js.

@ -32,7 +32,6 @@ describe('MediumExtractor', () => {
assert.equal(title, 'WTF? Whats The Future?');
});
it('returns the author', async () => {
const html =
fs.readFileSync('./fixtures/medium.com/1477523363921.html');
@ -45,7 +44,6 @@ describe('MediumExtractor', () => {
assert.equal(author, 'Tim O\'Reilly');
});
it('returns the date_published', async () => {
const html =
fs.readFileSync('./fixtures/medium.com/1477523363921.html');
@ -58,7 +56,6 @@ describe('MediumExtractor', () => {
assert.equal(date_published, '2016-10-19T14:24:20.323Z');
});
it('returns the dek', async () => {
const html =
fs.readFileSync('./fixtures/medium.com/1477523363921.html');
@ -71,7 +68,6 @@ describe('MediumExtractor', () => {
assert.equal(dek, null);
});
it('returns the lead_image_url', async () => {
// To pass this test, fill out the lead_image_url selector
// in ./src/extractors/custom/medium.com/index.js.
@ -88,7 +84,6 @@ describe('MediumExtractor', () => {
assert.equal(lead_image_url, 'https://cdn-images-1.medium.com/max/1200/1*3Gzaug9mRc8vvx1cuQWkog.png');
});
it('returns the content', async () => {
const html =
fs.readFileSync('./fixtures/medium.com/1477523363921.html');

@ -15,4 +15,3 @@ describe('TwitterExtractor', () => {
assert.equal(date_published, '2016-06-21T15:27:25.000Z');
});
});

@ -37,7 +37,6 @@ describe('CustomExtractor', () => {
assert.equal(title, 'A Light Filled LA Loft');
});
it('returns the author', async () => {
// To pass this test, fill out the author selector
// in ./src/extractors/custom/www.apartmenttherapy.com/index.js.
@ -54,7 +53,6 @@ describe('CustomExtractor', () => {
assert.equal(author, 'Apartment Therapy Submissions');
});
it('returns the date_published', async () => {
// To pass this test, fill out the date_published selector
// in ./src/extractors/custom/www.apartmenttherapy.com/index.js.
@ -71,7 +69,6 @@ describe('CustomExtractor', () => {
assert.equal(date_published, '2016-10-13T21:00:00.000Z');
});
it('returns the dek', async () => {
// To pass this test, fill out the dek selector
// in ./src/extractors/custom/www.apartmenttherapy.com/index.js.
@ -88,7 +85,6 @@ describe('CustomExtractor', () => {
assert.equal(dek, "Name: Ashley Location: Downtown — Los Angeles, California Welcome to our sunny and spacious downtown home located in the in the heart of Downtown LA's Historic Core. Inside you'll find a 1,300 square foot bi-level ground unit with loft (only three of its kind!) that offers an unparalleled, refined industrial, modern aesthetic.");
});
it('returns the lead_image_url', async () => {
// To pass this test, fill out the lead_image_url selector
// in ./src/extractors/custom/www.apartmenttherapy.com/index.js.
@ -105,7 +101,6 @@ describe('CustomExtractor', () => {
assert.equal(lead_image_url, 'http://atmedia.imgix.net/9332fdca908b1fcc5c9a6891b458820718239950?w=1500&fit=max');
});
it('returns the content', async () => {
// To pass this test, fill out the content selector
// in ./src/extractors/custom/www.apartmenttherapy.com/index.js.

@ -37,7 +37,6 @@ describe('CustomExtractor', () => {
assert.equal(title, 'American Theatre Wing Launches Andrew Lloyd Webber Training Scholarships');
});
it('returns the author', async () => {
// To pass this test, fill out the author selector
// in ./src/extractors/custom/www.broadwayworld.com/index.js.
@ -54,7 +53,6 @@ describe('CustomExtractor', () => {
assert.equal(author, 'BWW News Desk');
});
it('returns the date_published', async () => {
// To pass this test, fill out the date_published selector
// in ./src/extractors/custom/www.broadwayworld.com/index.js.
@ -71,7 +69,6 @@ describe('CustomExtractor', () => {
assert.equal(date_published, '2016-10-13T19:35:00.000Z');
});
it('returns the dek', async () => {
// To pass this test, fill out the dek selector
// in ./src/extractors/custom/www.broadwayworld.com/index.js.
@ -88,7 +85,6 @@ describe('CustomExtractor', () => {
assert.equal(dek, 'The American Theatre Wing announced today that their Andrew Lloyd Webber Initiative has launched its second initiative program, the Training Scholarships, bridging the gap between talent and opportunity and creating a strong pipeline to the professional theatre for promising artists of all backgrounds.');
});
it('returns the lead_image_url', async () => {
// To pass this test, fill out the lead_image_url selector
// in ./src/extractors/custom/www.broadwayworld.com/index.js.
@ -105,7 +101,6 @@ describe('CustomExtractor', () => {
assert.equal(lead_image_url, 'https://images.bwwstatic.com/columnpic7/7B5FD766-A644-E386-19DE07017A3AD79C.jpg');
});
it('returns the content', async () => {
// To pass this test, fill out the content selector
// in ./src/extractors/custom/www.broadwayworld.com/index.js.

@ -37,7 +37,6 @@ describe('BuzzfeedExtractor', () => {
assert.equal(title, 'People Are Calling Out This Edited Picture Of Demi Lovato For Body-Shaming Her');
});
it('returns the author', async () => {
// To pass this test, fill out the author selector
// in ./src/extractors/custom/www.buzzfeed.com/index.js.
@ -54,7 +53,6 @@ describe('BuzzfeedExtractor', () => {
assert.equal(author, 'Ikran Dahir');
});
// it('returns the date_published', async () => {
// // To pass this test, fill out the date_published selector
// // in ./src/extractors/custom/www.buzzfeed.com/index.js.
@ -71,7 +69,6 @@ describe('BuzzfeedExtractor', () => {
// // assert.equal(date_published, 'hi');
// });
it('returns the dek', async () => {
// To pass this test, fill out the dek selector
// in ./src/extractors/custom/www.buzzfeed.com/index.js.
@ -88,7 +85,6 @@ describe('BuzzfeedExtractor', () => {
assert.equal(dek, 'Lovato said: "Is that how my boobs should look?"..');
});
it('returns the lead_image_url', async () => {
// To pass this test, fill out the lead_image_url selector
// in ./src/extractors/custom/www.buzzfeed.com/index.js.
@ -105,7 +101,6 @@ describe('BuzzfeedExtractor', () => {
assert.equal(lead_image_url, 'https://img.buzzfeed.com/buzzfeed-static/static/2016-10/3/12/social_promotion/buzzfeed-prod-fastlane01/facebook-social-promotion-17757-1475512210-1.jpg');
});
it('returns the content', async () => {
// To pass this test, fill out the content selector
// in ./src/extractors/custom/www.buzzfeed.com/index.js.

@ -37,7 +37,6 @@ describe('LittleThingsExtractor', () => {
assert.equal(title, 'Snip The Stems Off Plastic Spoons To Make A Quirky Pineapple Lamp');
});
it('returns the author', async () => {
// To pass this test, fill out the author selector
// in ./src/extractors/custom/www.littlethings.com/index.js.
@ -54,7 +53,6 @@ describe('LittleThingsExtractor', () => {
assert.equal(author, 'Laura Caseley');
});
// it('returns the date_published', async () => {
// // To pass this test, fill out the date_published selector
// // in ./src/extractors/custom/www.littlethings.com/index.js.
@ -71,7 +69,6 @@ describe('LittleThingsExtractor', () => {
// assert.equal(date_published, '');
// });
// it('returns the dek', async () => {
// // To pass this test, fill out the dek selector
// // in ./src/extractors/custom/www.littlethings.com/index.js.
@ -88,7 +85,6 @@ describe('LittleThingsExtractor', () => {
// assert.equal(dek, '');
// });
it('returns the lead_image_url', async () => {
// To pass this test, fill out the lead_image_url selector
// in ./src/extractors/custom/www.littlethings.com/index.js.
@ -105,7 +101,6 @@ describe('LittleThingsExtractor', () => {
assert.equal(lead_image_url, 'http://cdn1.littlethings.com/app/uploads/2016/09/pineapple-b-thumb-1.jpg');
});
it('returns the content', async () => {
// To pass this test, fill out the content selector
// in ./src/extractors/custom/www.littlethings.com/index.js.

@ -37,7 +37,6 @@ describe('MSNExtractor', () => {
assert.equal(title, 'This Is Your Brain On Sad Movies; Plus 5 Films To Cry To');
});
it('returns the author', async () => {
// To pass this test, fill out the author selector
// in ./src/extractors/custom/www.msn.com/index.js.
@ -54,7 +53,6 @@ describe('MSNExtractor', () => {
assert.equal(author, 'Lizette Borreli');
});
it('returns the date_published', async () => {
// To pass this test, fill out the date_published selector
// in ./src/extractors/custom/www.msn.com/index.js.
@ -71,7 +69,6 @@ describe('MSNExtractor', () => {
assert.equal(date_published.split('T')[0], '2016-09-21');
});
it('returns the dek', async () => {
// To pass this test, fill out the dek selector
// in ./src/extractors/custom/www.msn.com/index.js.
@ -88,7 +85,6 @@ describe('MSNExtractor', () => {
assert.equal(dek, 'The psychological reason why we love to watch sad movies is linked to the release of endorphins.');
});
it('returns the lead_image_url', async () => {
// To pass this test, fill out the lead_image_url selector
// in ./src/extractors/custom/www.msn.com/index.js.
@ -105,7 +101,6 @@ describe('MSNExtractor', () => {
assert.equal(lead_image_url, null);
});
it('returns the content', async () => {
// To pass this test, fill out the content selector
// in ./src/extractors/custom/www.msn.com/index.js.

@ -36,7 +36,6 @@ describe('NewYorkerExtractor', () => {
assert.equal(title, 'Hacking, Cryptography, and the Countdown to Quantum Computing');
});
it('returns the author', async () => {
// To pass this test, fill out the author selector
// in ./src/extractors/custom/www.newyorker.com/index.js.
@ -53,7 +52,6 @@ describe('NewYorkerExtractor', () => {
assert.equal(author, 'Alex Hutchinson');
});
it('returns the date_published', async () => {
// To pass this test, fill out the date_published selector
// in ./src/extractors/custom/www.newyorker.com/index.js.
@ -70,7 +68,6 @@ describe('NewYorkerExtractor', () => {
assert.equal(date_published, '2016-09-26T18:04:22.000Z');
});
it('returns the dek', async () => {
// To pass this test, fill out the dek selector
// in ./src/extractors/custom/www.newyorker.com/index.js.
@ -87,7 +84,6 @@ describe('NewYorkerExtractor', () => {
assert.equal(dek, 'In a decade, events like the recent data breach at Yahoo could become much more common, driven by a new kind of machine.');
});
it('returns the lead_image_url', async () => {
// To pass this test, fill out the lead_image_url selector
// in ./src/extractors/custom/www.newyorker.com/index.js.

@ -37,7 +37,6 @@ describe('PoliticoExtractor', () => {
assert.equal(title, 'Insiders: Trump will sink Pence in VP debate');
});
it('returns the author', async () => {
// To pass this test, fill out the author selector
// in ./src/extractors/custom/www.politico.com/index.js.
@ -54,7 +53,6 @@ describe('PoliticoExtractor', () => {
assert.equal(author, 'Steven Shepard');
});
it('returns the date_published', async () => {
// To pass this test, fill out the date_published selector
// in ./src/extractors/custom/www.politico.com/index.js.
@ -71,7 +69,6 @@ describe('PoliticoExtractor', () => {
assert.equal(date_published, '2016-10-04T09:07:00.000Z');
});
it('returns the dek', async () => {
// To pass this test, fill out the dek selector
// in ./src/extractors/custom/www.politico.com/index.js.
@ -88,7 +85,6 @@ describe('PoliticoExtractor', () => {
assert.equal(dek, '"Is it just me or are the two VP candidates infinitely more appealing than their running mates?" said a Pennsylvania Republican.');
});
it('returns the lead_image_url', async () => {
// To pass this test, fill out the lead_image_url selector
// in ./src/extractors/custom/www.politico.com/index.js.
@ -105,7 +101,6 @@ describe('PoliticoExtractor', () => {
assert.equal(lead_image_url, 'http://static.politico.com/0f/e7/5ee9a89044d1a01f74140bcd5b9e/caucus-vp-preview.jpg');
});
it('returns the content', async () => {
// To pass this test, fill out the content selector
// in ./src/extractors/custom/www.politico.com/index.js.

@ -37,7 +37,6 @@ describe('WiredExtractor', () => {
assert.equal(title, 'An Ode to the Rosetta Spacecraft as It Flings Itself Into a Comet');
});
it('returns the author', async () => {
// To pass this test, fill out the author selector
// in ./src/extractors/custom/www.wired.com/index.js.
@ -54,7 +53,6 @@ describe('WiredExtractor', () => {
assert.equal(author, 'Emma Grey Ellis');
});
it('returns the date_published', async () => {
// To pass this test, fill out the date_published selector
// in ./src/extractors/custom/www.wired.com/index.js.
@ -71,7 +69,6 @@ describe('WiredExtractor', () => {
assert.equal(date_published, '2016-09-30T07:00:12.000Z');
});
it('returns the dek', async () => {
// To pass this test, fill out the dek selector
// in ./src/extractors/custom/www.wired.com/index.js.
@ -88,7 +85,6 @@ describe('WiredExtractor', () => {
assert.equal(dek, 'Time to break out the tissues, space fans.');
});
it('returns the lead_image_url', async () => {
// To pass this test, fill out the lead_image_url selector
// in ./src/extractors/custom/www.wired.com/index.js.
@ -105,7 +101,6 @@ describe('WiredExtractor', () => {
assert.equal(lead_image_url, 'https://www.wired.com/wp-content/uploads/2016/09/Rosetta_impact-1-1200x630.jpg');
});
it('returns the content', async () => {
// To pass this test, fill out the content selector
// in ./src/extractors/custom/www.wired.com/index.js.

@ -37,7 +37,6 @@ describe('YahooExtractor', () => {
assert.equal(title, 'Clinton Cancels Joint Events with Sanders');
});
it('returns the author', async () => {
// To pass this test, fill out the author selector
// in ./src/extractors/custom/www.yahoo.com/index.js.
@ -54,7 +53,6 @@ describe('YahooExtractor', () => {
assert.equal(author, 'Fox Nation');
});
it('returns the date_published', async () => {
// To pass this test, fill out the date_published selector
// in ./src/extractors/custom/www.yahoo.com/index.js.
@ -71,7 +69,6 @@ describe('YahooExtractor', () => {
assert.equal(date_published, '2016-10-03T05:00:00.000Z');
});
it('returns the dek', async () => {
// To pass this test, fill out the dek selector
// in ./src/extractors/custom/www.yahoo.com/index.js.
@ -88,7 +85,6 @@ describe('YahooExtractor', () => {
assert.equal(dek, 'The Hillary Clinton campaign has canceled joint appearances with former primary opponent Bernie Sanders after he admitted that "of course" it bothered him that Clinton seemed to be talking down to his supporters in hacked audio from a fundraiser. The two were set to have joint appearance together Monday. Instead, Sanders will appear in both Iowa and Wisconsin on Monday to boost her candidacy without her. Clinton is now scheduled to swing through Iowa later in the week, but possibly without Sanders, who was asked on CNN\'s "State of the Union" if it bothered him that Clinton had referred to his younger supporters as "the children of the great recession" who "live in their parents\' basement" to');
});
it('returns the lead_image_url', async () => {
// To pass this test, fill out the lead_image_url selector
// in ./src/extractors/custom/www.yahoo.com/index.js.
@ -105,7 +101,6 @@ describe('YahooExtractor', () => {
assert.equal(lead_image_url, 'https://s.yimg.com/uu/api/res/1.2/tE8CoXSgHD15n5p8wUwGJA--/aD0zMDA7dz02MjQ7c209MTthcHBpZD15dGFjaHlvbg--/http://slingstone.zenfs.com/offnetwork/218c3f97f0b7e1598b6dc9fd10126e22');
});
it('returns the content', async () => {
// To pass this test, fill out the content selector
// in ./src/extractors/custom/www.yahoo.com/index.js.

@ -45,4 +45,3 @@ const GenericAuthorExtractor = {
};
export default GenericAuthorExtractor;

@ -43,4 +43,3 @@ describe('GenericAuthorExtractor', () => {
});
});
});

@ -25,7 +25,6 @@ export default function extractBestNode($, opts) {
// TODO Do I need this? AP
// let $root = $.root().clone()
if (opts.stripUnlikelyCandidates) {
$ = stripUnlikelyCandidates($);
}

@ -20,4 +20,3 @@ describe('Scoring utils', () => {
});
});
});

@ -128,7 +128,6 @@ export const PHOTO_HINTS = [
];
export const PHOTO_HINTS_RE = new RegExp(PHOTO_HINTS.join('|'), 'i');
// A list of strings that denote a positive scoring for this content as being
// an article container. Checked against className and id.
//
@ -287,7 +286,6 @@ export const BLOCK_LEVEL_TAGS = [
];
export const BLOCK_LEVEL_TAGS_RE = new RegExp(`^(${BLOCK_LEVEL_TAGS.join('|')})$`, 'i');
// The removal is implemented as a blacklist and whitelist, this test finds
// blacklisted elements that aren't whitelisted. We do this all in one
// expression-both because it's only one pass, and because this skips the
@ -300,7 +298,6 @@ export const CANDIDATES_WHITELIST = new RegExp(candidatesWhitelist, 'i');
export const UNLIKELY_RE = new RegExp(`!(${candidatesWhitelist})|(${candidatesBlacklist})`, 'i');
export const PARAGRAPH_SCORE_TAGS = new RegExp('^(p|li|span|pre)$', 'i');
export const CHILD_CONTENT_TAGS = new RegExp('^(td|blockquote|ol|ul|dl)$', 'i');
export const BAD_TAGS = new RegExp('^(address|form)$', 'i');

@ -55,4 +55,3 @@ describe('findTopCandidate($)', () => {
assert.equal($($topCandidate).text().length, 3652);
});
});

@ -25,4 +25,3 @@ export default function getOrInitScore($node, $, weightNodes = true) {
return score;
}

@ -19,4 +19,3 @@ describe('Scoring utils', () => {
});
});
});

@ -5,7 +5,6 @@ import {
READABILITY_ASSET,
} from './constants';
// Get the score of a node based on its className and id.
export default function getWeight(node) {
const classes = node.attr('class');
@ -52,4 +51,3 @@ export default function getWeight(node) {
return score;
}

@ -2,4 +2,3 @@
export default function scoreCommas(text) {
return (text.match(/,/g) || []).length;
}

@ -15,4 +15,3 @@ describe('Scoring utils', () => {
});
});
});

@ -22,4 +22,3 @@ export default function scoreLength(textLength, tagName = 'p') {
return 0;
}

@ -18,4 +18,3 @@ describe('Scoring utils', () => {
});
});
});

@ -8,7 +8,6 @@ import {
scoreParagraph,
} from './index';
describe('scoreNode(node)', () => {
it('scores P, LI, SPAN, and PRE using scoreParagraph', () => {
const html = '<p><em>Foo</em> bar</p>';
@ -91,4 +90,3 @@ describe('scoreNode(node)', () => {
assert.equal(score, -5);
});
});

@ -32,4 +32,3 @@ export default function scoreParagraph(node) {
return score;
}

@ -1,6 +1,4 @@
export default function setScore($node, $, score) {
$node.attr('score', score);
return $node;
}

@ -58,4 +58,3 @@ export const DATE_PUBLISHED_URL_RES = [
// /2012/jan/27/
new RegExp(`/(20\\d{2}/${abbrevMonthsStr}/[0-3]\\d)/`, 'i'),
];

@ -92,4 +92,3 @@ describe('GenericDatePublishedExtractor', () => {
});
});
});

@ -51,4 +51,3 @@ describe('GenericExtractor', () => {
});
});
});

@ -221,4 +221,3 @@ describe('scoreByPosition($imgs, index)', () => {
assert.equal(scoreByPosition($imgs, 0), 3);
});
});

@ -46,5 +46,4 @@ const GenericNextPageUrlExtractor = {
},
};
export default GenericNextPageUrlExtractor;

@ -35,4 +35,3 @@ export const PREV_LINK_TEXT_RE = new RegExp('(prev|earl|old|new|<|«)', 'i');
// Match any phrase that looks like it could be page, or paging, or pagination
export const PAGE_RE = new RegExp('pag(e|ing|inat)', 'i');

@ -39,4 +39,3 @@ describe('scoreLinks(links)', () => {
assert.equal(scoredPages, null);
});
});

@ -20,4 +20,3 @@ describe('scoreBaseUrl(href, baseRegex)', () => {
assert.equal(scoreBaseUrl(badUrl, baseRegex), 0);
});
});

@ -49,4 +49,3 @@ export default function scoreByParents($link) {
return score;
}

@ -32,4 +32,3 @@ describe('scoreByParents($link)', () => {
assert.equal(scoreByParents($link), -25);
});
});

@ -15,4 +15,3 @@ describe('scoreCapLinks(linkData)', () => {
assert.equal(scoreCapLinks(linkData), 0);
});
});

@ -15,4 +15,3 @@ describe('scoreExtraneousLinks(href)', () => {
assert.equal(scoreExtraneousLinks(url), 0);
});
});

@ -19,4 +19,3 @@ describe('scoreLinkText(linkText)', () => {
assert.equal(scoreLinkText('4', 5), -44);
});
});

@ -15,4 +15,3 @@ describe('scoreNextLinkText(linkData)', () => {
assert.equal(scoreNextLinkText(linkData), 0);
});
});

@ -15,4 +15,3 @@ describe('scorePageInLink(pageNum, isWp)', () => {
assert.equal(scorePageInLink(10, true), 0);
});
});

@ -15,4 +15,3 @@ describe('scorePrevLink(linkData)', () => {
assert.equal(scorePrevLink(linkData), 0);
});
});

@ -52,4 +52,3 @@ export default function shouldScore(
return true;
}

@ -15,7 +15,6 @@ const BAD_CONTENT_TYPES = [
export const BAD_CONTENT_TYPES_RE = new RegExp(`^(${BAD_CONTENT_TYPES.join('|')})$`, 'i');
// Use this setting as the maximum size an article can be
// for us to attempt parsing. Defaults to 5 MB.
export const MAX_CONTENT_LENGTH = 5242880;

@ -7,4 +7,3 @@ export function clean(string) {
export function assertClean(a, b) {
assert.equal(clean(a), clean(b));
}

@ -4,7 +4,6 @@ import { paragraphize } from './index';
// Another good candidate for refactoring/optimizing.
// Very imperative code, I don't love it. - AP
// Given cheerio object, convert consecutive <br /> tags into
// <p /> tags instead.
//

@ -34,4 +34,3 @@ describe('Generic Extractor Utils', () => {
});
});
});

@ -20,4 +20,3 @@ describe('cleanHOnes($)', () => {
assertClean(result.html(), HTML.convertThreeHOnes.after);
});
});

@ -27,4 +27,3 @@ describe('cleanHeaders(article, $)', () => {
assertClean(result.html(), HTML.dropWithNegativeWeight.after);
});
});

@ -27,4 +27,3 @@ describe('cleanImages($)', () => {
assertClean(result.html(), HTML.cleanSpacer.after);
});
});

@ -106,4 +106,3 @@ export default function cleanTags($article, $) {
return $;
}

@ -63,4 +63,3 @@ describe('cleanTags($)', () => {
assertClean(result.html(), HTML.cleanEntryContentAsset.before);
});
});

@ -43,7 +43,6 @@ export const CLEAN_CONDITIONALLY_TAGS = ['ul', 'ol', 'table', 'div', 'button', '
const HEADER_TAGS = ['h2', 'h3', 'h4', 'h5', 'h6'];
export const HEADER_TAG_LIST = HEADER_TAGS.join(',');
// // CONTENT FETCHING CONSTANTS ////
// A list of strings that can be considered unlikely candidates when
@ -176,7 +175,6 @@ export const PHOTO_HINTS = [
];
export const PHOTO_HINTS_RE = new RegExp(PHOTO_HINTS.join('|'), 'i');
// A list of strings that denote a positive scoring for this content as being
// an article container. Checked against className and id.
//
@ -375,7 +373,6 @@ export const BLOCK_LEVEL_TAGS = [
];
export const BLOCK_LEVEL_TAGS_RE = new RegExp(`^(${BLOCK_LEVEL_TAGS.join('|')})$`, 'i');
// The removal is implemented as a blacklist and whitelist, this test finds
// blacklisted elements that aren't whitelisted. We do this all in one
// expression-both because it's only one pass, and because this skips the
@ -388,7 +385,6 @@ export const CANDIDATES_WHITELIST = new RegExp(candidatesWhitelist, 'i');
export const UNLIKELY_RE = new RegExp(`!(${candidatesWhitelist})|(${candidatesBlacklist})`, 'i');
export const PARAGRAPH_SCORE_TAGS = new RegExp('^(p|li|span|pre)$', 'i');
export const CHILD_CONTENT_TAGS = new RegExp('^(td|blockquote|ol|ul|dl)$', 'i');
export const BAD_TAGS = new RegExp('^(address|form)$', 'i');

@ -38,4 +38,3 @@ describe('convertNodeTo(node, $)', () => {
assert.equal(result, html);
});
});

@ -29,4 +29,3 @@ describe('convertToParagraphs($)', () => {
assertClean(convertToParagraphs($).html(), html);
});
});

@ -32,4 +32,3 @@ describe('extractFromMeta($, metaNames, cachedNames, cleanTags)', () => {
assert.equal(result, HTML.metaEmptyDupes.result);
});
});

@ -33,4 +33,3 @@ describe('extractFromSelectors($, selectors, maxChildren, textOnly)', () => {
assert.equal(result, HTML.manyChildren.result);
});
});

@ -1,4 +1,3 @@
export function textLength(text) {
return text.trim()
.replace(/\s+/g, ' ')

@ -30,4 +30,3 @@ describe('linkDensity($)', () => {
assert.equal(density, 0);
});
});

@ -32,4 +32,3 @@ describe('markToKeep($)', () => {
assertClean(result.html(), keptHtml);
});
});

@ -30,4 +30,3 @@ describe('Generic Extractor Utils', () => {
});
});
});

@ -36,4 +36,3 @@ describe('removeEmpty($)', () => {
assertClean(result.html(), html);
});
});

@ -13,4 +13,3 @@ describe('rewriteTopLevel(node, $)', () => {
assertClean(result.html(), HTML.rewriteHTMLBody.after);
});
});

@ -20,4 +20,3 @@ describe('stripJunkTags($)', () => {
assertClean(result.html(), HTML.ignoresKeepable.after);
});
});

@ -31,4 +31,3 @@ describe('Generic Extractor Utils', () => {
});
});
});

@ -17,4 +17,3 @@ describe('articleBaseUrl(url, parsedUrl)', () => {
assert.equal(articleBaseUrl(url), cleaned);
});
});

@ -4,4 +4,3 @@ const SENTENCE_END_RE = new RegExp('.( |$)');
export default function hasSentenceEnd(text) {
return SENTENCE_END_RE.test(text);
}

@ -17,4 +17,3 @@ describe('removeAnchor(url)', () => {
assert.equal(removeAnchor(url), cleaned);
});
});

Loading…
Cancel
Save