-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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: make TS enums strictly PascalCase #26875
Conversation
63d3995
to
984b050
Compare
a2ef0a3
to
fed2486
Compare
fed2486
to
4bacf57
Compare
413ad45
to
3a465ad
Compare
86030fc
to
ab62800
Compare
enum CHART_STATUS_MAP { | ||
failed = 'danger', | ||
loading = 'warning', | ||
success = 'success', | ||
} | ||
const CHART_STATUS_MAP = { | ||
failed: 'danger', | ||
loading: 'warning', | ||
success: 'success', | ||
}; |
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.
This was really not a proper enum or used as such, so I changed it to a regular object.
@@ -1,3 +1,4 @@ | |||
/* eslint-disable @typescript-eslint/naming-convention */ |
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.
I added this single override, as it felt sensible to leave the locales and currencies as-is
dffe05e
to
e22ccab
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.
Thank you for the improvement @villebro. I left some first-pass comments.
ScheduledQueries = 'SCHEDULED_QUERIES', | ||
ShareQueriesViaKvStore = 'SHARE_QUERIES_VIA_KV_STORE', | ||
SqllabBackendPersistence = 'SQLLAB_BACKEND_PERSISTENCE', | ||
SqlValidatorsByEngine = 'SQLLAB_BACKEND_PERSISTENCE', |
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.
SqlValidatorsByEngine = 'SQLLAB_BACKEND_PERSISTENCE', | |
SqlValidatorsByEngine = 'SQL_VALIDATORS_BY_ENGINE', |
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.
Eagle eyes! How did you even spot this?!
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.
Lots of ☕ apparently! :)
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.
☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕
superset-frontend/src/components/Table/cell-renderers/NumericCell/index.tsx
Outdated
Show resolved
Hide resolved
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.
LGTM!
I'm gonna go ahead and merge this, as it conflicts extremely easily due to the number of touched files. Thanks for the reviews! |
...but I'll leave it open until the end of the working day PST so anyone else can post commentts if they have time to review! |
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.
Love it, 100% recommend for bed time read if you have insomnia. LGTM!
You know when you forget to blink for too long, then it hurts when you do? I'm halfway done reviewing. My browser hates this PR, but I love that you've done it :D |
@@ -332,15 +332,15 @@ export default function sqlLabReducer(state = {}, action) { | |||
}, | |||
[actions.REQUEST_QUERY_RESULTS]() { | |||
return alterInObject(state, 'queries', action.query, { | |||
state: QueryState.FETCHING, | |||
state: QueryState.Fetching, |
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.
The fact that this PR is 2k LOC, 360+ files and almost crashes the browser shows just how bad this inconsistency problem had gotten over time. I look forward to doing the same for the backend codebase.. shudders |
...nd/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.tsx
Show resolved
Hide resolved
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.
LGTM!
...passes out
SUMMARY
TypeScript enum names and keys should always be PascalCase, which is the commonly accepted best practice (see the official docs: https://www.typescriptlang.org/docs/handbook/enums.html). This PR does the following:
superset-ui
packages/plugins. The enum values have been left in tact so as to not cause a breaking change.Note, that I've made a few exceptions, where deviating from pascal case makes more sense, especially the locales and currencies, where it felt dangerous and less intuitive to move to pascal case.
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION