Skip to content
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

Build system: do not allow cross-module imports #8293

Merged
merged 8 commits into from
Apr 4, 2023

Conversation

dgirardi
Copy link
Collaborator

Type of change

  • Build related changes

Description of change

This updates the validate-imports eslint plugin to fix an edge case where cross-module imports would sometimes be allowed if the imported module is a directory.

@dgirardi dgirardi requested a review from snapwich April 18, 2022 18:08
@dgirardi dgirardi marked this pull request as draft April 18, 2022 18:23
@dgirardi dgirardi force-pushed the better-validate-imports branch from e8df799 to 59e73d3 Compare April 18, 2022 19:20
@dgirardi
Copy link
Collaborator Author

These adapters now fail the lint check because they import {createEidsArray} from 'userId/eids.js':

/home/circleci/Prebid.js/modules/adagioBidAdapter.js
  30:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/adyoulikeBidAdapter.js
  4:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/bluebillywigBidAdapter.js
  7:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/connectadBidAdapter.js
  5:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/impactifyBidAdapter.js
  5:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/improvedigitalBidAdapter.js
  9:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/mediakeysBidAdapter.js
  25:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/onetagBidAdapter.js
  9:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/sharethroughBidAdapter.js
  5:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/smartadserverBidAdapter.js
  4:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/sortableBidAdapter.js
  5:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/sovrnBidAdapter.js
  4:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/ttdBidAdapter.js
  3:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

/home/circleci/Prebid.js/modules/yieldmoBidAdapter.js
  20:1  error  import "./userId/eids.js": importing from modules is not allowed  prebid/validate-imports

so there's more work involved in fixing that - keeping this in draft for now.

@patmmccann
Copy link
Collaborator

so can createEidsArray return empty from core and userid can overwrite it?

@dgirardi
Copy link
Collaborator Author

@patmmccann adapters are supposed to take ids from the request, e.g. bid.userIdsAsEids. What must have happened is that one of them accidentally imported that and then others followed suit.

The effect of this is that every one of those adapters will have that logic duplicated in their module file.

@snapwich
Copy link
Collaborator

snapwich commented Jun 8, 2022

this was the original intention of the validate-imports plugin so the change looks good to me as soon as the adapters are updated.

@patmmccann
Copy link
Collaborator

@caseywhitmire

bid.userIdAsEids = createEidsArray(combinedSubmoduleIds);
does the same conversion most of the adapters that fail the lint check do; could you help us by cleaning that up in a pr to dgirardi:better-validate-imports so we can get this pr knocked out?

@patmmccann
Copy link
Collaborator

linking #8539 for possible enforcement

@patmmccann patmmccann marked this pull request as ready for review April 4, 2023 15:41
@patmmccann patmmccann merged commit 76399e2 into prebid:master Apr 4, 2023
jorgeluisrocha pushed a commit to jwplayer/Prebid.js that referenced this pull request May 23, 2023
* eslint validate-imports plugin: do not allow cross-module imports

* Update onetag

* fix conflicts

* update imports

* refactor audiencerun & jixie

---------

Co-authored-by: Chris Huie <[email protected]>
Co-authored-by: caseywhitmire <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

5 participants