-
Notifications
You must be signed in to change notification settings - Fork 34
Bug 1701578 - Break the circular dependency between pings/index.ts and pings/maker.ts #180
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
Conversation
e86926c to
b3c5dcb
Compare
We can tell the TS compiler, when declaring the variable, to expect it to be initialized shortly after construction.
This breaks yet another circular dependency on PingType.
This uses "@typescript-eslint/semi" instead of just "semi" as recommended https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#i-am-using-a-rule-from-eslint-core-and-it-doesnt-work-correctly-with-typescript-code
b3c5dcb to
7b674b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only nits. Today I am nitpicky.
Otherwise, LGTM.
| // The value of the X-Source-Tags header to be included in every ping. | ||
| sourceTags?: string[], | ||
| } | ||
| import { DebugOptions } from "./debug_options.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was it necessary to move this into another file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because due to the other imports in the config.ts file, if we wanted to use DebugOptions in the pings module without splitting it, we'd create a new circular dependency :)
This change is why this PR allows us to drop 2 circular dependencies :)
| */ | ||
| export async function collectAndStorePing(identifier: string, ping: PingType, reason?: string): Promise<void> { | ||
| const collectedPayload = await collectPing(ping, reason); | ||
| export async function collectAndStorePing(metricsDatabase: MetricsDatabase, eventsDatabase: EventsDatabase, pingsDatabase: PingsDatabase, applicationId: string, identifier: string, ping: CommonPingData, reason?: string, debugOptions?: DebugOptions): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Give a default value to the debug options and we don't need to put in the end of the arguments list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this, we're down to
1817! 🥳I also fixed a bug in our linting configuration about semicolon!