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

Package updates + lots of cleanup #503

Merged
merged 20 commits into from
May 26, 2023

Conversation

JazzarKarim
Copy link
Collaborator

@JazzarKarim JazzarKarim commented May 19, 2023

Issue #: /bcgov/entity#16207

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the business-filings-ui license (Apache 2.0).

@JazzarKarim JazzarKarim self-assigned this May 19, 2023
@JazzarKarim JazzarKarim marked this pull request as draft May 19, 2023 20:55
@JazzarKarim JazzarKarim force-pushed the 16207-package-updates-and-cleanup branch from 7411626 to aff0769 Compare May 19, 2023 21:03
sessionStorage.setItem('TEMP_REG_NUMBER', 'TaAbBcC123')
businessStore.setLegalType(CorpTypeCd.BENEFIT_COMPANY)
})
// beforeAll(() => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is done to fix the Invalid: beforeAll() may not be used in a describe block containing no tests eslint error.

Copy link
Collaborator

Choose a reason for hiding this comment

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

🤦‍♂️

@@ -335,7 +327,7 @@ export default class StaffNotation extends Vue {

@Emit('close')
// eslint-disable-next-line @typescript-eslint/no-unused-vars
private close (needReload: boolean): void {}
close (needReload: boolean): void { /* no empty function */ }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There are a lot of these in the code. This is done to fix the Unexpected empty method SonarCloud code smell.

For reference: https://eslint.org/docs/latest/rules/no-empty-function

@Prop({ default: null }) readonly highlightId!: number

@Getter(useFilingHistoryListStore) getCurrentFiling!: ApiFilingIF
@Getter(useConfigurationStore) getEditUrl!: string
@Getter(useFilingHistoryListStore) getFilings!: Array<ApiFilingIF>
@Getter(useBusinessStore) getIdentifier!: string
Copy link
Collaborator Author

@JazzarKarim JazzarKarim May 23, 2023

Choose a reason for hiding this comment

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

Eslint was complaining that this getter was also in the mixin so I removed it. This also applies to many places in the code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's fine. I saw this (and changed it) too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

(It's because the mixins are now properly "mixed into" this, so their method signatures are now recognized.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm OK to resolve this conversation.

@Getter(useBusinessStore) getIdentifier!: string
@Getter(useRootStore) getNameRequest!: any
@Getter(useConfigurationStore) getPayApiUrl!: string
@Getter(useFilingHistoryListStore) getPendingCoa!: ApiFilingIF
@Getter(useRootStore) getTasks!: Array<ApiTaskIF>
@Getter(useRootStore) getTodoListResource!: TodoListResourceIF
@Getter(useBusinessStore) isBenBcCccUlc!: boolean
@Getter(useBusinessStore) isGoodStanding!: boolean
@Getter(useBusinessStore) isSoleProp!: boolean
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This getter was being used in the code but it wasn't here 😅

// this is needed to remove existing service workers on users' systems
// ref: https://www.npmjs.com/package/webpack-remove-serviceworker-plugin
// ref: https://github.com/NekR/self-destroying-sw/tree/master/packages/webpack-remove-serviceworker-plugin
new RemoveServiceWorkerPlugin({ filename: 'service-worker.js' }),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Reason for removing this: bcgov/entity#16170

Copy link
Collaborator

@severinbeauvais severinbeauvais May 25, 2023

Choose a reason for hiding this comment

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

You may be able to delete src/registerServiceWorker.ts.

See #266 for the changes that were done to implement this feature that you are now removing.

Copy link
Collaborator

@seeker25 seeker25 May 25, 2023

Choose a reason for hiding this comment

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

If the service worker is stuck - There's a certain header you can setup on NGINX that gets it unstuck. We had to do this when we loaded on a bad version of the service worker that turfed some clients. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's nice to know. Instead, we used this plugin for over a year to remove the SW.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah the plugin wouldn't work if the service worker is toast and errors in javascript - Kinda last ditch effort we had to do with Director Search

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sev and Travis, I removed the registerServiceWorker.ts file with it's respective import in main.ts in my latest commit. Please let me know if you think that's OK to do.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think so... ? Try npm run build. Maybe we won't know for sure until it's deployed to Dev.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did try a build, everything looks OK. I also tested in local. Everything seems to be running normally. Okay then, hopefully all goes smoothly when I merge. Thanks!

@@ -3,6 +3,8 @@
"target": "esnext",
"module": "esnext",
"strict": false,
"noImplicitAny": false,
"strictNullChecks": false,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added the two rules to stay consistent between all the 3 UIs.

Copy link
Collaborator

@seeker25 seeker25 May 25, 2023

Choose a reason for hiding this comment

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

Might want to add in https://www.typescriptlang.org/tsconfig/skipLibCheck.html

What do you think Severin?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we skip type checking of declaration files anywhere else? I'd rather my build take a few extra seconds than give up type-checking :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe not such a good idea considering bcrs-shared-components isn't precompiled

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hahaha

allDirectors: DirectorIF[] = []

/** Initialize dir to use in the template's for loop. */
dir: DirectorIF = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Some tests were failing in Directors.spec.ts. The reasons being:

  • Property or method "dir" is not defined on the instance but referenced during render.
  • TypeError: Cannot read properties of null (reading 'id'). This also is related to dir.

This change fixes the tests.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a decoy fix, which calms the tests perhaps, but doesn't solve the problem.

I see on line 191 that dir is a loop variable. Maybe try renaming it in case it's a reserved word? You could also try moving the v-for to a template element around the <li>.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Both didn't work Sev. I was thinking of adding optional chaining to dir in the template. Apparently, it's not supported in Vue 2. It is in Vue 3: vuejs/vue#11088

I'm thinking of disabling the tests for the time being and adding them to the new ticket. I'll look into this more and try to fix before doing so.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the code work correctly right now?

If it does then create a follow-up ticket with the comments above and move on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've been messing around with the Directors and I see everything is working correctly with no errors. So, I guess the code is OK.

Alright, got it.

import { ContactInfo } from '@/components/common'
import { HistoryItemIF } from '@/interfaces'
Copy link
Collaborator Author

@JazzarKarim JazzarKarim May 24, 2023

Choose a reason for hiding this comment

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

The interface HistoryItemIF doesn't exist.

@codecov
Copy link

codecov bot commented May 24, 2023

Codecov Report

Merging #503 (1f53563) into main (46389cd) will increase coverage by 8.26%.
The diff coverage is 97.13%.

@@            Coverage Diff             @@
##             main     #503      +/-   ##
==========================================
+ Coverage   82.88%   91.15%   +8.26%     
==========================================
  Files         109      169      +60     
  Lines        2104     2747     +643     
  Branches      659      301     -358     
==========================================
+ Hits         1744     2504     +760     
+ Misses        360      239     -121     
- Partials        0        4       +4     
Impacted Files Coverage Δ
src/components/Dashboard/TodoList/PaymentPaid.vue 100.00% <ø> (ø)
...c/components/Dashboard/TodoList/PaymentPending.vue 100.00% <ø> (ø)
...ponents/Dashboard/TodoList/PaymentUnsuccessful.vue 100.00% <ø> (ø)
src/mixins/countries-provinces-mixin.ts 55.55% <ø> (ø)
src/mixins/index.ts 100.00% <ø> (ø)
src/resources/business-config.ts 100.00% <ø> (ø)
src/services/legal-services.ts 64.12% <ø> (ø)
src/services/pay-services.ts 85.71% <ø> (ø)
src/stores/authenticationStore.ts 27.27% <ø> (ø)
src/stores/businessStore.ts 94.82% <ø> (ø)
... and 139 more

... and 1 file with indirect coverage changes

@JazzarKarim JazzarKarim marked this pull request as ready for review May 24, 2023 22:14
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
Copy link
Collaborator

@severinbeauvais severinbeauvais left a comment

Choose a reason for hiding this comment

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

LGTM, but please get some other review approvals.

@JazzarKarim JazzarKarim force-pushed the 16207-package-updates-and-cleanup branch from f591c08 to 9f4f559 Compare May 25, 2023 22:33
Copy link
Collaborator

@ketaki-deodhar ketaki-deodhar left a comment

Choose a reason for hiding this comment

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

I did go through all the changes. Lots of learning from the conversations. Great work @JazzarKarim ! 👍

@sonarcloud
Copy link

sonarcloud bot commented May 25, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.3% 0.3% Duplication

@JazzarKarim
Copy link
Collaborator Author

/gcbrun

@pwei1018
Copy link
Collaborator

Temporary Url for review: https://business-filings-dev--pr-503-8u5hy650.web.app

@JazzarKarim JazzarKarim merged commit c1676c3 into bcgov:main May 26, 2023
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.

5 participants