-
Notifications
You must be signed in to change notification settings - Fork 352
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
super small code polish #5276
super small code polish #5276
Conversation
There is actually method behind this madness - with the This is the actual compiled output after the change is made - var _api$rpc$system;
if (!((_api$rpc$system = api.rpc.system) !== null && _api$rpc$system !== void 0 && _api$rpc$system.dryRun)) {
throw new Error('The system.dryRun RPC call is not available in your environment');
} This applies to at least in the api and the utils, there has actually been a conscious effort to not use it - however it certainly have not been consistently removed all-over polkadot-js repos. If left to the engine in all cases, it would be less messy, but we are not quite at that point with JS support everywhere as of yet. |
Did NOT know about that.. Thank you @jacogr |
There is also similar concern about Personally I am more into cleaner code, because of two reasons:
|
But either way I think some eslint rule to enforce the style (force optional chaining/no optional chaining) would be great |
There are no eslint (nor ts-eslint) rules to deny these. Also as mentioned, in UI-code, due to what you mentioned above, it has not been a "rule" and is certainly used a lot. (The API and util is very different from "UI code") In general, these are not that bad in the PR form, where it becomes hairy and worth screaming is when doing However, it is actually fixable with a babel With that in and non-hairy outputs, there are actually ts-eslint rules that can enforce the usage of these. (Which would certainly be ok in that case) |
sounds great, so I am closing this PR as it's not the desired syntax |
Feel free to re-open, adjusted the babel outputs slightly with https://github.com/polkadot-js/dev/pull/827/files#diff-e46f7bc448773ef1bc430c11187663a5431bc8d7a67aba417675b2e31f3e8cf1R6-R7 The above now certainly removes my issues with the outputs, especially on those pesky longer items, it is no no worse than doing it "manually". |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
No description provided.