-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Plugin] [2/9] Convert throws to asserts #4211
Conversation
…ugin-amend-imports-for-readability
…l/plugins-move-throws-to-asserts
plugin/src/makeWorklet.ts
Outdated
@@ -370,7 +372,7 @@ export function makeWorklet( | |||
functionName, | |||
transformed.map | |||
); | |||
if (!funString) throw new Error("'funString' is not defined\n"); | |||
assertIsDefined(funString); |
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.
In which case funString
is not defined? Is it possible to use TypeScript to ensure that it's defined?
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.
Co-authored-by: Tomek Zawadzki <tomasz.zawadzki@swmansion.com>
plugin/package.json
Outdated
@@ -15,7 +16,7 @@ | |||
"bundle": "yarn esbuild ./lib/plugin.js --bundle --external:@babel --external:convert-source-map --external:fs --external:'../../package.json' --log-level=warning --platform=node --sourcemap=linked --outfile=build/plugin.js", | |||
"format": "yarn prettier --write --list-different **/*.ts", | |||
"watch": "yarn tsc-watch --onSuccess \"yarn bundle\"", | |||
"lint": "yarn eslint --max-warnings=0 --ext .ts . && yarn prettier --check **/*.ts", | |||
"lint": "yarn eslint --max-warnings=0 --ext .ts .", |
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.
"lint": "yarn eslint --max-warnings=0 --ext .ts .", | |
"lint": "eslint --max-warnings=0 --ext .ts .", |
Honestly I don't like using --ext .ts
here. Instead, we can remove this flag and skip lib
and build
folders using ignorePatterns: ['lib/', 'build/'],
in .eslintrc.js
.
## Summary Slight naming refactor for functions' names to be more self-explanatory. Direct follow up to #4211. ## Test plan No testing required since it's name change only (maybe check if it compiles). --------- Co-authored-by: Tomek Zawadzki <tomasz.zawadzki@swmansion.com>
## Summary Change custom error throws on undefined objects to generic assert for better clarity. Direct follow up to software-mansion#4210. ## Test plan Nothing to test really. --------- Co-authored-by: Tomek Zawadzki <tomasz.zawadzki@swmansion.com>
## Summary Slight naming refactor for functions' names to be more self-explanatory. Direct follow up to software-mansion#4211. ## Test plan No testing required since it's name change only (maybe check if it compiles). --------- Co-authored-by: Tomek Zawadzki <tomasz.zawadzki@swmansion.com>
Summary
Change custom error throws on undefined objects to generic assert for better clarity. Direct follow up to #4210.
Test plan
Nothing to test really.