saschakiefer / generator-openui5

yeoman generator for OpenUI5 applications and assets
Other
64 stars 17 forks source link

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

Closed js1972 closed 10 years ago

js1972 commented 10 years ago

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.

saschakiefer commented 10 years ago

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

js1972 commented 10 years ago

Not complex to implement. Just need to add a global declaration to the top of each component file for the top-level namespace.

Eg. For component foo.bar.mycomponent I'd add a global declaration for foo. 

There does however become a trade off between the warnings provided by JSHint and the complexity requires to hide them for no benefit to your code base...

On Tue, Feb 25, 2014 at 11:27 PM, saschakiefer notifications@github.com wrote:

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

Reply to this email directly or view it on GitHub: https://github.com/saschakiefer/generator-openui5/issues/59#issuecomment-36018899