Closed GoodForOneFare closed 8 years ago
shopify-codemod/transform/removeUselessReturnFromTest
contains an isUselessIIFE
method that may be useful for this.
Possibly fixed by mainline decaf merge. Please don't start work on this until we've finished evaluation.
Did decaf merge fix this @GoodForOneFare?
@lemonmade It definitely helped, and there's a couple that I can fix with a trivial change to decaf
. Once I've done that, I'll update this issue with anything that remains.
My fix for try/catch
IIFEs was accepted into mainline decaf. Doing the same for for
loops turned out to be non-trivial. The number of IIFEs has greatly decreased, and I think that's good enough for now.
There's a few IIFEs that don't seem to serve any purpose, e.g., in
finances-report.js
:A non-exhaustive list of IIFEs follow. Note that some of these may be necessary; watch out for switches or loops with return values:
CachedResourceSearch#_precompileTemplates
EditLinkModal#createLink
HumanizedDatepicker#selectRange
IFrameMessageHandler#handleMessage
InventoryColumn#updateInventory
MixedContentProtection#parseAndSerialize
MixedContentProtection#attrFromTagName
ProductOptions#findFirstAvailableName
ProductVariantOptions#renderOptionRows
ShippingZoneProvinceTagDisplay#addProvince
SKUGenerator#setSKU
SpreadsheetNavigator#applyMultiEdit
Taggable#findFormObject
UIChoiceList#initializeSubchoices
.VariantImageActions#uploadComplete