Build system: do not allow cross-module imports
Type of change
- [x] 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.
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.
so can createEidsArray return empty from core and userid can overwrite it?
@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.
this was the original intention of the validate-imports plugin so the change looks good to me as soon as the adapters are updated.
@caseywhitmire https://github.com/prebid/Prebid.js/blob/2ee4d3f21f5767734222d0298d3b538e6cc3c859/modules/userId/index.js#L497 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?
linking #8539 for possible enforcement