Skip to content

Commit

Permalink
Make eslint aware of the custom import paths (prebid#2292)
Browse files Browse the repository at this point in the history
* Make eslint aware of the custom import paths

By default eslint doesn't know what `src/Renderer` means in the following import:
`import { Renderer } from 'src/Renderer';`
This changes makes it aware that `src/Renderer` means `<project root>/src/Renderer.js`

* fix: fix import paths in sonobiBidAdapter.js

* fix: imports in bidderFactory.js
  • Loading branch information
terebentina authored and dluxemburg committed Jul 17, 2018
1 parent d7c029b commit 32dff16
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ module.exports = {
"browser": true,
"commonjs": true
},
"settings": {
"import/resolver": {
"node": {
"moduleDirectory": ["node_modules", "./"]
}
}
},
"extends": "standard",
"globals": {
"$$PREBID_GLOBAL$$": false
Expand Down
13 changes: 6 additions & 7 deletions modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { registerBidder } from 'src/adapters/bidderFactory';
import { getTopWindowLocation, parseSizesInput } from 'src/utils';
import * as utils from '../src/utils';
import * as utils from 'src/utils';
import { BANNER, VIDEO } from '../src/mediaTypes';
import find from 'core-js/library/fn/array/find';

Expand Down Expand Up @@ -47,7 +46,7 @@ export const spec = {

const payload = {
'key_maker': JSON.stringify(data),
'ref': getTopWindowLocation().host,
'ref': utils.getTopWindowLocation().host,
's': utils.generateUUID(),
'pv': PAGEVIEW_ID,
};
Expand Down Expand Up @@ -139,9 +138,9 @@ export const spec = {

function _validateSize (bid) {
if (bid.params.sizes) {
return parseSizesInput(bid.params.sizes).join(',');
return utils.parseSizesInput(bid.params.sizes).join(',');
}
return parseSizesInput(bid.sizes).join(',');
return utils.parseSizesInput(bid.sizes).join(',');
}

function _validateSlot (bid) {
Expand All @@ -162,12 +161,12 @@ const _creative = (mediaType) => (sbi_dc, sbi_aid) => {
if (mediaType === 'video') {
return _videoCreative(sbi_dc, sbi_aid)
}
const src = 'https://' + sbi_dc + 'apex.go.sonobi.com/sbi.js?aid=' + sbi_aid + '&as=null' + '&ref=' + getTopWindowLocation().host;
const src = 'https://' + sbi_dc + 'apex.go.sonobi.com/sbi.js?aid=' + sbi_aid + '&as=null' + '&ref=' + utils.getTopWindowLocation().host;
return '<script type="text/javascript" src="' + src + '"></script>';
}

function _videoCreative(sbi_dc, sbi_aid) {
return `https://${sbi_dc}apex.go.sonobi.com/vast.xml?vid=${sbi_aid}&ref=${getTopWindowLocation().host}`
return `https://${sbi_dc}apex.go.sonobi.com/vast.xml?vid=${sbi_aid}&ref=${utils.getTopWindowLocation().host}`
}

function _getBidIdFromTrinityKey (key) {
Expand Down
3 changes: 1 addition & 2 deletions src/adapters/bidderFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Adapter from 'src/adapter';
import adaptermanager from 'src/adaptermanager';
import { config } from 'src/config';
import bidfactory from 'src/bidfactory';
import { STATUS } from 'src/constants';
import { userSync } from 'src/userSync';
import { nativeBidIsValid } from 'src/native';
import { isValidVideoBid } from 'src/video';
Expand Down Expand Up @@ -304,7 +303,7 @@ export function newBidder(spec) {
function addBidUsingRequestMap(bid) {
const bidRequest = bidRequestMap[bid.requestId];
if (bidRequest) {
const prebidBid = Object.assign(bidfactory.createBid(STATUS.GOOD, bidRequest), bid);
const prebidBid = Object.assign(bidfactory.createBid(CONSTANTS.STATUS.GOOD, bidRequest), bid);
addBidWithCode(bidRequest.adUnitCode, prebidBid);
} else {
logWarn(`Bidder ${spec.code} made bid for unknown request ID: ${bid.requestId}. Ignoring.`);
Expand Down

0 comments on commit 32dff16

Please sign in to comment.