Skip to content

Commit

Permalink
Update eslint ecmaVersion to 2020.
Browse files Browse the repository at this point in the history
Fix illegal indent.

tempprary fix lint error.

temporary fix lint error.
  • Loading branch information
from20020516 committed Sep 30, 2021
1 parent 476ae68 commit c3ffdb9
Show file tree
Hide file tree
Showing 7 changed files with 4,271 additions and 4,341 deletions.
12 changes: 7 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
const allowedModules = require("./allowedModules");

module.exports = {
"env": {
"browser": true,
"commonjs": true
parser: 'babel-eslint',
env: {
browser: true,
commonjs: true
},
"settings": {
"import/resolver": {
Expand All @@ -21,8 +22,9 @@ module.exports = {
"globals": {
"$$PREBID_GLOBAL$$": false
},
"parserOptions": {
"sourceType": "module"
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
},
"rules": {
"comma-dangle": "off",
Expand Down
10 changes: 5 additions & 5 deletions modules/fluctAnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable indent */
import { ajax } from '../src/ajax.js';
import adapter from '../src/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';
Expand Down Expand Up @@ -127,7 +128,6 @@ const isBrowsiAuction = (auctionId) => {
*/
const isBrowsiDivId = (divId) => Boolean(divId.match(/^browsi_ad_/g))

/* eslint-disable-next-line compat/compat */
let fluctAnalyticsAdapter = Object.assign(
adapter({ url, analyticsType: 'endpoint' }), {
track({ eventType, args }) {
Expand Down Expand Up @@ -235,11 +235,11 @@ let fluctAnalyticsAdapter = Object.assign(
*/
export const getAdUnitCodeBeforeReplication = (slots, adUnitCode) => {
/** @type {string} */
// eslint-disable-next-line standard/computed-property-even-spacing
const path = slots[find(Object.keys(slots), slot => {
/** @type {string|null} @example browsi_ad_0_ai_1_rc_ */
const browsiPrefix = adUnitCode.match(/^browsi_ad_.*_(?=\d*$)/g)?.[0]
return slot === adUnitCode
|| slot.match(new RegExp(`^${browsiPrefix}`, 'g'))?.[0]
const [browsiPrefix] = adUnitCode.match(/^browsi_ad_.*_(?=\d*$)/g)
return slot === adUnitCode || (slot.match(new RegExp(`^${browsiPrefix}`, 'g')) ?? [])[0]
})]
return find(Object.keys(slots), slot => !isBrowsiDivId(slots[slot]) && slots[slot] === path) ?? adUnitCode
}
Expand All @@ -255,7 +255,7 @@ const modifyBrowsiAdUnit = (adUnit) => {
// 'div-gpt-ad-1629864618640-0': '/62532913/p_fluctmagazine_320x50_surface_15377',
// 'browsi_ad_0_ai_1_rc_0': '/62532913/p_fluctmagazine_320x50_surface_15377'
// }
const slots = googletag.pubads().getSlots().reduce((prev, slot) => Object.assign(prev, { [slot.getSlotElementId()]: slot.getAdUnitPath() }), {})
const slots = window.googletag.pubads().getSlots().reduce((prev, slot) => Object.assign(prev, { [slot.getSlotElementId()]: slot.getAdUnitPath() }), {})
return {
...adUnit,
adUnitCode: getAdUnitCodeBeforeReplication(slots, adUnit.code),
Expand Down
42 changes: 22 additions & 20 deletions modules/medianetAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class ErrorLogger {
this.project = 'prebidanalytics';
this.dn = pageDetails.domain || '';
this.requrl = pageDetails.requrl || '';
// eslint-disable-next-line no-self-assign
this.event = this.event;
this.pbversion = PREBID_VERSION;
this.cid = config.cid || '';
Expand Down Expand Up @@ -199,7 +200,7 @@ class Configure {
}

class PageDetail {
constructor () {
constructor() {
const canonicalUrl = this._getUrlFromSelector('link[rel="canonical"]', 'href');
const ogUrl = this._getUrlFromSelector('meta[property="og:url"]', 'content');
const twitterUrl = this._getUrlFromSelector('meta[name="twitter:url"]', 'content');
Expand Down Expand Up @@ -236,7 +237,7 @@ class PageDetail {
if (element !== null && element[attribute]) {
return element[attribute];
}
} catch (e) {}
} catch (e) { }
}

_getAbsoluteUrl(url) {
Expand Down Expand Up @@ -291,7 +292,7 @@ class AdSlot {
ismn: this.medianetPresent,
vplcmtt: this.context,
},
this.adext && {'adext': JSON.stringify(this.adext)},
this.adext && { 'adext': JSON.stringify(this.adext) },
);
}
}
Expand Down Expand Up @@ -439,15 +440,15 @@ class Auction {
}
}

function auctionInitHandler({auctionId, adUnits, timeout, timestamp, bidderRequests}) {
function auctionInitHandler({ auctionId, adUnits, timeout, timestamp, bidderRequests }) {
if (auctionId && auctions[auctionId] === undefined) {
auctions[auctionId] = new Auction(auctionId);
auctions[auctionId].auctionInitTime = timestamp;
}
addAddSlots(auctionId, adUnits, timeout);
const floorData = utils.deepAccess(bidderRequests, '0.bids.0.floorData');
if (floorData) {
auctions[auctionId].floorData = {...floorData};
auctions[auctionId].floorData = { ...floorData };
}
}

Expand All @@ -461,8 +462,8 @@ function addAddSlots(auctionId, adUnits, tmax) {
let adext = {};

const mediaTypeMap = {};
const oSizes = {banner: [], video: []};
adUnits.forEach(({mediaTypes, sizes, ext}) => {
const oSizes = { banner: [], video: [] };
adUnits.forEach(({ mediaTypes, sizes, ext }) => {
mediaTypes = mediaTypes || {};
adext = Object.assign(adext, ext || utils.deepAccess(mediaTypes, 'banner.ext'));
context = utils.deepAccess(mediaTypes, 'video.context') || context;
Expand All @@ -479,7 +480,7 @@ function addAddSlots(auctionId, adUnits, tmax) {
const allMediaTypeSizes = [].concat(oSizes.banner, oSizes.native, oSizes.video);
const mediaTypes = Object.keys(mediaTypeMap).join('|');

auctions[auctionId].addSlot({adUnitCode, supplyAdCode, mediaTypes, allMediaTypeSizes, context, tmax, adext});
auctions[auctionId].addSlot({ adUnitCode, supplyAdCode, mediaTypes, allMediaTypeSizes, context, tmax, adext });
});
}

Expand Down Expand Up @@ -523,7 +524,7 @@ function _getSizes(mediaTypes, sizes) {

function bidResponseHandler(bid) {
const { width, height, mediaType, cpm, requestId, timeToRespond, auctionId, dealId } = bid;
const {originalCpm, bidderCode, creativeId, adId, currency} = bid;
const { originalCpm, bidderCode, creativeId, adId, currency } = bid;

if (!(auctions[auctionId] instanceof Auction)) {
return;
Expand Down Expand Up @@ -581,7 +582,7 @@ function noBidResponseHandler({ auctionId, bidId }) {
}

function bidTimeoutHandler(timedOutBids) {
timedOutBids.map(({bidId, auctionId}) => {
timedOutBids.map(({ bidId, auctionId }) => {
if (!(auctions[auctionId] instanceof Auction)) {
return;
}
Expand All @@ -593,7 +594,7 @@ function bidTimeoutHandler(timedOutBids) {
})
}

function auctionEndHandler({auctionId, auctionEnd, adUnitCodes}) {
function auctionEndHandler({ auctionId, auctionEnd, adUnitCodes }) {
if (!(auctions[auctionId] instanceof Auction)) {
return;
}
Expand Down Expand Up @@ -626,7 +627,7 @@ function setTargetingHandler(params) {
const winnerAdId = params[adunit][CONSTANTS.TARGETING_KEYS.AD_ID];
let winningBid;
let bidAdIds = Object.keys(targetingObj).map(k => targetingObj[k]);
auctionObj.bids.filter((bid) => bidAdIds.indexOf(bid.adId) !== -1).map(function(bid) {
auctionObj.bids.filter((bid) => bidAdIds.indexOf(bid.adId) !== -1).map(function (bid) {
bid.iwb = 1;
if (bid.adId === winnerAdId) {
winningBid = bid;
Expand Down Expand Up @@ -742,19 +743,19 @@ function fireAuctionLog(acid, adtag, logType) {
bidParams = auctions[acid].getWinnerAdslotBid(adtag);
commonParams.lper = 1;
} else {
bidParams = auctions[acid].getAdslotBids(adtag).map(({winner, ...restParams}) => restParams);
bidParams = auctions[acid].getAdslotBids(adtag).map(({ winner, ...restParams }) => restParams);
delete commonParams.wts;
}
let mnetPresent = bidParams.filter(b => b.pvnm === MEDIANET_BIDDER_CODE).length > 0;
if (!mnetPresent) {
bidParams = bidParams.map(({mpvid, crid, ext, pubcrid, ...restParams}) => restParams);
bidParams = bidParams.map(({ mpvid, crid, ext, pubcrid, ...restParams }) => restParams);
}

let url = formatQS(commonParams) + '&';
bidParams.forEach(function(bidParams) {
bidParams.forEach(function (bidParams) {
url = url + formatQS(bidParams) + '&';
});
url = url + formatQS({targ: targeting});
url = url + formatQS({ targ: targeting });
firePixel(url);
}

Expand Down Expand Up @@ -803,7 +804,7 @@ class URL {
}
}

let medianetAnalytics = Object.assign(adapter({URL, analyticsType}), {
let medianetAnalytics = Object.assign(adapter({ URL, analyticsType }), {
getlogsQueue() {
return logsQueue;
},
Expand Down Expand Up @@ -840,11 +841,11 @@ let medianetAnalytics = Object.assign(adapter({URL, analyticsType}), {
auctionEndHandler(args);
break;
}
case CONSTANTS.EVENTS.SET_TARGETING : {
case CONSTANTS.EVENTS.SET_TARGETING: {
setTargetingHandler(args);
break;
}
case CONSTANTS.EVENTS.BIDDER_DONE : {
case CONSTANTS.EVENTS.BIDDER_DONE: {
setBidderDone(args);
break;
}
Expand All @@ -853,7 +854,8 @@ let medianetAnalytics = Object.assign(adapter({URL, analyticsType}), {
break;
}
}
}});
}
});

medianetAnalytics.originEnableAnalytics = medianetAnalytics.enableAnalytics;

Expand Down
2 changes: 1 addition & 1 deletion modules/novatiqIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { submodule } from '../src/hook.js';
/** @type {Submodule} */
export const novatiqIdSubmodule = {

/**
/**
* used to link submodule with config
* @type {string}
*/
Expand Down
Loading

0 comments on commit c3ffdb9

Please sign in to comment.