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

chore(core): enable eslint and remove tslint #12982

Merged
merged 5 commits into from
Feb 13, 2024
Merged

Conversation

HuiSF
Copy link
Contributor

@HuiSF HuiSF commented Feb 8, 2024

Description of changes

  1. (this 1st commit in this PR) enabled eslint for the core package, and removed the tslint config for it
  2. (the 2nd commit in this PR) auto fixed issues by running yarn lint:fix

image

  1. (the 3rd commit in this PR) manually fixed issues reported by yarn lint but were not auto-fixable
image
  1. (the 4th commit in this PR) fixed type issues raised in the notifications package after fixing linter issues in core, this is related to the UserProfile type in core

NOTE: This PR doesn't fix the linter warnings.

Issue #, if available

Description of how you validated changes

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@HuiSF HuiSF requested review from a team as code owners February 8, 2024 02:20
Comment on lines 13 to 28
let inflightPromise: Promise<R> | undefined;

return async (...args: A): Promise<Awaited<R>> => {
return async (...args: A): Promise<R> => {
if (inflightPromise) return inflightPromise;

inflightPromise = new Promise(async (resolve, reject) => {
try {
const result = await asyncFunction(...args);
resolve(result);
} catch (error) {
reject(error);
} finally {
inflightPromise = undefined;
}
inflightPromise = new Promise<R>((resolve, reject) => {
asyncFunction(...args)
.then(result => {
resolve(result);
})
.catch(error => {
reject(error);
})
.finally(() => {
inflightPromise = undefined;
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@israx can you review this particular change?

Why: Promise implementation should not be an async function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any issue. The asyncFunction will still resolve. Just in case, can you smock test this change ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose to trust the unit test 😄 will run some smoke tests too

@HuiSF HuiSF force-pushed the hui/chore/core-eslint branch 3 times, most recently from a2ebd14 to b10e712 Compare February 12, 2024 23:07
@@ -170,7 +170,7 @@ export class PinpointEventBuffer {
const { Results = {} } = data.EventsResponse ?? {};
const retryableEvents: BufferedEvent[] = [];

Object.entries(Results).forEach(([endpointId, endpointValues]) => {
Object.entries(Results).forEach(([_, endpointValues]) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this just be Object.values then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, going to send a PR in to update this loop.

@HuiSF HuiSF merged commit b96a0ed into main Feb 13, 2024
30 checks passed
@HuiSF HuiSF deleted the hui/chore/core-eslint branch February 13, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants