Skip to content

Commit 18beba6

Browse files
patmmccanndgirardi
andauthored
Linting: enforce no useless escape (#13618)
* Update eslint.config.js * Maintenance: remove useless escapes (#13617) * Update eslint.config.js * Update modules/sonobiBidAdapter.js Co-authored-by: Demetrio Girardi <[email protected]> * Update bidderUtils.js fix dspx pubmatic regex * Update bidderUtils.js --------- Co-authored-by: Demetrio Girardi <[email protected]>
1 parent 4324649 commit 18beba6

21 files changed

+54
-53
lines changed

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ module.exports = [
122122
// also see: reality. These are here to stay.
123123

124124
eqeqeq: 'off',
125-
'no-useless-escape': 'off',
126125
'jsdoc/check-types': 'off',
127126
'jsdoc/no-defaults': 'off',
128127
'jsdoc/newline-after-description': 'off',
@@ -241,6 +240,7 @@ module.exports = [
241240
'no-unused-expressions': 'off',
242241
'no-undef': 'off',
243242
'no-unused-vars': 'off',
243+
'no-useless-escape': 'off',
244244
'no-return-assign': 'off',
245245
'camelcase': 'off'
246246
}

libraries/dspxUtils/bidderUtils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ export function fillUsersIds(bidRequest, payload) {
2121
did_pubcid: 'pubcid.org',
2222
did_cruid: 'criteo.com',
2323
did_tdid: 'adserver.org',
24-
did_pbmid: 'regexp:[esp\.]*pubmatic\.com',
24+
// eslint-disable-next-line no-useless-escape
25+
did_pbmid: 'regexp:^(?:esp\.)?pubmatic\.com$',
2526
did_id5: 'id5-sync.com',
2627
did_uqid: 'utiq.com',
2728
did_id5_linktype: ['id5-sync.com', function (e) {

modules/adagioBidAdapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ function _parseNativeBidResponse(bid) {
277277
native.impressionTrackers.push(tracker.url);
278278
break;
279279
case 2:
280-
const script = `<script async src=\"${tracker.url}\"></script>`;
280+
const script = `<script async src="${tracker.url}"></script>`;
281281
if (!native.javascriptTrackers) {
282282
native.javascriptTrackers = script;
283283
} else {

modules/adhashBidAdapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function brandSafety(badWords, maxScore) {
117117
let score = 0;
118118
const decodedUrl = decodeURI(window.top.location.href.substring(window.top.location.origin.length));
119119
const wordsAndNumbersInUrl = decodedUrl
120-
.replaceAll(/[-,\._/\?=&#%]/g, ' ')
120+
.replaceAll(/[-,._/?=&#%]/g, ' ')
121121
.replaceAll(/\s\s+/g, ' ')
122122
.toLowerCase()
123123
.trim();

modules/adkernelAdnAnalyticsAdapter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ export function getUmtSource(pageUrl, referrer) {
228228

229229
function getSearchEngine(pageUrl) {
230230
const engines = {
231-
'google': /^https?\:\/\/(?:www\.)?(?:google\.(?:com?\.)?(?:com|cat|[a-z]{2})|g.cn)\//i,
232-
'yandex': /^https?\:\/\/(?:www\.)?ya(?:ndex\.(?:com|net)?\.?(?:asia|mobi|org|[a-z]{2})?|\.ru)\//i,
233-
'bing': /^https?\:\/\/(?:www\.)?bing\.com\//i,
234-
'duckduckgo': /^https?\:\/\/(?:www\.)?duckduckgo\.com\//i,
235-
'ask': /^https?\:\/\/(?:www\.)?ask\.com\//i,
236-
'yahoo': /^https?\:\/\/(?:[-a-z]+\.)?(?:search\.)?yahoo\.com\//i
231+
'google': /^https?:\/\/(?:www\.)?(?:google\.(?:com?\.)?(?:com|cat|[a-z]{2})|g.cn)\//i,
232+
'yandex': /^https?:\/\/(?:www\.)?ya(?:ndex\.(?:com|net)?\.?(?:asia|mobi|org|[a-z]{2})?|\.ru)\//i,
233+
'bing': /^https?:\/\/(?:www\.)?bing\.com\//i,
234+
'duckduckgo': /^https?:\/\/(?:www\.)?duckduckgo\.com\//i,
235+
'ask': /^https?:\/\/(?:www\.)?ask\.com\//i,
236+
'yahoo': /^https?:\/\/(?:[-a-z]+\.)?(?:search\.)?yahoo\.com\//i
237237
};
238238

239239
for (const engine in engines) {

modules/beopBidAdapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function buildTrackingParams(data, info, value) {
177177
const params = Array.isArray(data.params) ? data.params[0] : data.params;
178178
const pageUrl = getPageUrl(null, window);
179179
return {
180-
pid: params.accountId ?? (data.ad?.match(/account: \([a-f\d]{24})\/)?.[1] ?? ''),
180+
pid: params.accountId ?? (data.ad?.match(/account: ([a-f\d]{24})/)?.[1] ?? ''),
181181
nid: params.networkId,
182182
nptnid: params.networkPartnerId,
183183
bid: data.bidId || data.requestId,

modules/debugging/responses.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function mapDefaultNativeOrtbAsset(asset) {
7575
return {
7676
...asset,
7777
video: {
78-
vasttag: '<?xml version=\"1.0\" encoding=\"UTF-8\"?><VAST version=\"3.0\"><Ad><InLine><AdSystem>GDFP</AdSystem><AdTitle>Demo</AdTitle><Description><![CDATA[Demo]]></Description><Creatives><Creative><Linear ><Duration>00:00:11</Duration><VideoClicks><ClickThrough><![CDATA[https://prebid.org/]]></ClickThrough></VideoClicks><MediaFiles><MediaFile delivery=\"progressive\" width=\"640\" height=\"360\" type=\"video/mp4\" scalable=\"true\" maintainAspectRatio=\"true\"><![CDATA[https://s3.amazonaws.com/files.prebid.org/creatives/PrebidLogo.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>'
78+
vasttag: '<?xml version="1.0" encoding="UTF-8"?><VAST version="3.0"><Ad><InLine><AdSystem>GDFP</AdSystem><AdTitle>Demo</AdTitle><Description><![CDATA[Demo]]></Description><Creatives><Creative><Linear ><Duration>00:00:11</Duration><VideoClicks><ClickThrough><![CDATA[https://prebid.org/]]></ClickThrough></VideoClicks><MediaFiles><MediaFile delivery="progressive" width="640" height="360" type="video/mp4" scalable="true" maintainAspectRatio="true"><![CDATA[https://s3.amazonaws.com/files.prebid.org/creatives/PrebidLogo.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>'
7979
}
8080
}
8181
case 'data': {

modules/fintezaAnalyticsAdapter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ function getAntiCacheParam() {
287287

288288
function replaceBidder(str, bidder) {
289289
let _str = str;
290-
_str = _str.replace(/\%bidder\%/, bidder.toLowerCase());
291-
_str = _str.replace(/\%BIDDER\%/, bidder.toUpperCase());
292-
_str = _str.replace(/\%Bidder\%/, bidder.charAt(0).toUpperCase() + bidder.slice(1).toLowerCase());
290+
_str = _str.replace(/%bidder%/, bidder.toLowerCase());
291+
_str = _str.replace(/%BIDDER%/, bidder.toUpperCase());
292+
_str = _str.replace(/%Bidder%/, bidder.charAt(0).toUpperCase() + bidder.slice(1).toLowerCase());
293293

294294
return _str;
295295
}

modules/mediafuseBidAdapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const NATIVE_MAPPING = {
8585
const SOURCE = 'pbjs';
8686
const MAX_IMPS_PER_REQUEST = 15;
8787
const SCRIPT_TAG_START = '<script';
88-
const VIEWABILITY_URL_START = /\/\/cdn\.adnxs\.com\/v|\/\/cdn\.adnxs\-simple\.com\/v/;
88+
const VIEWABILITY_URL_START = /\/\/cdn\.adnxs\.com\/v|\/\/cdn\.adnxs-simple\.com\/v/;
8989
const VIEWABILITY_FILE_NAME = 'trk.js';
9090
const GVLID = 32;
9191
const storage = getStorageManager({bidderCode: BIDDER_CODE});

modules/mediakeysBidAdapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ function nativeBidResponseHandler(bid) {
571571
native.impressionTrackers.push(tracker.url);
572572
break;
573573
case 2:
574-
const script = `<script async src=\"${tracker.url}\"></script>`;
574+
const script = `<script async src="${tracker.url}"></script>`;
575575
if (!native.javascriptTrackers) {
576576
native.javascriptTrackers = script;
577577
} else {

0 commit comments

Comments
 (0)