Hi there,
I just wondered how everyone else had been getting along with ingesting extra javascript into there main.js file via watch and build tasks and jshint.
Because from where I am a the moment it’s been a real fight. Scripts that I routinely built minified with Roots and Grunt seem to output a large number of warnings and fail to build.
For example if I add the Velocity.js via bower Velocity.js
(adding it to my manifest.json)
{
“dependencies”: {
“main.js”: {
“files”: [
“…/bower_components/velocity/velocity.js”,
“scripts/main.js”
],
“main”: true
I get the following output.
/srv/users/serverpilot/apps/cmd/web/app/themes/sage/bower_components/velocity/velocity.js
line 162 col 20 'id' is already defined.
line 349 col 34 'offsetParent' is already defined.
line 351 col 41 Confusing use of '!'.
line 360 col 30 'offsetParent' is already defined.
line 677 col 6 Unnecessary semicolon.
line 725 col 22 Missing 'new' prefix when invoking a constructor.
line 725 col 57 Missing 'new' prefix when invoking a constructor.
line 729 col 26 Missing 'new' prefix when invoking a constructor.
line 729 col 71 Missing 'new' prefix when invoking a constructor.
line 736 col 43 Expected '{' and instead saw 'return'.
line 784 col 37 Use '===' to compare with '0.0'.
line 795 col 43 Expected '{' and instead saw 'calcSampleValues'.
line 799 col 32 Expected '{' and instead saw 'precompute'.
line 800 col 45 Expected '{' and instead saw 'return'.
line 801 col 27 Expected '{' and instead saw 'return'.
line 802 col 27 Expected '{' and instead saw 'return'.
line 898 col 130 Unexpected use of '|'.
line 1083 col 32 'i' is already defined.
line 1309 col 21 Confusing use of '!'.
line 1329 col 41 Missing 'new' prefix when invoking a constructor.
line 1329 col 72 Missing 'new' prefix when invoking a constructor.
line 1335 col 48 Missing 'new' prefix when invoking a constructor.
line 1336 col 37 Expected a 'break' statement before 'case'.
line 1354 col 77 Missing 'new' prefix when invoking a constructor.
line 1370 col 41 Missing 'new' prefix when invoking a constructor.
line 1374 col 44 Missing 'new' prefix when invoking a constructor.
line 1377 col 22 Don't make functions within a loop.
line 1386 col 28 'i' is already defined.
line 1437 col 41 Confusing use of '!'.
line 1458 col 22 Don't make functions within a loop.
line 1549 col 31 Use '===' to compare with '0'.
line 1639 col 21 Function declarations should not be placed in blocks. Use a function expression or move the statement to the top of the outer function.
line 1663 col 25 Missing 'new' prefix when invoking a constructor.
line 1666 col 33 Missing 'new' prefix when invoking a constructor.
line 1667 col 41 Missing 'new' prefix when invoking a constructor.
line 1670 col 41 Missing 'new' prefix when invoking a constructor.
line 1772 col 21 Missing 'new' prefix when invoking a constructor.
line 1772 col 38 Missing 'new' prefix when invoking a constructor.
line 1797 col 38 Expected '{' and instead saw 'console'.
line 1828 col 37 Missing 'new' prefix when invoking a constructor.
line 1856 col 63 Expected '{' and instead saw 'console'.
line 1859 col 32 Missing 'new' prefix when invoking a constructor.
line 1859 col 49 Missing 'new' prefix when invoking a constructor.
line 1867 col 46 Expected '{' and instead saw 'console'.
line 1882 col 83 Missing 'new' prefix when invoking a constructor.
line 1885 col 17 Function declarations should not be placed in blocks. Use a function expression or move the statement to the top of the outer function.
line 1904 col 24 Missing 'new' prefix when invoking a constructor.
line 1930 col 24 Missing 'new' prefix when invoking a constructor.
line 1931 col 38 Missing 'new' prefix when invoking a constructor.
line 1963 col 13 It's not necessary to initialize 'value' to 'undefined'.
line 1963 col 13 Too many errors. (50% scanned).
✖ 1 error
⚠ 50 warnings
[06:46:11] 'jshint' errored after 4.49 s
[06:46:11] Error in plugin 'gulp-jshint'
Message:
JSHint failed for: /srv/users/serverpilot/apps/cmd/web/app/themes/sage/bower_components/velocity/velocity.js
Am I doing something wrong? Or is jhint just harsh.