Skip to content

enable no-console eslint rule for project #4802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = {
"no-throw-literal": "off",
"no-undef": 2,
"no-useless-escape": "off",
"no-console": "error"
},
"overrides": Object.keys(allowedModules).map((key) => ({
"files": key + "/**/*.js",
Expand Down
8 changes: 4 additions & 4 deletions modules/adxpremiumAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ let googletag = window.googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().addEventListener('slotRenderEnded', args => {
console.log(Date.now() + ' GOOGLE SLOT: ' + JSON.stringify(args));
utils.logInfo(Date.now() + ' GOOGLE SLOT: ' + JSON.stringify(args));
});
});

Expand All @@ -72,7 +72,7 @@ let bidResponsesMapper = {};
function auctionInit(args) {
completeObject.auction_id = args.auctionId;
completeObject.publisher_id = adxpremiumAnalyticsAdapter.initOptions.pubId;
try { completeObject.referer = args.bidderRequests[0].refererInfo.referer.split('?')[0]; } catch (e) { console.log(e.message); }
try { completeObject.referer = args.bidderRequests[0].refererInfo.referer.split('?')[0]; } catch (e) { utils.logWarn('Could not parse referer, error details:', e.message); }
completeObject.device_type = deviceType();
}
function bidRequested(args) {
Expand Down Expand Up @@ -130,11 +130,11 @@ function sendEvent(completeObject) {
let responseEvents = btoa(JSON.stringify(completeObject));
let mutation = `mutation {createEvent(input: {event: {eventData: "${responseEvents}"}}) {event {createTime } } }`;
let dataToSend = JSON.stringify({ query: mutation });
ajax(url, function () { console.log(Date.now() + ' Sending event to adxpremium server.') }, dataToSend, {
ajax(url, function () { utils.logInfo(Date.now() + ' Sending event to adxpremium server.') }, dataToSend, {
contentType: 'application/json',
method: 'POST'
});
} catch (err) { console.log(err) }
} catch (err) { utils.logError('Could not send event, error details:', err) }
}

// save the base class function
Expand Down
2 changes: 1 addition & 1 deletion modules/nobidBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function nobidBuildRequests(bids, bidderRequest) {
var height = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
return `${width}x${height}`;
} catch (e) {
console.error(e);
utils.logWarn('Could not parse screen dimensions, error details:', e);
}
}
var state = {};
Expand Down
5 changes: 3 additions & 2 deletions modules/sharethroughBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { registerBidder } from '../src/adapters/bidderFactory.js';
import * as utils from '../src/utils.js';

const VERSION = '3.2.0';
const BIDDER_CODE = 'sharethrough';
Expand Down Expand Up @@ -181,7 +182,7 @@ function handleIframe () {
window.document.getElementsByTagName('body')[0].appendChild(sfpIframeBusterJs);
iframeBusterLoaded = true;
} catch (e) {
console.error(e);
utils.logError('Trouble writing frame buster script, error details:', e);
}
}

Expand All @@ -199,7 +200,7 @@ function handleIframe () {
window.document.getElementsByTagName('body')[0].appendChild(sfpJs);
}
} catch (e) {
console.error(e);
utils.logError('Trouble writing sfp script, error details:', e);
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions modules/sovrnBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ export const spec = {
options: {contentType: 'text/plain'}
}
} catch (e) {
console.log('error in build:')
console.log(e)
utils.logError('Could not build bidrequest, error deatils:', e);
}
},

Expand Down Expand Up @@ -143,8 +142,7 @@ export const spec = {
}
return sovrnBidResponses
} catch (e) {
console.log('error in interpret:')
console.log(e)
utils.logError('Could not intrepret bidresponse, error deatils:', e);
}
},

Expand Down
1 change: 1 addition & 0 deletions src/adapters/analytics/example2.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { ajax } from '../../../src/ajax.js';

/**
Expand Down
1 change: 1 addition & 0 deletions src/adapters/analytics/libraries/example.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
/** @module example */

window.ExampleAnalyticsGlobalObject = function(hander, type, data) {
Expand Down
1 change: 1 addition & 0 deletions src/adapters/analytics/libraries/example2.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
/** @module example */

window.ExampleAnalyticsGlobalObject2 = function(hander, type, data) {
Expand Down
1 change: 1 addition & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { config } from './config.js';
import clone from 'just-clone';
import find from 'core-js/library/fn/array/find.js';
Expand Down
2 changes: 1 addition & 1 deletion test/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ module.exports = {
"no-unused-vars": "off",
"no-use-before-define": "off",
"no-useless-escape": "off",
"one-var": "off",
"one-var": "off"
}
};
1 change: 1 addition & 0 deletions test/mock-server/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
const express = require('express');
const argv = require('yargs').argv;
const app = module.exports = express();
Expand Down
8 changes: 2 additions & 6 deletions test/spec/modules/onetagBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,14 @@ describe('onetag', function () {
expect(bid.pubId).to.be.a('string');
}
});
} catch (e) {
console.log('Error while parsing');
}
} catch (e) {}
it('Returns empty data if no valid requests are passed', function () {
serverRequest = spec.buildRequests([]);
let dataString = serverRequest.data;
try {
let dataObj = JSON.parse(dataString);
expect(dataObj.bids).to.be.an('array').that.is.empty;
} catch (e) {
console.log('Error while parsing');
}
} catch (e) {}
});
it('should send GDPR consent data', function () {
let consentString = 'consentString';
Expand Down
1 change: 0 additions & 1 deletion test/spec/modules/ozoneBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,6 @@ describe('ozone Adapter', function () {
});

it('should pick up the value of pubcid when built using the pubCommonId module (not userId)', function () {
console.log(validBidRequests[0].crumbs);
let bidRequests = validBidRequests;
// values from http://prebid.org/dev-docs/modules/userId.html#pubcommon-id
bidRequests[0]['userId'] = {
Expand Down
2 changes: 0 additions & 2 deletions test/spec/modules/tribeosBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ describe('tribeosBidAdapter', function() {
expect(bids).to.have.lengthOf(1);
let bid = bids[0];

console.error(JSON.stringify(bid));

expect(bid.cpm).to.equal(1.1);
expect(bid.currency).to.equal('USD');
expect(bid.width).to.equal(300);
Expand Down
2 changes: 1 addition & 1 deletion test/spec/unit/pbjs_api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ describe('Unit: Prebid Module', function () {
try {
$$PREBID_GLOBAL$$.requestBids({});
} catch (e) {
console.log(e);
console.log(e); // eslint-disable-line
}
assert.ok(logMessageSpy.calledWith('No adUnits configured. No bids requested.'), 'expected message was logged');
});
Expand Down