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

XS✔ ◾ Typescript Enums Rule #8193

Merged
merged 31 commits into from Mar 26, 2024
Merged

XS✔ ◾ Typescript Enums Rule #8193

merged 31 commits into from Mar 26, 2024

Conversation

Harry-Ross
Copy link
Contributor

Tip: Use SSW Rule Writer GPT for help with writing rules 🤖

  1. What triggered this change? (PBI link, Email Subject, conversation + reason, etc)

✏️ There have been some duplication issues with enums on the SSW.Website, thought its important for people to understand const assertions.

  1. What was changed?

✏️ Added a new rule: Do you know the pitfalls of TypeScript enums?

  1. Did you do pair or mob programming (list names)?

✏️ No

@github-actions github-actions bot added the Age: 🥚 - New About 2 hours old label Mar 19, 2024
@Harry-Ross Harry-Ross marked this pull request as ready for review March 19, 2024 23:54
Copy link
Contributor

github-actions bot commented Mar 20, 2024

PR Metrics

Thanks for keeping your pull request small.
Thanks for adding tests.

Lines
Product Code -
Test Code -
Subtotal -
Ignored Code 128
Total 128

Metrics computed by PR Metrics. Add it to your Azure DevOps and GitHub PRs!

@github-actions github-actions bot changed the title Typescript Enums Rule XS✔ ◾ Typescript Enums Rule Mar 20, 2024
@github-actions github-actions bot added Age: 🐣 - Young About 4 hours old Age: 🐥 - Adolescent About 8 hours old Age: 🐤 - Mature About 16 hours old Age: 🐓 - Old About 32 hours old Age: 🍗 - Ancient About 64 hours old 🔥 Merge Debt This PR contains merge debt, see https://www.ssw.com.au/rules/merge-debt/ and removed Age: 🥚 - New About 2 hours old Age: 🐣 - Young About 4 hours old Age: 🐥 - Adolescent About 8 hours old Age: 🐤 - Mature About 16 hours old Age: 🐓 - Old About 32 hours old labels Mar 20, 2024
@github-actions github-actions bot added Age: 🦖 - Extinct About 128 hours old and removed Age: 🍗 - Ancient About 64 hours old labels Mar 22, 2024
Copy link
Member

@christoment christoment left a comment

Choose a reason for hiding this comment

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

I think we need to dig a bit more on when to use enum in the code, and when to use const object.

My thoughts: collection of values in a const is not an enum - they are separate use cases and for different purpose 😄

Also see https://www.typescriptlang.org/docs/handbook/enums.html#objects-vs-enums and https://github.com/rbuckton/proposal-enum

rules/typescript-enums/rule.md Outdated Show resolved Hide resolved
rules/typescript-enums/rule.md Show resolved Hide resolved
Copy link
Member

@wicksipedia wicksipedia left a comment

Choose a reason for hiding this comment

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

approved with suggestions

@Harry-Ross Harry-Ross dismissed bradystroud’s stale review March 26, 2024 22:31

On leave in a different timezone

Copy link
Member

@jeoffreyfischer jeoffreyfischer left a comment

Choose a reason for hiding this comment

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

LGTM

@Harry-Ross Harry-Ross merged commit 6ae8af9 into main Mar 26, 2024
5 checks passed
@Harry-Ross Harry-Ross deleted the typescript-enums-rule branch March 26, 2024 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Age: 🦖 - Extinct About 128 hours old 🔥 Merge Debt This PR contains merge debt, see https://www.ssw.com.au/rules/merge-debt/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants