Comments (3)
@justinthec is going to do a quick runthrough of admin to see if this is a common problem. I reckon it'd be fixable in recast, but they're not very good with responding to PRs.
from javascript.
After doing an esify
conversion on core I've found six cases of function calls with hash literals passed in as the first parameter being converted this way.
Searching xxxxx files for "\w+\(\n\s+{" (regex, case sensitive)
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/lib/resource_browser/root_node.js:
40 }
41
42: itemSelected(
43: {
44 id,
45 title,
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/apple_pass_settings.js:
5
6 export default class ApplePassSettings {
7: constructor(
8: {
9 defaultLogoSrc,
10 defaultStripSrc,
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/finances/data_interface.js:
4
5 export default class ReportsDataSource {
6: constructor(
7: {
8 token,
9 userId,
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/home/sidebar/home_channels_summary_report.js:
24 }
25
26: _salesAndOrdersQuery(
27: {
28 id,
29 name,
..
40 }
41
42: _legacySalesAndOrdersQuery(
43: {
44 id,
45 name,
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/home/sidebar/home_sidebar_calendar.js:
35 }
36
37: _loadDateRange(
38: {
39 data,
40 },
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/i18n/language_editor.js:
119 }
120
121: save(
122: {
123 withoutSuccessFlash,
124 successCallback,
However there are 10 cases (16 coffee instances - 6 converted js instances) of coffee files that would trigger one of these ugly transforms but have parsing errors and do not convert successfully:
Searching xxxx files for "\w+:\s+\({" (regex, case sensitive)
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/lib/resource_browser/node.coffee:
23 !!@nextPageParams
24
25: itemSelected: ({title, id}) ->
26 filter = {}
27 filter[@resourceType] = id
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/lib/resource_browser/root_node.coffee:
30 false
31
32: itemSelected: ({id, title}) ->
33 @children[id].visit(null, title)
34
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/apple_pass_settings.coffee:
1 class Shopify.ApplePassSettings
2
3: constructor: ({@defaultLogoSrc, @defaultStripSrc, @currentLogoSrc, @currentStripSrc})->
4 _.delay => @updatePreviewColors()
5
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/attachment.coffee:
29 {size: (Math.round(size * 100) / 100), unit: units[unit]}
30
31: constructor: ({@file, @$node}) ->
32 @showProgressBar = @showRemove = @showError = @showDone = false
33
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/remote_domain_operations.coffee:
69 .error(Shopify.handleError)
70
71: renewSuccessful: ({auto_renew, expiry_date}) =>
72 Shopify.Loading.stop()
73 @willAutoRenew = auto_renew
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/finances/data_interface.coffee:
2
3 class Shopify.ReportsDataSource
4: constructor: ({token, userId, source}) ->
5 @defaultParams =
6 token: token
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/finances/finances_date_picker.coffee:
6 DATE_REGEX = /(\d{4}-\d{2}-\d{2})/
7
8: constructor: ({$dropdownNode, $startTextNode, $endTextNode, $startCalNode, $endCalNode, $popoverNode, options}) ->
9 @MOMENT_DATE_FORMAT = 'YYYY-MM-DD'
10 @currentRange = 'month_to_date'
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/home/sidebar/home_channels_summary_report.coffee:
10 super
11
12: _salesAndOrdersQuery: ({id, name}) ->
13 [providerId, locationId] = id.split('-')
14
..
26 ""
27
28: _legacySalesAndOrdersQuery: ({id, name}) ->
29 [providerId, locationId] = id.split('-')
30
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/home/sidebar/home_sidebar_calendar.coffee:
38 Page.onReplace(node, => @$calendar.off('click'))
39
40: _loadDateRange: ({data}) ->
41 today = moment().startOf('day')
42
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/i18n/language_editor.coffee:
85 $('.language-autosave-status.saving').toggleClass('hide', !state)
86
87: save: ({withoutSuccessFlash, successCallback} = {}) =>
88 restoreButton = disableWith $('#save-translations'), 'Saving...'
89 toggleSavingSpinner(true)
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/admin/modules/rte/mixed_content_protection.coffee:
110 operation = $.ajax '/admin/rte/https_availability.json',
111 data:
112: urls: ({'url': url.originalSrc, 'type': @resourceTagName(url) } for url in urls)
113 async: (async ? true)
114 timeout: 60 * 1000 # 60 seconds
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/online_store/design_mode/overlay.coffee:
63 reads: ->
64 [{overlapping: hasOverlappingOverlay()}]
65: writes: ({overlapping}) ->
66 container.classList.remove(ACTIVE_CLASS)
67 if overlapping
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/online_store/theme_editor/ui/panel_container.coffee:
3 createSection: '_onCreateSection'
4
5: _onCreateSection: ({id, type, cb, preset}) =>
6 params = {section_type: type, section_id: id}
7 if preset? then params.section_preset = preset
.
14 cb?(result)
15
16: _appendSectionPanel: ({panel_html}) ->
17 $panelHtml = $(panel_html)
18 @$element.append($panelHtml)
/Users/justinchan/Documents/Shopify/shopify-copy/app/assets/javascripts/online_store/theme_editor/ui/panel/section_panel.coffee:
12 if selection.sectionId == @sectionId then @open() else @close()
13
14: _onDeleteSection: ({id}) =>
15 @destroy() if id == @sectionId
16
16 matches across 14 files
Another thing to note is that this doesn't include function calls that have has literals passed in as nth parameters for n>1 so there are still more cases to consider.
Overall I would estimate that there are less than 50 cases to fix total.
from javascript.
Alright, if it's only <50 I can live with this, we can add a linting rule at some point to check for this weirdness and fix it then. Thanks for doing the detailed check!
from javascript.
Related Issues (20)
- Check on the status of fixes to the react/forbid-component-props rule HOT 1
- Babel polyfills HOT 3
- esify should not mangle class properties in shorthand hashes HOT 2
- Fix `resource_browser.coffee` transform HOT 1
- Fix `social_marketing_frame.coffee` transform HOT 2
- Fix this destructuring HOT 5
- esify silently drops inner classes HOT 1
- esify assumes foo is defined with "for x, y of foo" HOT 3
- Add a TypeScript config HOT 1
- Use babel-preset-env HOT 1
- eslint-index HOT 3
- [babel-preset-shopify] inline environment variables opt in HOT 1
- Add yarn installation instructions
- Can this be used if I want to write custom JS for my shopify theme? HOT 1
- Definition for rule 'jsx-a11y/img-has-alt' was not found HOT 3
- Consider adopting prettier HOT 9
- [Discussion] class-methods-use-this HOT 10
- Add spread rule for iterable objects
- Translating in to Spanish
- Link to 'Testing styleguide' in mian README.md is broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javascript.