Skip to content

Commit

Permalink
rename eslint-plugin-prebid to eslint-plugin-prebidjs (to separate th…
Browse files Browse the repository at this point in the history
…is local module from the vulnerable npm clone)
  • Loading branch information
renebaudisch committed Sep 24, 2024
1 parent 5135da2 commit 3863072
Show file tree
Hide file tree
Showing 27 changed files with 45 additions and 45 deletions.
8 changes: 4 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
'plugin:jsdoc/recommended'
],
plugins: [
'prebid',
'prebidjs',
'import',
'jsdoc'
],
Expand Down Expand Up @@ -83,23 +83,23 @@ module.exports = {
overrides: Object.keys(allowedModules).map((key) => ({
files: key + '/**/*.js',
rules: {
'prebid/validate-imports': ['error', allowedModules[key]],
'prebidjs/validate-imports': ['error', allowedModules[key]],
'no-restricted-globals': [
'error',
{
name: 'require',
message: 'use import instead'
}
],
'prebid/no-global': [
'prebidjs/no-global': [
'error',
...['localStorage', 'sessionStorage'].map(name => ({name, message: 'use storageManager instead'})),
{
name: 'XMLHttpRequest',
message: 'use ajax.js instead'
},
],
'prebid/no-member': [
'prebidjs/no-member': [
'error',
{
name: 'cookie',
Expand Down
2 changes: 1 addition & 1 deletion creative/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// eslint-disable-next-line prebid/validate-imports
// eslint-disable-next-line prebidjs/validate-imports
import {AD_RENDER_FAILED_REASON, EVENTS, MESSAGES} from '../src/constants.js';

export {PB_LOCATOR} from '../src/constants.js';
Expand Down
2 changes: 1 addition & 1 deletion creative/renderers/display/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// eslint-disable-next-line prebid/validate-imports
// eslint-disable-next-line prebidjs/validate-imports
import { AD_RENDER_FAILED_REASON } from '../../../src/constants.js';

export const ERROR_NO_AD = AD_RENDER_FAILED_REASON.NO_AD;
2 changes: 1 addition & 1 deletion creative/renderers/native/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// eslint-disable-next-line prebid/validate-imports
// eslint-disable-next-line prebidjs/validate-imports
import { MESSAGES } from '../../../src/constants.js';

export const MESSAGE_NATIVE = MESSAGES.NATIVE;
Expand Down
2 changes: 1 addition & 1 deletion modules/adlooxAdServerVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @requires module:modules/adlooxAnalyticsAdapter
*/

/* eslint prebid/validate-imports: "off" */
/* eslint prebidjs/validate-imports: "off" */

import { registerVideoSupport } from '../src/adServerManager.js';
import { command as analyticsCommand, COMMAND } from './adlooxAnalyticsAdapter.js';
Expand Down
2 changes: 1 addition & 1 deletion modules/adlooxRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/* eslint standard/no-callback-literal: "off" */
/* eslint prebid/validate-imports: "off" */
/* eslint prebidjs/validate-imports: "off" */

import {auctionManager} from '../src/auctionManager.js';
import {command as analyticsCommand, COMMAND} from './adlooxAnalyticsAdapter.js';
Expand Down
2 changes: 1 addition & 1 deletion modules/akamaiDapRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {
createRtdProvider
} from './symitriDapRtdProvider.js'/* eslint prebid/validate-imports: "off" */
} from './symitriDapRtdProvider.js'/* eslint prebidjs/validate-imports: "off" */

export const {
addRealTimeData,
Expand Down
2 changes: 1 addition & 1 deletion modules/automatadAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var isLoggingEnabled; var queuePointer = 0; var retryCount = 0; var timer = null
const prettyLog = (level, text, isGroup = false, cb = () => {}) => {
if (self.isLoggingEnabled === undefined) {
// TODO FIX THIS RULES VIOLATION
// eslint-disable-next-line prebid/no-global
// eslint-disable-next-line prebidjs/no-global
if (window.localStorage.getItem('__aggLoggingEnabled')) {
self.isLoggingEnabled = true
} else {
Expand Down
2 changes: 1 addition & 1 deletion modules/big-richmediaBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {config} from '../src/config.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {spec as baseAdapter} from './appnexusBidAdapter.js'; // eslint-disable-line prebid/validate-imports
import {spec as baseAdapter} from './appnexusBidAdapter.js'; // eslint-disable-line prebidjs/validate-imports

/**
* @typedef {import('../src/adapters/bidderFactory.js').BidRequest} BidRequest
Expand Down
4 changes: 2 additions & 2 deletions modules/cwireBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export const spec = {
}
}
// TODO FIX THIS RULES VIOLATION
// eslint-disable-next-line prebid/no-member
// eslint-disable-next-line prebidjs/no-member
navigator.sendBeacon(EVENT_ENDPOINT, JSON.stringify(event))
},

Expand All @@ -243,7 +243,7 @@ export const spec = {
}
}
// TODO FIX THIS RULES VIOLATION
// eslint-disable-next-line prebid/no-member
// eslint-disable-next-line prebidjs/no-member
navigator.sendBeacon(EVENT_ENDPOINT, JSON.stringify(event))
},

Expand Down
6 changes: 3 additions & 3 deletions modules/debugging/debugging.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function disableDebugging({hook, logger}) {
}
}

// eslint-disable-next-line prebid/no-global
// eslint-disable-next-line prebidjs/no-global
function saveDebuggingConfig(debugConfig, {sessionStorage = window.sessionStorage, DEBUG_KEY} = {}) {
if (!debugConfig.enabled) {
try {
Expand All @@ -50,7 +50,7 @@ function saveDebuggingConfig(debugConfig, {sessionStorage = window.sessionStorag
}
}

// eslint-disable-next-line prebid/no-global
// eslint-disable-next-line prebidjs/no-global
export function getConfig(debugging, {getStorage = () => window.sessionStorage, DEBUG_KEY, config, hook, logger} = {}) {
if (debugging == null) return;
let sessionStorage;
Expand All @@ -72,7 +72,7 @@ export function getConfig(debugging, {getStorage = () => window.sessionStorage,
export function sessionLoader({DEBUG_KEY, storage, config, hook, logger}) {
let overrides;
try {
// eslint-disable-next-line prebid/no-global
// eslint-disable-next-line prebidjs/no-global
storage = storage || window.sessionStorage;
overrides = JSON.parse(storage.getItem(DEBUG_KEY));
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion modules/dgkeywordRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function getProfileApiUrl(customeUrl, enableReadFpid) {
export function readFpidFromLocalStrage() {
try {
// TODO: use storageManager
// eslint-disable-next-line prebid/no-global
// eslint-disable-next-line prebidjs/no-global
const fpid = window.localStorage.getItem('ope_fpid');
if (fpid) {
return fpid;
Expand Down
2 changes: 1 addition & 1 deletion modules/euidIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {getStorageManager} from '../src/storageManager.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';

// RE below lint exception: UID2 and EUID are separate modules, but the protocol is the same and shared code makes sense here.
// eslint-disable-next-line prebid/validate-imports
// eslint-disable-next-line prebidjs/validate-imports
import { Uid2GetId, Uid2CodeVersion, extractIdentityFromParams } from './uid2IdSystem_shared.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion modules/liveIntentIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { triggerPixel, logError } from '../src/utils.js';
import { ajaxBuilder } from '../src/ajax.js';
import { submodule } from '../src/hook.js';
import { LiveConnect } from 'live-connect-js/prebid'; // eslint-disable-line prebid/validate-imports
import { LiveConnect } from 'live-connect-js/prebid'; // eslint-disable-line prebidjs/validate-imports
import { gdprDataHandler, uspDataHandler, gppDataHandler, coppaDataHandler } from '../src/adapterManager.js';
import { getStorageManager } from '../src/storageManager.js';
import { MODULE_TYPE_UID } from '../src/activities/modules.js';
Expand Down
2 changes: 1 addition & 1 deletion modules/pubxaiRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getStorageManager } from '../src/storageManager.js';
* This RTD module has a dependency on the priceFloors module.
* We utilize the createFloorsDataForAuction function from the priceFloors module to incorporate price floors data into the current auction.
*/
import { createFloorsDataForAuction } from './priceFloors.js'; // eslint-disable-line prebid/validate-imports
import { createFloorsDataForAuction } from './priceFloors.js'; // eslint-disable-line prebidjs/validate-imports

const MODULE_NAME = 'realTimeData';
const SUBMODULE_NAME = 'pubxai';
Expand Down
2 changes: 1 addition & 1 deletion modules/saambaaBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { spec } from './advangelistsBidAdapter.js'; // eslint-disable-line prebid/validate-imports
import { spec } from './advangelistsBidAdapter.js'; // eslint-disable-line prebidjs/validate-imports
import { registerBidder } from '../src/adapters/bidderFactory.js';
registerBidder(spec);
2 changes: 1 addition & 1 deletion modules/sirdataRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export function postContentForSemanticAnalysis(postContentToken, actualUrl) {
// Use the Beacon API if supported to send the payload
if ('sendBeacon' in navigator) {
// TODO FIX RULES VIOLATION
// eslint-disable-next-line prebid/no-member
// eslint-disable-next-line prebidjs/no-member
navigator.sendBeacon(url, payload);
} else {
// Fallback to using AJAX if Beacon API is not supported
Expand Down
4 changes: 2 additions & 2 deletions modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ function loadOrCreateFirstPartyData() {
var readData = function (key) {
if (hasLocalStorage()) {
// TODO FIX RULES VIOLATION
// eslint-disable-next-line prebid/no-global
// eslint-disable-next-line prebidjs/no-global
return window.localStorage.getItem(key);
}
return null;
Expand All @@ -446,7 +446,7 @@ function loadOrCreateFirstPartyData() {
try {
if (hasLocalStorage()) {
// TODO FIX RULES VIOLATION
// eslint-disable-next-line prebid/no-global
// eslint-disable-next-line prebidjs/no-global
window.localStorage.setItem(key, value);
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion modules/uid2IdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {getStorageManager} from '../src/storageManager.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';

// RE below lint exception: UID2 and EUID are separate modules, but the protocol is the same and shared code makes sense here.
// eslint-disable-next-line prebid/validate-imports
// eslint-disable-next-line prebidjs/validate-imports
import { Uid2GetId, Uid2CodeVersion, extractIdentityFromParams } from './uid2IdSystem_shared.js';
import {UID2_EIDS} from '../libraries/uid2Eids/uid2Eids.js';

Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jsdoc": "^48.5.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prebid": "file:./plugins/eslint",
"eslint-plugin-prebidjs": "file:./plugins/eslint",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^3.0.1",
"execa": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion plugins/eslint/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "eslint-plugin-prebid",
"name": "eslint-plugin-prebidjs",
"version": "1.0.0",
"description": "validates module imports can be found without custom webpack resolvers, are in module whitelist, and not module entry points",
"main": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function toXHR({status, statusText = '', headers, url}, responseText) {
return xml;
}
return {
// eslint-disable-next-line prebid/no-global
// eslint-disable-next-line prebidjs/no-global
readyState: XMLHttpRequest.DONE,
status,
statusText,
Expand Down
2 changes: 1 addition & 1 deletion src/debugging.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const reset = ctl.reset;
export function loadSession() {
let storage = null;
try {
// eslint-disable-next-line prebid/no-global
// eslint-disable-next-line prebidjs/no-global
storage = window.sessionStorage;
} catch (e) {}

Expand Down
6 changes: 3 additions & 3 deletions src/storageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const STORAGE_TYPE_COOKIES = 'cookie';

export let storageCallbacks = [];

/* eslint-disable prebid/no-global */
/* eslint-disable prebidjs/no-global */

/*
* Storage manager constructor. Consumers should prefer one of `getStorageManager` or `getCoreStorageManager`.
Expand Down Expand Up @@ -67,7 +67,7 @@ export function newStorageManager({moduleName, moduleType} = {}, {isAllowed = is
const expiresPortion = (expires && expires !== '') ? ` ;expires=${expires}` : '';
const isNone = (sameSite != null && sameSite.toLowerCase() == 'none')
const secure = (isNone) ? '; Secure' : '';
// eslint-disable-next-line prebid/no-member
// eslint-disable-next-line prebidjs/no-member
document.cookie = `${key}=${encodeURIComponent(value)}${expiresPortion}; path=/${domainPortion}${sameSite ? `; SameSite=${sameSite}` : ''}${secure}`;
}
}
Expand Down Expand Up @@ -181,7 +181,7 @@ export function newStorageManager({moduleName, moduleType} = {}, {isAllowed = is
if (result && result.valid) {
const all = [];
if (hasDeviceAccess()) {
// eslint-disable-next-line prebid/no-member
// eslint-disable-next-line prebidjs/no-member
const cookies = document.cookie.split(';');
while (cookies.length) {
const cookie = cookies.pop();
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ export function hasDeviceAccess() {
* @returns {(boolean|undefined)}
*/
export function checkCookieSupport() {
// eslint-disable-next-line prebid/no-member
// eslint-disable-next-line prebidjs/no-member
if (window.navigator.cookieEnabled || !!document.cookie.length) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/luceadBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable prebid/validate-imports,no-undef */
/* eslint-disable prebidjs/validate-imports,no-undef */
import { expect } from 'chai';
import { spec } from 'modules/luceadBidAdapter.js';
import sinon from 'sinon';
Expand Down

0 comments on commit 3863072

Please sign in to comment.