Skip to content

Commit

Permalink
Allow src/core imports in dep-check-config (#35598)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcebulko committed Aug 10, 2021
1 parent 99c5d52 commit a824db5
Showing 1 changed file with 7 additions and 32 deletions.
39 changes: 7 additions & 32 deletions build-system/test-configs/dep-check-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

/*eslint "max-len": 0*/

// This expands into
// - `src/*.js`` -> all JS files directly under `src`
// - `src/!(core)/**/*.js` -> all JS files in subfolders excluding `src/core`
const SRC_EXCLUDING_CORE = 'src{,/!(core)/**}/*.js';

// It is often OK to add things to the allowlist, but make sure to highlight
// this in review.
exports.rules = [
Expand Down Expand Up @@ -85,25 +90,12 @@ exports.rules = [
// Rules for 3p
{
filesMatching: '3p/**/*.js',
mustNotDependOn: 'src/**/*.js',
mustNotDependOn: SRC_EXCLUDING_CORE,
allowlist: [
'3p/**->src/core/constants/amp-events.js',
'3p/**->src/core/data-structures/observable.js',
'3p/**->src/core/data-structures/promise.js',
'3p/**->src/core/error/index.js',
'3p/**->src/core/types/enum.js',
'3p/**->src/core/types/function/index.js',
'3p/**->src/core/types/index.js',
'3p/**->src/core/types/object/index.js',
'3p/**->src/core/types/string/index.js',
'3p/**->src/core/types/string/url.js',
'3p/**->src/log.js',
'3p/**->src/core/dom/style.js',
'3p/**->src/core/mode/index.js',
'3p/**->src/url.js',
'3p/**->src/config.js',
'3p/**->src/mode.js',
'3p/**->src/core/types/object/json.js',
'3p/**->src/3p-frame-messaging.js',
'3p/polyfills.js->src/polyfills/math-sign.js',
'3p/polyfills.js->src/polyfills/object-assign.js',
Expand All @@ -123,23 +115,11 @@ exports.rules = [
// Rules for ads
{
filesMatching: 'ads/**/*.js',
mustNotDependOn: 'src/**/*.js',
mustNotDependOn: SRC_EXCLUDING_CORE,
allowlist: [
'ads/**->src/core/dom/fingerprint.js',
'ads/**->src/core/constants/consent-state.js',
'ads/**->src/core/error/index.js',
'ads/**->src/core/types/array.js',
'ads/**->src/core/types/function/index.js',
'ads/**->src/core/types/index.js',
'ads/**->src/core/types/object/index.js',
'ads/**->src/core/types/string/index.js',
'ads/**->src/core/types/string/url.js',
'ads/**->src/log.js',
'ads/**->src/mode.js',
'ads/**->src/url.js',
'ads/**->src/core/dom/static-template.js',
'ads/**->src/core/dom/style.js',
'ads/**->src/core/mode/index.js',
// ads/google/a4a doesn't contain 3P ad code and should probably move
// somewhere else at some point
'ads/google/a4a/**->src/ad-cid.js',
Expand All @@ -149,11 +129,6 @@ exports.rules = [
'ads/google/a4a/**->src/service/index.js',
'ads/google/a4a/utils.js->src/service/variable-source.js',
'ads/google/a4a/utils.js->src/ini-load.js',
'ads/google/a4a/utils.js->src/core/dom/index.js',
'ads/google/a4a/utils.js->src/core/dom/layout/page-layout-box.js',
'ads/google/a4a/utils.js->src/core/data-structures/promise.js',
// Some ads need to depend on json.js
'ads/**->src/core/types/object/json.js',
// IMA, similar to other non-Ad 3Ps above, needs access to event-helper
'ads/google/ima/ima-video.js->src/event-helper.js',
],
Expand Down

0 comments on commit a824db5

Please sign in to comment.