Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Migrate JS to TS and Test Files to Node.js Native Test runner : Juicy-coupon-bot renovation #25

Merged
merged 52 commits into from
Mar 21, 2025

Conversation

hxrshxz
Copy link
Contributor

@hxrshxz hxrshxz commented Mar 8, 2025

Files to Migrate ( JS -> TS )

  • blueSkyPost
  • currentCoupons
  • logger
  • mastodonPost
  • publishBlueSky
  • publishMastodon
  • publishReddit
  • randomDiscount
  • redditPost
  • juicy-coupon-bot
  • index

Test Files to Migrate ( Chai , Mocha -> Node.js Native Test Runner )

  • blueSkyPost.spec
  • currentCoupons.spec
  • mastodonPost.spec
  • randomDiscount.spec
  • redditComment.spec

Linter

  • Configure Linter to run for TS Files

@hxrshxz hxrshxz changed the title Migrating from Vanila Js to Ts Migrated blueSkyPost and logger Mar 8, 2025
@hxrshxz hxrshxz marked this pull request as draft March 8, 2025 17:35
@hxrshxz hxrshxz force-pushed the master branch 3 times, most recently from 8cad78a to 3ad7c94 Compare March 8, 2025 19:01
@pull-request-size pull-request-size bot added size/L and removed size/M labels Mar 9, 2025
@hxrshxz hxrshxz changed the title Migrated blueSkyPost and logger Migrate from JS to TS Mar 10, 2025
@hxrshxz
Copy link
Contributor Author

hxrshxz commented Mar 15, 2025

Just some linting errors left

Screencast.from.2025-03-15.16-01-15.mp4

@hxrshxz
Copy link
Contributor Author

hxrshxz commented Mar 15, 2025

@hxrshxz hxrshxz requested a review from J12934 March 15, 2025 16:24
Copy link
Member

@J12934 J12934 left a comment

Choose a reason for hiding this comment

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

code itself looks pretty good to me 👍

unfortunatly the npm deps can't be installed right now, see pipeline logs.

also this project (in ccontrast to the main juiceshop repo) has a package-lock checked in, please make sure to also commit the changes to it when updating dependencies

package.json Outdated
Comment on lines 48 to 57
"chai": "^4.2.0",
"coveralls": "^3.1.0",
"mocha": "^7.2.0",
"eslint": "^8.57.1",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-n": "^17.16.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^7.2.1",
"mocha": "^10.4.0",
"nyc": "^15.1.0",
Copy link
Member

Choose a reason for hiding this comment

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

there still seem to be some (now) unused testing dependencies in here

@hxrshxz hxrshxz requested a review from J12934 March 16, 2025 20:36
@hxrshxz
Copy link
Contributor Author

hxrshxz commented Mar 16, 2025

Donee 👍

@@ -26,7 +26,7 @@ jobs:
node-version: 20
cache: npm
- name: "Install application"
run: npm install --ignore-scripts
run: npm install --ignore-scripts --legacy-peer-deps
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed? This repo (in contrast to the main repo) shouldn't have any sec bulbs in it and the dependencies should install cleanly

.eslintrc.cjs Outdated
parser: '@typescript-eslint/parser',
rules: {
"no-void": "off", // conflicting with recommendation from @typescript-eslint/no-floating-promises
// FIXME warnings below this line need to be checked and fixed.
Copy link
Member

Choose a reason for hiding this comment

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

Are all these really needed? Or just ported over?

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 initially ported them over, but I have now fixed it. 😅

.eslintrc.cjs Outdated
],
plugins: ["@typescript-eslint"],
env: {
browser: true,
Copy link
Member

Choose a reason for hiding this comment

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

Why are all these unused env enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

uhm same i ported these too it's fixed now

package.json Outdated
"eslint": "^8.57.1",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-n": "^17.16.2",
Copy link
Member

Choose a reason for hiding this comment

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

Why is this pulling in the plugin-n and the plugin-node that the n plugin is replacing?

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 wasn't aware that the n plugin replaces the node plugin. thank you

Copy link
Member

@J12934 J12934 left a comment

Choose a reason for hiding this comment

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

Can you have another look over the code style formatter? It still doesn't seem to be working/ correct. E.g the code is still using semicolons, this doesn't match the juice-shop repo

@@ -10,7 +10,7 @@ jobs:
uses: actions/checkout@v2
- name: Install Linter
run: |
npm install --ignore-scripts
npm install --ignore-scripts --legacy-peer-deps
Copy link
Member

Choose a reason for hiding this comment

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

Still leftover

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@hxrshxz
Copy link
Contributor Author

hxrshxz commented Mar 19, 2025

Can you have another look over the code style formatter? It still doesn't seem to be working/ correct. E.g the code is still using semicolons, this doesn't match the juice-shop repo

i actually misunderstood initially and intentionally added double quotes and semicolon now i have removed that rule

@hxrshxz hxrshxz requested a review from J12934 March 19, 2025 07:10
@bkimminich
Copy link
Member

CI/CD is running...

@bkimminich
Copy link
Member

I think we're just one npm run lint:fix away from merging this one! 🚀

@bkimminich bkimminich merged commit 903ee68 into juice-shop:master Mar 21, 2025
4 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants