Skip to content

make eslint fix the formatting #3412

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

Closed
wants to merge 14 commits into from
Closed
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Working examples can be found in [the developer docs](http://prebid.org/dev-docs
$ cd Prebid.js
$ npm install

*Note:* You need to have `NodeJS` 4.x or greater installed.
*Note:* You need to have `NodeJS` 6.x or greater installed.

*Note:* In the 1.24.0 release of Prebid.js we have transitioned to using gulp 4.0 from using gulp 3.9.1. To compily with gulp's recommended setup for 4.0, you'll need to have `gulp-cli` installed globally prior to running the general `npm install`. This shouldn't impact any other projects you may work on that use an earlier version of gulp in it's setup.

Expand Down
59 changes: 31 additions & 28 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ var _ = require('lodash');
var argv = require('yargs').argv;
var gulp = require('gulp');
var gutil = require('gulp-util');
var webserver = require('gulp-webserver');
var connect = require('gulp-connect');
var webpack = require('webpack');
var webpackStream = require('webpack-stream');
var uglify = require('gulp-uglify');
var gulpClean = require('gulp-clean');
var KarmaServer = require('karma').Server;
var karmaConfMaker = require('./karma.conf.maker');
var opens = require('open');
var opens = require('opn');
var webpackConfig = require('./webpack.conf');
var helpers = require('./gulpHelpers');
var concat = require('gulp-concat');
Expand Down Expand Up @@ -56,12 +56,11 @@ function e2etestReport() {
var reportPort = 9010;
var targetDestinationDir = './e2etest-report';
helpers.createEnd2EndTestReport(targetDestinationDir);
gulp.src('./')
.pipe(webserver({
port: reportPort,
directoryListing: true,
livereload: true
}));
connect.server({
port: reportPort,
root: './',
livereload: true
});

setTimeout(function() {
opens('http://localhost:' + reportPort + '/' + targetDestinationDir.slice(2) + '/results.html');
Expand All @@ -81,25 +80,29 @@ function lint(done) {
if (argv.nolint) {
return done();
}
return gulp.src(['src/**/*.js', 'modules/**/*.js', 'test/**/*.js'])
.pipe(eslint())
const isFixed = function(file){
return file.eslint != null && file.eslint.fixed;
}
return gulp.src(['src/**/*.js', 'modules/**/*.js', 'test/**/*.js'],{base: './'})
.pipe(eslint({fix: true}))
.pipe(eslint.format('stylish'))
.pipe(eslint.failAfterError());
.pipe(eslint.failAfterError())
.pipe(gulpif(isFixed, gulp.dest('./')));
};

// View the code coverage report in the browser.
function viewCoverage(done) {
var coveragePort = 1999;

var stream = gulp.src('./')
.pipe(webserver({
port: coveragePort,
directoryListing: true,
livereload: false,
open: 'build/coverage/karma_html/index.html'
}));
stream.on('finish', done);
connect.server({
port: coveragePort,
root: 'build/coverage/karma_html',
livereload: false
});
opens('http://localhost:' + coveragePort);
done();
};

viewCoverage.displayName = 'view-coverage';

// Watch Task with Live Reload
Expand All @@ -115,17 +118,16 @@ function watch(done) {
'test/spec/loaders/**/*.js'
]);

var stream = gulp.src('./')
.pipe(webserver({
https: argv.https,
port: port,
directoryListing: true,
livereload: true
}));
connect.server({
https: argv.https,
port: port,
root: './',
livereload: true
});

mainWatcher.on('all', gulp.series(clean, gulp.parallel(lint, 'build-bundle-dev', test)));
loaderWatcher.on('all', gulp.series(lint));
stream.on('finish', done);
done();
};

function makeDevpackPkg() {
Expand All @@ -140,7 +142,8 @@ function makeDevpackPkg() {
.pipe(helpers.nameModules(externalModules))
.pipe(webpackStream(cloned, webpack))
.pipe(replace('$prebid.version$', prebid.version))
.pipe(gulp.dest('build/dev'));
.pipe(gulp.dest('build/dev'))
.pipe(connect.reload());
}

function makeWebpackPkg() {
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ function newPluginsArray(browserstack) {
'karma-es5-shim',
'karma-mocha',
'karma-chai',
'karma-requirejs',
'karma-sinon',
'karma-sourcemap-loader',
'karma-spec-reporter',
Expand Down Expand Up @@ -125,6 +124,7 @@ module.exports = function(codeCoverage, browserstack, watchMode, file) {

webpack: webpackConfig,
webpackMiddleware: {
stats: 'errors-only',
noInfo: true
},
// frameworks to use
Expand Down
3 changes: 2 additions & 1 deletion modules/adbutlerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const BIDDER_CODE = 'adbutler';
export const spec = {
code: BIDDER_CODE,
pageID: Math.floor(Math.random() * 10e6),
aliases: ['divreach'],

isBidRequestValid: function (bid) {
return !!(bid.params.accountID && bid.params.zoneID);
Expand Down Expand Up @@ -98,7 +99,7 @@ export const spec = {
});
if (isCorrectCPM && isCorrectSize) {
bidResponse.requestId = bidObj.bidId;
bidResponse.bidderCode = spec.code;
bidResponse.bidderCode = bidObj.bidder;
bidResponse.creativeId = serverResponse.placement_id;
bidResponse.cpm = CPM;
bidResponse.width = width;
Expand Down
89 changes: 89 additions & 0 deletions modules/coinzillaBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import * as utils from 'src/utils';
import {config} from 'src/config';
import {registerBidder} from 'src/adapters/bidderFactory';

const BIDDER_CODE = 'coinzilla';
const ENDPOINT_URL = 'https://request.czilladx.com/serve/request.php';

export const spec = {
code: BIDDER_CODE,
aliases: ['czlla'], // short code

/**
* Determines whether or not the given bid request is valid.
*
* @param {BidRequest} bid The bid params to validate.
* @return boolean True if this is a valid bid, and false otherwise.
*/
isBidRequestValid: function (bid) {
return !!(bid.params.placementId);
},

/**
* Make a server request from the list of BidRequests.
*
* @return Array Info describing the request to the server.
* @param validBidRequests
* @param bidderRequest
*/
buildRequests: function (validBidRequests, bidderRequest) {
if (validBidRequests.length === 0) {
return [];
}
return validBidRequests.map(bidRequest => {
const sizes = utils.parseSizesInput(bidRequest.sizes)[0];
const width = sizes.split('x')[0];
const height = sizes.split('x')[1];
const payload = {
placementId: bidRequest.params.placementId,
width: width,
height: height,
bidId: bidRequest.bidId,
referer: bidderRequest.refererInfo.referer,
};
return {
method: 'POST',
url: ENDPOINT_URL,
data: payload
};
});
},

/**
* Unpack the response from the server into a list of bids.
*
* @param {ServerResponse} serverResponse A successful response from the server.
* @param bidRequest
* @return {Bid[]} An array of bids which were nested inside the server.
*/
interpretResponse: function (serverResponse, bidRequest) {
const bidResponses = [];
const response = serverResponse.body;
const creativeId = response.creativeId || 0;
const width = response.width || 0;
const height = response.height || 0;
const cpm = response.cpm || 0;
if (width !== 0 && height !== 0 && cpm !== 0 && creativeId !== 0) {
const dealId = response.dealid || '';
const currency = response.currency || 'EUR';
const netRevenue = (response.netRevenue === undefined) ? true : response.netRevenue;
const referrer = bidRequest.data.referer;
const bidResponse = {
requestId: response.requestId,
cpm: cpm,
width: response.width,
height: response.height,
creativeId: creativeId,
dealId: dealId,
currency: currency,
netRevenue: netRevenue,
ttl: config.getConfig('_bidderTimeout'),
referrer: referrer,
ad: response.ad
};
bidResponses.push(bidResponse);
}
return bidResponses;
},
};
registerBidder(spec);
24 changes: 24 additions & 0 deletions modules/coinzillaBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Overview

```
Module Name: Coinzilla Bidder Adapter
Module Type: Coinzilla Adapter
Maintainer: [email protected]
```

# Description

Our module helps you have an easier time implementing Coinzilla on your website. All you have to do is replace the ``placementId`` with your zoneID, depending on the required size in your account dashboard. If you need additional information please contact us at ``[email protected]``.
# Test Parameters
```
var adUnits = [{
code: 'test-ad-div',
sizes: [[300, 250]],
bids: [{
bidder: 'coinzilla',
params: {
placementId: 'testPlacementId'
}
}]
}];
```
28 changes: 17 additions & 11 deletions modules/consentManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export let allowAuction;
export let staticConsentData;

let consentData;
let addedConsentHook = false;

// add new CMPs here, with their dedicated lookup function
const cmpCallMap = {
Expand Down Expand Up @@ -56,11 +57,11 @@ function lookupIabConsent(cmpSuccess, cmpError, hookConfig) {
}

return {
consentDataCallback: function(consentResponse) {
consentDataCallback: function (consentResponse) {
cmpResponse.getConsentData = consentResponse;
afterEach();
},
vendorConsentsCallback: function(consentResponse) {
vendorConsentsCallback: function (consentResponse) {
cmpResponse.getVendorConsents = consentResponse;
afterEach();
}
Expand All @@ -82,7 +83,7 @@ function lookupIabConsent(cmpSuccess, cmpError, hookConfig) {
// if the CMP is not found, the iframe function will call the cmpError exit callback to abort the rest of the CMP workflow
try {
cmpFunction = window.__cmp || utils.getWindowTop().__cmp;
} catch (e) {}
} catch (e) { }

if (utils.isFn(cmpFunction)) {
cmpFunction('getConsentData', null, callbackHandler.consentDataCallback);
Expand All @@ -97,7 +98,7 @@ function lookupIabConsent(cmpSuccess, cmpError, hookConfig) {
while (!cmpFrame) {
try {
if (f.frames['__cmpLocator']) cmpFrame = f;
} catch (e) {}
} catch (e) { }
if (f === window.top) break;
f = f.parent;
}
Expand Down Expand Up @@ -139,13 +140,15 @@ function lookupIabConsent(cmpSuccess, cmpError, hookConfig) {
function callCmpWhileInIframe(commandName, cmpFrame, moduleCallback) {
/* Setup up a __cmp function to do the postMessage and stash the callback.
This function behaves (from the caller's perspective identicially to the in-frame __cmp call */
window.__cmp = function(cmd, arg, callback) {
window.__cmp = function (cmd, arg, callback) {
let callId = Math.random() + '';
let msg = {__cmpCall: {
command: cmd,
parameter: arg,
callId: callId
}};
let msg = {
__cmpCall: {
command: cmd,
parameter: arg,
callId: callId
}
};
cmpCallbacks[callId] = callback;
cmpFrame.postMessage(msg, '*');
}
Expand Down Expand Up @@ -371,6 +374,9 @@ export function setConfig(config) {
utils.logError(`consentManagement config with cmpApi: 'static' did not specify consentData. No consents will be available to adapters.`);
}
}
$$PREBID_GLOBAL$$.requestBids.addHook(requestBidsHook, 50);
if (!addedConsentHook) {
$$PREBID_GLOBAL$$.requestBids.addHook(requestBidsHook, 50);
}
addedConsentHook = true;
}
config.getConfig('consentManagement', config => setConfig(config.consentManagement));
Loading