bbc / Imager.js

Responsive images while we wait for srcset to finish cooking
Apache License 2.0
3.84k stars 224 forks source link

Camel Case new_collection #119

Closed marhalpert closed 9 years ago

marhalpert commented 9 years ago

When I run fixmyjs on imager.js this is what I get:

function applyEach(collection, callbackEach) { var i = 0, length = collection.length, newCollection = []; for (; i < length; i++) { new_collection[i] = callbackEach(collection[i], i); } return newCollection; }

Uncaught ReferenceError: new_collection is not defined

thom4parisot commented 9 years ago

Hello @marhalpert, I suppose it happens because camelcase option is enabled.

Is there any reason why you run fixmyjs against Imager? The project is already linted against jshint.

marhalpert commented 9 years ago

Hi @oncletom. So we are concatenating all the javascript plugins in to a single vendor.js file and some of the plugins are missing a semicolon (bootstrap) so that is why we are fixmyjs the vendor.js file that includes Imager.js.

thom4parisot commented 9 years ago

I agree for a missing semicolon as it breaks code… but this proposal is about a naming convention change, internal to Imager and without side-effect on your project.

Naming convention/codestyle should be enforced on your code only, not vendors one.