Skip to content
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

Newly added single line comment breaks syntax of sap.ui.define call #29

Closed
codeworrior opened this issue Jul 15, 2019 · 1 comment · Fixed by #225
Closed

Newly added single line comment breaks syntax of sap.ui.define call #29

codeworrior opened this issue Jul 15, 2019 · 1 comment · Fixed by #225
Assignees
Labels
bug Something isn't working

Comments

@codeworrior
Copy link
Member

While working on SAP/openui5@c782ce9 , I encountered the following issue with the ui5-migration tooling:

A missing dependency to a jQuery plugin was added with an explaining comment, but the single line comment preceded the dependency and the closing bracket and comma, which broke the syntax of the source.

Before

sap.ui.define(["./library", 'sap/ui/core/Core', "...
..., "sap/ui/events/KeyCodes"],
	function(library, Core, Item, Icon, ...

After

sap.ui.define(["./library", 'sap/ui/core/Core', ...
..., "sap/ui/core/library",
    // jQuery Plugin "addAriaLabelledBy" "sap/ui/dom/jquery/Aria"],
	function(library, Core, Item, Icon, ...

To reproduce, you can execute the following commands

cd openui5
git checkout 6555a38
ui5-migration migrate src/sap.tnt/src/sap/tnt/NavigationListItem.js
@tobiasso85
Copy link
Contributor

tobiasso85 commented Apr 7, 2022

Created smaller sample:

ui5-migration migrate tmp/a.js --task=fix-jquery-plugin-imports

before migration:

sap.ui.define(["./library", 'sap/ui/core/Core', "sap/ui/core/Item", 'sap/ui/core/Icon', 'sap/ui/core/IconPool'],
	function(library, Core, Item, Icon, IconPool) {
		"use strict";

		return $a.addAriaLabelledBy("");
	});

after migration:

sap.ui.define(["./library", 'sap/ui/core/Core', "sap/ui/core/Item", 'sap/ui/core/Icon', 'sap/ui/core/IconPool',
    // jQuery Plugin "addAriaLabelledBy" "sap/ui/dom/jquery/Aria"
],
	function(library, Core, Item, Icon, IconPool) {
		"use strict";

		// jQuery Plugin "addAriaLabelledBy"
		return $a.addAriaLabelledBy("");
	});

tobiasso85 added a commit that referenced this issue Apr 7, 2022
jquery plugin imports are added as dependency
with a comment.
This comment was a line comment which could break
the code during re-formatting. Therefore the
comment was changed to a block comment which cannot
break the code during re-formatting.

Fixes: #29
tobiasso85 added a commit that referenced this issue Aug 12, 2022
jquery plugin imports are added as dependency
with a comment.
This comment was a line comment which could break
the code during re-formatting. Therefore the
comment was changed to a block comment which cannot
break the code during re-formatting.

Fixes: #29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants