Grunt : add JSHint

This commit is contained in:
stephenbe
2015-07-02 16:36:30 -04:00
parent b42664ad3f
commit 14fd6940cf
8 changed files with 61 additions and 38 deletions

View File

@@ -41,11 +41,13 @@ module.exports = function(grunt) {
grunt.registerTask('c', [
'csscomb'
]);
grunt.registerTask('j', [
'jshint'
]);
grunt.registerTask('wlint', [
// PHP
'phplint',
'jsonlint',
// Utilities
'watch'
]);

View File

@@ -4,42 +4,41 @@ var app = window.app || {};
// Initialize app
app.init = function(){
'use strict';
'use strict';
var self = this;
var self = this;
self.params = {
self.params = {
};
};
self.elements = {
html : document.documentElement,
body : document.body
};
self.elements = {
html : document.documentElement,
body : document.body
};
// Init as empty and / or build
self.templates = self.templates || {};
// Init as empty and / or build
self.templates = self.templates || {};
/* Template scripts pseudo loader
========================================================================== */
/* Template scripts pseudo loader
========================================================================== */
// Identify the template we're using
self.params.current_template = self.elements.body.getAttribute('data-template');
// Identify the template we're using
self.params.current_template = self.elements.body.getAttribute('data-template');
// Run the template script only if it's found
if( typeof self.templates[ self.params.current_template ] === 'object' ){
self.templates[ self.params.current_template ].init();
}
/* Execute global site scripts
========================================================================== */
if( typeof self.Globals === 'object' ){
self.Globals.init();
}
// Run the template script only if it's found
if( typeof self.templates[ self.params.current_template ] === 'object' ){
self.templates[ self.params.current_template ].init();
}
/* Execute global site scripts
========================================================================== */
if( typeof self.Globals === 'object' ){
self.Globals.init();
}
};
// On doc ready, init your app
$(function(){
app.init();
});
app.init();
});

View File

@@ -6,17 +6,14 @@ app.Globals = {
'use strict';
var self = this;
//var self = this;
/* Site wide binds go here
========================================================================== */
if( $('.js-boilerplate-toggle').length ){
$('.js-boilerplate-toggle').on('click',function(event) {
// toggle toggle
});
}
$('.js-boilerplate-toggle').on('click',function() {
// toggle toggle
});
/* When all content has loaded, not just DOM
========================================================================== */
@@ -26,4 +23,4 @@ app.Globals = {
}
};
};

View File

@@ -11,7 +11,6 @@ app.templates.generic = {
init:function(){
// Template specific code
}
};
};

View File

@@ -0,0 +1,19 @@
module.exports = {
options: {
"curly":true,
"eqeqeq": true,
"eqnull": true,
"undef":true,
"unused": true,
browser:true,
"globals":{
"window":true,
"$":true,
"jQuery":true
}
},
src: [
'assets/scripts/src/**/*.js',
'!assets/scripts/src/vendors/**/*.js'
],
}

View File

@@ -11,6 +11,12 @@ module.exports = {
message: 'Sass compiled to CSS.'
}
},
jshint: {
options: {
// title: '<%= pkg.title %>',
message: 'Sass compiled to CSS.'
}
},
concat: {
options: {
// title: '<%= pkg.title %>',
@@ -23,4 +29,4 @@ module.exports = {
message: 'SVG is now concatenated'
}
}
}
}

View File

@@ -13,6 +13,7 @@
"grunt-browser-sync": "0.0.0",
"grunt-contrib-concat": "0.0.0",
"grunt-contrib-cssmin": "0.0.0",
"grunt-contrib-jshint": "0.0.0",
"grunt-contrib-uglify": "0.0.0",
"grunt-contrib-watch": "0.0.0",
"grunt-csscomb": "0.0.0",