Generated Components require a JSHint global definition for the top-level namespace #59

Closed
js1972 opened this Issue Feb 25, 2014 · 2 comments

2 participants

@js1972
Collaborator

i.e. If we generate a component inside our app with namespace foo.bar.mycomponent then JSHint will complain about the generated Component.js file that foo is not defined. Adding /*global foo*/ to the top of the file fixes this.

Should we ensure that generated files are all JSHint error free?

This issue applies to all generators - even the app generator. It just happens that we have sap defined as a global in .jshintrc which hides the error if you select the default namesace (sap.ui.demo) on your app.

@js1972 js1972 self-assigned this Feb 25, 2014
@saschakiefer saschakiefer added this to the 0.2.2 milestone Feb 25, 2014
@saschakiefer

👍
I think that makes sense, but also depends a bit on how complex this might become...

@saschakiefer saschakiefer removed the question label Feb 25, 2014
@js1972
Collaborator
@js1972 js1972 added a commit to js1972/generator-openui5 that referenced this issue Feb 26, 2014
@js1972 js1972 fix(sub generators): Add jshint global declaration for namespace in n…
…ew components.

When a uiComponent or facelessComponent is generated a namespace is prefixed.
JSHint will compain about the top-level object name in the namespace being
 undefined so we add it as a global:
 e.g. foo.bar.myComponent => add /*global foo*/ to top of file.

Fixes #59
cd9b039
@js1972 js1972 closed this Feb 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment