style(eslint): add eslint-plugin-n (#12393)
This commit is contained in:
parent
da0cab5e90
commit
5b6d7cb524
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"extends": ["eslint:recommended", "plugin:prettier/recommended", "plugin:yml/recommended"],
|
||||
"extends": ["eslint:recommended", "plugin:n/recommended", "plugin:prettier/recommended", "plugin:yml/recommended"],
|
||||
"plugins": ["prettier"],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
|
|
@ -11,16 +11,25 @@
|
|||
"browser": true
|
||||
},
|
||||
"rules": {
|
||||
"no-console": 2,
|
||||
// possible problems
|
||||
"array-callback-return": 2,
|
||||
"no-await-in-loop": 2,
|
||||
"no-control-regex": 0,
|
||||
"no-duplicate-imports": 2,
|
||||
"no-prototype-builtins": 0,
|
||||
"no-unsafe-negation": 2,
|
||||
"require-atomic-updates": 0,
|
||||
// suggestions
|
||||
"arrow-body-style": 2,
|
||||
"block-scoped-var": 2,
|
||||
"curly": 2,
|
||||
"dot-notation": 2,
|
||||
"eqeqeq": 2,
|
||||
"no-console": 2,
|
||||
"no-eval": 2,
|
||||
"no-extend-native": 2,
|
||||
"no-extra-label": 2,
|
||||
"no-global-assign": 2,
|
||||
"no-implicit-globals": 2,
|
||||
"no-labels": 2,
|
||||
"no-multi-str": 2,
|
||||
"comma-spacing": 2,
|
||||
"comma-style": 2,
|
||||
"no-implicit-coercion": [
|
||||
"error",
|
||||
{
|
||||
|
|
@ -30,44 +39,57 @@
|
|||
"disallowTemplateShorthand": true
|
||||
}
|
||||
],
|
||||
"no-implicit-globals": 2,
|
||||
"no-labels": 2,
|
||||
"no-multi-str": 2,
|
||||
"no-new-func": 2,
|
||||
"no-restricted-imports": 2,
|
||||
"no-return-await": 2,
|
||||
"no-unneeded-ternary": 2,
|
||||
"no-useless-computed-key": 2,
|
||||
"no-useless-concat": 1,
|
||||
"no-useless-rename": 2,
|
||||
"no-var": 2,
|
||||
"object-shorthand": 2,
|
||||
"prefer-arrow-callback": 2,
|
||||
"prefer-const": 2,
|
||||
"prefer-regex-literals": 1,
|
||||
"require-await": 2,
|
||||
"spaced-comment": 2,
|
||||
// layout & formatting
|
||||
"arrow-parens": 2,
|
||||
"arrow-spacing": 2,
|
||||
"comma-spacing": 2,
|
||||
"comma-style": 2,
|
||||
"func-call-spacing": 2,
|
||||
"keyword-spacing": 2,
|
||||
"linebreak-style": 2,
|
||||
"lines-around-comment": 2,
|
||||
"no-multiple-empty-lines": 2,
|
||||
"space-infix-ops": 2,
|
||||
"arrow-spacing": 2,
|
||||
"no-var": 2,
|
||||
"prefer-const": 2,
|
||||
"no-unsafe-negation": 2,
|
||||
"array-callback-return": 2,
|
||||
"dot-notation": 2,
|
||||
"no-eval": 2,
|
||||
"no-extend-native": 2,
|
||||
"no-extra-label": 2,
|
||||
"no-trailing-spaces": 2,
|
||||
"rest-spread-spacing": 2,
|
||||
"semi": 2,
|
||||
"space-before-blocks": 2,
|
||||
"space-in-parens": 2,
|
||||
"space-infix-ops": 2,
|
||||
"space-unary-ops": 2,
|
||||
"spaced-comment": 2,
|
||||
"arrow-body-style": 2,
|
||||
"arrow-parens": 2,
|
||||
"no-restricted-imports": 2,
|
||||
"no-duplicate-imports": 2,
|
||||
"no-useless-computed-key": 2,
|
||||
"no-useless-rename": 2,
|
||||
"rest-spread-spacing": 2,
|
||||
"no-trailing-spaces": 2,
|
||||
"no-control-regex": 0,
|
||||
// plugin specific
|
||||
"n/no-extraneous-require": [
|
||||
"error",
|
||||
{
|
||||
"allowModules": ["puppeteer-extra-plugin-user-preferences", "puppeteer-extra-plugin-user-data-dir"]
|
||||
}
|
||||
],
|
||||
"n/no-deprecated-api": 1,
|
||||
"n/no-missing-require": 0,
|
||||
"n/no-process-exit": 0,
|
||||
"n/no-unpublished-require": [
|
||||
"error",
|
||||
{
|
||||
"allowModules": ["tosource"]
|
||||
}
|
||||
],
|
||||
"prettier/prettier": 0,
|
||||
"no-await-in-loop": 2,
|
||||
"require-atomic-updates": 0,
|
||||
"no-prototype-builtins": 0,
|
||||
"no-new-func": 2,
|
||||
"require-await": 2,
|
||||
"no-return-await": 2,
|
||||
"prefer-arrow-callback": 2,
|
||||
"object-shorthand": 2,
|
||||
"yml/quotes": [
|
||||
"error",
|
||||
{
|
||||
|
|
|
|||
|
|
@ -437,6 +437,46 @@ Including 'Science', 'Science Advances', 'Science Immunology', 'Science Robotics
|
|||
|
||||
<RouteEn author="Derekmini TonyRL" example="/springer/journal/10450" path="/springer/journal/:journal" :paramsDesc="['Journal Code, the number in the URL from the journal homepage']" radar="1" rssbud="1"/>
|
||||
|
||||
## Telecompaper
|
||||
|
||||
### News
|
||||
|
||||
<RouteEn author="nczitzk" example="/telecompaper/news/mobile/2020/China/News" path="/telecompaper/news/:caty/:year?/:country?/:type?" :paramsDesc="['Category, see table below', 'Year. The year in respective category page filter, `all` for unlimited year, empty by default', 'Country or continent, `all` for unlimited country or continent, empty by default', 'Type, can be found in the `Types` filter, `all` for unlimited type, unlimited by default']">
|
||||
|
||||
Category
|
||||
|
||||
| WIRELESS | BROADBAND | VIDEO | GENERAL | IT | INDUSTRY RESOURCES |
|
||||
| -------- | --------- | --------- | ------- | -- | ------------------ |
|
||||
| mobile | internet | boardcast | general | it | industry-resources |
|
||||
|
||||
::: tip Tips
|
||||
|
||||
If `country` or `type` includes empty space, use `-` instead. For example, `United States` needs to be replaced with `United-States`, `White paper` needs to be replaced with `White-paper`
|
||||
|
||||
Filters in [INDUSTRY RESOURCES](https://www.telecompaper.com/industry-resources) only provides `Content Type` which corresponds to `type`. `year` and `country` are not supported.
|
||||
|
||||
:::
|
||||
|
||||
</RouteEn>
|
||||
|
||||
### Search
|
||||
|
||||
<RouteEn author="nczitzk" example="/telecompaper/search/Nokia" path="/telecompaper/search/:keyword?/:company?/:sort?/:period?" :paramsDesc="['Keyword', 'Company name, empty by default', 'Sorting, see table below, `Date Descending` by default', 'Date selection, Last 12 months by default']">
|
||||
|
||||
Sorting
|
||||
|
||||
| Date Ascending | Date Descending |
|
||||
| -------------- | --------------- |
|
||||
| 1 | 2 |
|
||||
|
||||
Date selection
|
||||
|
||||
| 1 month | 3 months | 6 months | 12 months | 24 months |
|
||||
| ------- | -------- | -------- | --------- | --------- |
|
||||
| 1 | 3 | 6 | 12 | 24 |
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## The University of Chicago Press: Journals
|
||||
|
||||
### Current Issue
|
||||
|
|
|
|||
|
|
@ -418,6 +418,46 @@ You can get all short name of a journal from <https://www.nature.com/siteindex>
|
|||
|
||||
</Route>
|
||||
|
||||
## Telecompaper
|
||||
|
||||
### News
|
||||
|
||||
<Route author="nczitzk" example="/telecompaper/news/mobile/2020/China/News" path="/telecompaper/news/:caty/:year?/:country?/:type?" :paramsDesc="['分类,见下表', '年份,可在所选分类页中 Filter 的 `Years` 选择器中选择相应年份,不限年份则填入 `all`,默认为不限', '国家或大洲,可在所选分类页中 Filter 的 `Countries` 选择器中选择相应国家或大洲,不限国家或大洲则填入 `all`,默认为不限', '类型,可在所选分类页中 Filter 的 `Types` 选择器中选择相应类型,不限类型则填入 `all`,默认为不限']">
|
||||
|
||||
可选分类如下
|
||||
|
||||
| WIRELESS | BROADBAND | VIDEO | GENERAL | IT | INDUSTRY RESOURCES |
|
||||
| -------- | --------- | --------- | ------- | -- | ------------------ |
|
||||
| mobile | internet | boardcast | general | it | industry-resources |
|
||||
|
||||
::: tip 提示
|
||||
|
||||
若 `country` 或 `type` 参数包含空格,则用 `-` 替代。如 `United States` 更换为 `United-States`,`White paper` 更换为 `White-paper`
|
||||
|
||||
[INDUSTRY RESOURCES](https://www.telecompaper.com/industry-resources) 分类页的 Filter 仅提供了 `Content Type` 选择器,对应路由中 `type` 参数。`year` 和 `country` 参数则对该分类无效。
|
||||
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
### Search
|
||||
|
||||
<Route author="nczitzk" example="/telecompaper/search/Nokia" path="/telecompaper/search/:keyword?/:company?/:sort?/:period?" :paramsDesc="['关键词', '公司名,默认为不限', '排序,见下表,默认为 Date Descending', '发表在时间段内,默认为 12 months']">
|
||||
|
||||
排序
|
||||
|
||||
| Date Ascending | Date Descending |
|
||||
| -------------- | --------------- |
|
||||
| 1 | 2 |
|
||||
|
||||
发表在时间段内
|
||||
|
||||
| 1 month | 3 months | 6 months | 12 months | 24 months |
|
||||
| ------- | -------- | -------- | --------- | --------- |
|
||||
| 1 | 3 | 6 | 12 | 24 |
|
||||
|
||||
</Route>
|
||||
|
||||
## USENIX
|
||||
|
||||
### Security Symposia
|
||||
|
|
|
|||
|
|
@ -427,46 +427,6 @@ Solidot 提供的 feed:
|
|||
|
||||
</Route>
|
||||
|
||||
## Telecompaper
|
||||
|
||||
### News
|
||||
|
||||
<Route author="nczitzk" example="/telecompaper/news/mobile/2020/China/News" path="/telecompaper/news/:caty/:year?/:country?/:type?" :paramsDesc="['分类,见下表', '年份,可在所选分类页中 Filter 的 `Years` 选择器中选择相应年份,不限年份则填入 `all`,默认为不限', '国家或大洲,可在所选分类页中 Filter 的 `Countries` 选择器中选择相应国家或大洲,不限国家或大洲则填入 `all`,默认为不限', '类型,可在所选分类页中 Filter 的 `Types` 选择器中选择相应类型,不限类型则填入 `all`,默认为不限']">
|
||||
|
||||
可选分类如下
|
||||
|
||||
| WIRELESS | BROADBAND | VIDEO | GENERAL | IT | INDUSTRY RESOURCES |
|
||||
| -------- | --------- | --------- | ------- | -- | ------------------ |
|
||||
| mobile | internet | boardcast | general | it | industry-resources |
|
||||
|
||||
::: tip 提示
|
||||
|
||||
若 `country` 或 `type` 参数包含空格,则用 `-` 替代。如 `United States` 更换为 `United-States`,`White paper` 更换为 `White-paper`
|
||||
|
||||
[INDUSTRY RESOURCES](https://www.telecompaper.com/industry-resources) 分类页的 Filter 仅提供了 `Content Type` 选择器,对应路由中 `type` 参数。`year` 和 `country` 参数则对该分类无效。
|
||||
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
### Search
|
||||
|
||||
<Route author="nczitzk" example="/telecompaper/search/Nokia" path="/telecompaper/search/:keyword?/:company?/:sort?/:period?" :paramsDesc="['关键词', '公司名,默认为不限', '排序,见下表,默认为 Date Descending', '发表在时间段内,默认为 12 months']">
|
||||
|
||||
排序
|
||||
|
||||
| Date Ascending | Date Descending |
|
||||
| -------------- | --------------- |
|
||||
| 1 | 2 |
|
||||
|
||||
发表在时间段内
|
||||
|
||||
| 1 month | 3 months | 6 months | 12 months | 24 months |
|
||||
| ------- | -------- | -------- | --------- | --------- |
|
||||
| 1 | 3 | 6 | 12 | 24 |
|
||||
|
||||
</Route>
|
||||
|
||||
## The Atlantic
|
||||
|
||||
### News
|
||||
|
|
|
|||
|
|
@ -238,9 +238,9 @@ pageClass: routes
|
|||
|
||||
<Route author="yanbot-team" example="/ustb/yzxc/tzgg" path="/ustb/yzxc/tzgg" />
|
||||
|
||||
### 北京科技大学天津学院
|
||||
### 天津学院
|
||||
|
||||
<Route author="henbf" example="/ustb/tj/news/all" path="/ustb/tj/news/:type" :paramsDesc="['默认为 `all`']">
|
||||
<Route author="henbf" example="/ustb/tj/news/all" path="/ustb/tj/news/:type?" :paramsDesc="['默认为 `all`']">
|
||||
|
||||
| 全部 | 学院新闻 | 学术活动 | 城市建设学院 | 信息工程学院 | 经济学院 | 管理学院 | 材料系 | 机械工程系 | 护理系 | 法律系 | 外语系 | 艺术系 |
|
||||
| ---- | -------- | -------- | ------------ | ------------ | -------- | -------- | ------ | ---------- | ------ | ------ | ------ | ------ |
|
||||
|
|
|
|||
|
|
@ -748,7 +748,7 @@ router.get('/shu/:type?', lazyloadRouteHandler('./routes/universities/shu/index'
|
|||
router.get('/shu/jwc/:type?', lazyloadRouteHandler('./routes/universities/shu/jwc'));
|
||||
|
||||
// 北京科技大学天津学院
|
||||
router.get('/ustb/tj/news/:type?', lazyloadRouteHandler('./routes/universities/ustb/tj/news'));
|
||||
// router.get('/ustb/tj/news/:type?', lazyloadRouteHandler('./routes/universities/ustb/tj/news'));
|
||||
|
||||
// 深圳大学
|
||||
// router.get('/szu/yz/:type?', lazyloadRouteHandler('./routes/universities/szu/yz'));
|
||||
|
|
@ -3046,8 +3046,8 @@ router.get('/141ppv/:type/:key?', lazyloadRouteHandler('./routes/141ppv/141ppv')
|
|||
router.get('/curiouscat/user/:id', lazyloadRouteHandler('./routes/curiouscat/user'));
|
||||
|
||||
// Telecompaper
|
||||
router.get('/telecompaper/news/:caty/:year?/:country?/:type?', lazyloadRouteHandler('./routes/telecompaper/news'));
|
||||
router.get('/telecompaper/search/:keyword?/:company?/:sort?/:period?', lazyloadRouteHandler('./routes/telecompaper/search'));
|
||||
// router.get('/telecompaper/news/:caty/:year?/:country?/:type?', lazyloadRouteHandler('./routes/telecompaper/news'));
|
||||
// router.get('/telecompaper/search/:keyword?/:company?/:sort?/:period?', lazyloadRouteHandler('./routes/telecompaper/search'));
|
||||
|
||||
// 水木社区
|
||||
router.get('/newsmth/account/:id', lazyloadRouteHandler('./routes/newsmth/account'));
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ const got = require('@/utils/got');
|
|||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type || 'all';
|
||||
const rssData = {
|
||||
isType: ctx.params.type ? true : false,
|
||||
isType: !!ctx.params.type,
|
||||
Title: `湖南省政府采购网`,
|
||||
Desc: `湖南省政府采购网`,
|
||||
Link: `http://www.ccgp-hunan.gov.cn/page/notice/more.jsp`,
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ module.exports = async (ctx) => {
|
|||
const $ = cheerio.load(response);
|
||||
const data = JSON.parse($('script[type="application/ld+json"]').first().text());
|
||||
const { transformed } = parsePreloadedStateJSON($);
|
||||
const VideoObject = data['@type'] === 'VideoObject' ? true : false;
|
||||
const VideoObject = data['@type'] === 'VideoObject';
|
||||
const lede = !VideoObject ? transformed.article.headerProps.lede : null;
|
||||
|
||||
let articleBody = '';
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ module.exports = async (ctx) => {
|
|||
let overview = false;
|
||||
if (titles[ctx.params.category]) {
|
||||
category = ctx.params.category;
|
||||
overview = ctx.params.overview ? true : false;
|
||||
overview = !!ctx.params.overview;
|
||||
category = category === 'tech' ? 'technews' : category;
|
||||
} else if (ctx.params.category) {
|
||||
overview = true;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
'/news/:caty/:year?/:country?/:type?': ['nczitzk'],
|
||||
'/search/:keyword?/:company?/:sort?/:period?': ['nczitzk'],
|
||||
};
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const tough = require('tough-cookie');
|
||||
// eslint-disable-next-line n/no-extraneous-require
|
||||
const FormData = require('form-data');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
module.exports = {
|
||||
'telecompaper.com': {
|
||||
_name: 'Telecompaper',
|
||||
'.': [
|
||||
{
|
||||
title: 'News',
|
||||
docs: 'https://docs.rsshub.app/journal.html#telecompaper',
|
||||
},
|
||||
{
|
||||
title: 'Search',
|
||||
docs: 'https://docs.rsshub.app/journal.html#telecompaper',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/news/:caty/:year?/:country?/:type?', require('./news'));
|
||||
router.get('/search/:keyword?/:company?/:sort?/:period?', require('./search'));
|
||||
};
|
||||
|
|
@ -1,25 +1,5 @@
|
|||
module.exports = {
|
||||
'/yjsy/news/adma': ['DA1Y1'],
|
||||
'/yjsy/news/all': ['DA1Y1'],
|
||||
'/yjsy/news/cicst': ['DA1Y1'],
|
||||
'/yjsy/news/cres': ['DA1Y1'],
|
||||
'/yjsy/news/huasheng': ['DA1Y1'],
|
||||
'/yjsy/news/iet': ['DA1Y1'],
|
||||
'/yjsy/news/ihmm': ['DA1Y1'],
|
||||
'/yjsy/news/marx': ['DA1Y1'],
|
||||
'/yjsy/news/me': ['DA1Y1'],
|
||||
'/yjsy/news/metall': ['DA1Y1'],
|
||||
'/yjsy/news/mse': ['DA1Y1'],
|
||||
'/yjsy/news/ncms': ['DA1Y1'],
|
||||
'/yjsy/news/saee': ['DA1Y1'],
|
||||
'/yjsy/news/scce': ['DA1Y1'],
|
||||
'/yjsy/news/sd': ['DA1Y1'],
|
||||
'/yjsy/news/seee': ['DA1Y1'],
|
||||
'/yjsy/news/sem': ['DA1Y1'],
|
||||
'/yjsy/news/sfs': ['DA1Y1'],
|
||||
'/yjsy/news/shuli': ['DA1Y1'],
|
||||
'/yjsy/news/skl': ['DA1Y1'],
|
||||
'/yjsy/news/slam': ['DA1Y1'],
|
||||
'/yjsy/news/wenfa': ['DA1Y1'],
|
||||
'/tj/news/:type?': ['henbf'],
|
||||
'/yjsy/news/:type': ['DA1Y1'],
|
||||
'/yzxc/tzgg': ['yanbot-team'],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,14 @@ module.exports = {
|
|||
target: '/ustb/yjsy/news/:type',
|
||||
},
|
||||
],
|
||||
tj: [
|
||||
{
|
||||
title: '天津学院',
|
||||
docs: 'https://docs.rsshub.app/university.html#bei-jing-ke-ji-da-xue',
|
||||
source: ['/*'],
|
||||
target: '/ustb/tj/news/all',
|
||||
},
|
||||
],
|
||||
yzxc: [
|
||||
{
|
||||
title: '研究生招生信息网',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/tj/news/:type?', require('./tj/news'));
|
||||
router.get('/yjsy/news/:type', require('./yjsy/news'));
|
||||
router.get('/yzxc/tzgg', require('./yzxc/tzgg'));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const dayjs = require('dayjs');
|
||||
const _ = require('lodash');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
const baseUrl = 'http://tj.ustb.edu.cn';
|
||||
const maps = {
|
||||
|
|
@ -22,18 +22,17 @@ const maps = {
|
|||
function getNews(data) {
|
||||
const $ = cheerio.load(data);
|
||||
return $('div[class="classnews"] ul li a')
|
||||
.slice(0, 5)
|
||||
.map((_, elem) => ({
|
||||
.toArray()
|
||||
.map((elem) => ({
|
||||
link: baseUrl + elem.attribs.href,
|
||||
title: elem.children[0].data,
|
||||
pubDate: dayjs(elem.attribs.href.split('/')[3].split('.')[0]).toString(),
|
||||
}))
|
||||
.get();
|
||||
pubDate: timezone(parseDate(elem.attribs.href.split('/')[3].split('.')[0].substring(0, 14), 'YYYYMMDDHHmmss'), 8),
|
||||
}));
|
||||
}
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
let type = ctx.params.type || 'all';
|
||||
if (!_.includes(_.keys(maps), type)) {
|
||||
if (!Object.keys(maps).includes(type)) {
|
||||
type = 'all';
|
||||
}
|
||||
|
||||
|
|
@ -46,14 +45,14 @@ module.exports = async (ctx) => {
|
|||
if (type === 'all') {
|
||||
const all = await Promise.all(
|
||||
Object.values(maps).map(async (link) => {
|
||||
const response = await got.get(baseUrl + link);
|
||||
const response = await got(baseUrl + link);
|
||||
const news = getNews(response.data);
|
||||
return Promise.resolve(news);
|
||||
return news;
|
||||
})
|
||||
);
|
||||
responseData.item = _.orderBy(_.flatMapDepth(all), (res) => new Date(res.pubDate), ['desc']);
|
||||
responseData.item = all.flatMap((res) => res);
|
||||
} else {
|
||||
const response = await got.get(baseUrl + maps[type]);
|
||||
const response = await got(baseUrl + maps[type]);
|
||||
const news = getNews(response.data);
|
||||
responseData.item = news;
|
||||
}
|
||||
|
|
@ -141,6 +141,7 @@
|
|||
"cross-env": "7.0.3",
|
||||
"eslint": "8.39.0",
|
||||
"eslint-config-prettier": "8.8.0",
|
||||
"eslint-plugin-n": "15.7.0",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"eslint-plugin-yml": "1.5.0",
|
||||
"fs-extra": "11.1.1",
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ describe('rand-user-agent', () => {
|
|||
const uaArr = Array(100)
|
||||
.fill()
|
||||
.map(() => randUserAgent({ browser: 'chrome', os: 'windows' }));
|
||||
const match = uaArr.find((e) => (e.includes('Chrome-Lighthouse') || e.includes('HeadlessChrome') ? true : false));
|
||||
const match = uaArr.find((e) => !!(e.includes('Chrome-Lighthouse') || e.includes('HeadlessChrome')));
|
||||
expect(match).toBeFalsy();
|
||||
});
|
||||
|
||||
|
|
|
|||
65
yarn.lock
65
yarn.lock
|
|
@ -1608,7 +1608,6 @@ brotli@^1.3.3:
|
|||
|
||||
"browser-request@github:postlight/browser-request#feat-add-headers-to-response":
|
||||
version "0.3.2"
|
||||
uid "38faa5b85741aabfca61aa37d1ef044d68969ddf"
|
||||
resolved "https://codeload.github.com/postlight/browser-request/tar.gz/38faa5b85741aabfca61aa37d1ef044d68969ddf"
|
||||
dependencies:
|
||||
http-headers "^3.0.1"
|
||||
|
|
@ -1653,6 +1652,13 @@ buffer@^5.2.1, buffer@^5.5.0:
|
|||
base64-js "^1.3.1"
|
||||
ieee754 "^1.1.13"
|
||||
|
||||
builtins@^5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/builtins/-/builtins-5.0.1.tgz#87f6db9ab0458be728564fa81d876d8d74552fa9"
|
||||
integrity sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==
|
||||
dependencies:
|
||||
semver "^7.0.0"
|
||||
|
||||
cacache@^16.1.0:
|
||||
version "16.1.3"
|
||||
resolved "https://registry.yarnpkg.com/cacache/-/cacache-16.1.3.tgz#a02b9f34ecfaf9a78c9f4bc16fceb94d5d67a38e"
|
||||
|
|
@ -2678,6 +2684,28 @@ eslint-config-prettier@8.8.0:
|
|||
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz#bfda738d412adc917fd7b038857110efe98c9348"
|
||||
integrity sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==
|
||||
|
||||
eslint-plugin-es@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz#f0822f0c18a535a97c3e714e89f88586a7641ec9"
|
||||
integrity sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==
|
||||
dependencies:
|
||||
eslint-utils "^2.0.0"
|
||||
regexpp "^3.0.0"
|
||||
|
||||
eslint-plugin-n@15.7.0:
|
||||
version "15.7.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.7.0.tgz#e29221d8f5174f84d18f2eb94765f2eeea033b90"
|
||||
integrity sha512-jDex9s7D/Qial8AGVIHq4W7NswpUD5DPDL2RH8Lzd9EloWUuvUkHfv4FRLMipH5q2UtyurorBkPeNi1wVWNh3Q==
|
||||
dependencies:
|
||||
builtins "^5.0.1"
|
||||
eslint-plugin-es "^4.1.0"
|
||||
eslint-utils "^3.0.0"
|
||||
ignore "^5.1.1"
|
||||
is-core-module "^2.11.0"
|
||||
minimatch "^3.1.2"
|
||||
resolve "^1.22.1"
|
||||
semver "^7.3.8"
|
||||
|
||||
eslint-plugin-prettier@4.2.1:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b"
|
||||
|
|
@ -2703,6 +2731,30 @@ eslint-scope@^7.2.0:
|
|||
esrecurse "^4.3.0"
|
||||
estraverse "^5.2.0"
|
||||
|
||||
eslint-utils@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27"
|
||||
integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==
|
||||
dependencies:
|
||||
eslint-visitor-keys "^1.1.0"
|
||||
|
||||
eslint-utils@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672"
|
||||
integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==
|
||||
dependencies:
|
||||
eslint-visitor-keys "^2.0.0"
|
||||
|
||||
eslint-visitor-keys@^1.1.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e"
|
||||
integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==
|
||||
|
||||
eslint-visitor-keys@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
|
||||
integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==
|
||||
|
||||
eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.0:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz#c7f0f956124ce677047ddbc192a68f999454dedc"
|
||||
|
|
@ -3669,7 +3721,7 @@ ignore-by-default@^1.0.1:
|
|||
resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09"
|
||||
integrity sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==
|
||||
|
||||
ignore@^5.1.4, ignore@^5.2.0:
|
||||
ignore@^5.1.1, ignore@^5.1.4, ignore@^5.2.0:
|
||||
version "5.2.4"
|
||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324"
|
||||
integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==
|
||||
|
|
@ -6200,6 +6252,11 @@ regenerator-runtime@^0.13.11:
|
|||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9"
|
||||
integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==
|
||||
|
||||
regexpp@^3.0.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2"
|
||||
integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==
|
||||
|
||||
relateurl@0.2.x:
|
||||
version "0.2.7"
|
||||
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
|
||||
|
|
@ -6357,7 +6414,7 @@ resolve.exports@^2.0.0:
|
|||
resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800"
|
||||
integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==
|
||||
|
||||
resolve@^1.1.6, resolve@^1.20.0:
|
||||
resolve@^1.1.6, resolve@^1.20.0, resolve@^1.22.1:
|
||||
version "1.22.2"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f"
|
||||
integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==
|
||||
|
|
@ -6466,7 +6523,7 @@ semver@^6.0.0, semver@^6.3.0:
|
|||
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
|
||||
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
|
||||
|
||||
semver@^7.3.5, semver@^7.3.8:
|
||||
semver@^7.0.0, semver@^7.3.5, semver@^7.3.8:
|
||||
version "7.5.0"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.0.tgz#ed8c5dc8efb6c629c88b23d41dc9bf40c1d96cd0"
|
||||
integrity sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==
|
||||
|
|
|
|||
Loading…
Reference in New Issue