Skip to content
This repository has been archived by the owner on Mar 2, 2019. It is now read-only.

Added JSCS & JSHint with Travis CI config #317

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,6 +2,7 @@
/.sass-cache/
dist
node_modules/
.idea/

This comment was marked as abuse.

/tmp/
.DS_Store
npm-debug.log
Expand Down
37 changes: 37 additions & 0 deletions .jscsrc
@@ -0,0 +1,37 @@
{
"excludeFiles": ["node_modules/**", "bower_components/**"],
"validateIndentation": 2,
"disallowMixedSpacesAndTabs": true,
"disallowMultipleSpaces":true,
"requireSemicolons":true,
"requireSpaceAfterLineComment":true,
"disallowTrailingComma":true,
"requireMultipleVarDecl":true,
"disallowSpaceAfterPrefixUnaryOperators":["++", "--", "+", "-", "~", "!"],
"requireLineFeedAtFileEnd":true,
"validateParameterSeparator":", ",
"requireSpaceAfterBinaryOperators":["="],
"requireSpaceBeforeBinaryOperators":["="],
"requireSpacesInsideParentheses":"all",
"requireSpacesInsideArrayBrackets": "all",
"disallowSpaceBeforeBinaryOperators":[","],
"requireSpacesInAnonymousFunctionExpression":{
"beforeOpeningCurlyBrace": true
},
"requireSpacesInCallExpression":true,
"requireSpacesInConditionalExpression":true,
"requireSpacesInForStatement":true,
"requireSpacesInFunctionDeclaration":{
"beforeOpeningCurlyBrace": true
},
"requireSpacesInFunctionExpression":{
"beforeOpeningCurlyBrace": true
},
"requireSpacesInFunction":{
"beforeOpeningCurlyBrace": true
},
"requireSpacesInNamedFunctionExpression":{
"beforeOpeningCurlyBrace": true
},
"requireDollarBeforejQueryAssignment":true

This comment was marked as abuse.

}
11 changes: 11 additions & 0 deletions .jshintrc
@@ -0,0 +1,11 @@
{
"bitwise": true,
"curly": true,
"eqeqeq": true,
"freeze": true,
"quotmark": "single",

This comment was marked as abuse.

"undef": true,
"unused": true,
"strict": false,
"validthis": false
}
7 changes: 7 additions & 0 deletions .travis.yml
@@ -0,0 +1,7 @@
language: node_js
node_js:
- "0.12.4"

This comment was marked as abuse.

before_install:
- npm install -g grunt-cli bower
- bower install

This comment was marked as abuse.

script: grunt quality

This comment was marked as abuse.

97 changes: 54 additions & 43 deletions Gruntfile.js
@@ -1,11 +1,11 @@
module.exports = function(grunt) {
module.exports = function ( grunt ) {

// Load NPM Tasks
// https://github.com/shootaroo/jit-grunt
require('jit-grunt')(grunt);
require ( 'jit-grunt' ) ( grunt );

This comment was marked as abuse.


grunt.initConfig({
pkg: grunt.file.readJSON( 'package.json' ),
grunt.initConfig ( {
pkg: grunt.file.readJSON ( 'package.json' ),

// Copied from Bootstrap
banner: '/*!\n' +
Expand All @@ -20,23 +20,23 @@ module.exports = function(grunt) {
main: {
options: {
reportUpdated: false, // Report updated dependencies: 'false' | 'true'
updateType : "force" // 'force'|'report'|'prompt'
updateType: 'force' // 'force'|'report'|'prompt'
}
}
},

watch: {
scss: {
files: ['scss/**/*.scss'],
files: [ 'scss/**/*.scss' ],
tasks: 'scss'
},
html: {
files: ['src/**/*.hbs'],
files: [ 'src/**/*.hbs' ],
tasks: 'html'
},
js: {
files: ['js/**/*.js'],
tasks: 'js'
files: [ 'js/**/*.js' ],
tasks: [ 'jshint','jscs','js' ]
},
livereload: {
options: {
Expand All @@ -54,15 +54,15 @@ module.exports = function(grunt) {
build: {
files : [
{
src : ['**/*.scss', '!**/_*.scss'],
cwd : 'scss',
dest : 'css',
ext : '.css',
expand : true
src: [ '**/*.scss', '!**/_*.scss' ],
cwd: 'scss',
dest: 'css',
ext: '.css',
expand: true
}
],
options : {
style : 'expanded'
options: {
style: 'expanded'
}
}
},
Expand All @@ -71,14 +71,14 @@ module.exports = function(grunt) {
autoprefixer: {
build: {
options: {
browsers: ['last 2 versions', '> 1%']
browsers: [ 'last 2 versions', '> 1%' ]
},
files: [
{
src : ['**/*.css'],
cwd : 'css',
dest : 'css',
expand : true
src: [ '**/*.css' ],
cwd: 'css',
dest: 'css',
expand: true
}
]
}
Expand All @@ -90,7 +90,7 @@ module.exports = function(grunt) {
port: 9001,
protocol: 'http',
hostname: 'localhost',
base: './dist/', // '.' operates from the root of your Gruntfile, otherwise -> 'Users/user-name/www-directory/website-directory'
base: './dist/',// '.' operates from the root of your Gruntfile, otherwise -> 'Users/user-name/www-directory/website-directory'
keepalive: false, // set to false to work side by side w/watch task.
livereload: true,
open: true
Expand All @@ -104,37 +104,37 @@ module.exports = function(grunt) {
layout: 'layout.hbs',
layoutdir: 'src/templates/layouts',
assets: 'dist/assets',
partials: ['src/templates/pages/*.hbs', 'src/templates/parts/*.hbs']
partials: [ 'src/templates/pages/*.hbs', 'src/templates/parts/*.hbs' ]
},
demo: {
options: {
data: ['src/data/*.{json,yml}']
data: [ 'src/data/*.{json,yml}' ]
},
files: {
'dist/': ['src/templates/pages/*.hbs']
'dist/': [ 'src/templates/pages/*.hbs' ]
}
}
},

copy: {
demo: {
files: [
{ expand: true, cwd: './css', src: ['./**/*.*'], dest: 'dist/assets/css' },
{ expand: true, cwd: './js', src: ['./**/*.*'], dest: 'dist/assets/js' },
{ expand: true, flatten: true, cwd: './bower_components/jQuery', src:['./dist/*.min.*'], dest: 'dist/assets/js/libs/' },
{ expand: true, flatten: true, cwd: './bower_components/modernizr', src:['./modernizr.js'], dest: 'dist/assets/js/libs/' }
{ expand: true, cwd: './css', src: [ './**/*.*' ], dest: 'dist/assets/css' },
{ expand: true, cwd: './js', src: [ './**/*.*' ], dest: 'dist/assets/js' },
{ expand: true, flatten: true, cwd: './bower_components/jQuery', src:[ './dist/*.min.*' ], dest: 'dist/assets/js/libs/' },
{ expand: true, flatten: true, cwd: './bower_components/modernizr', src:[ './modernizr.js' ], dest: 'dist/assets/js/libs/' }
]
},
css: {
files: [
{ expand: true, cwd: './css', src: ['./**/*.*'], dest: 'dist/assets/css' }
{ expand: true, cwd: './css', src: [ './**/*.*' ], dest: 'dist/assets/css' }
]
},
js: {
files: [
{ expand: true, flatten: true, cwd: './bower_components/jQuery', src: ['./dist/*.min.*'], dest: 'dist/assets/js/libs/' },
{ expand: true, flatten: true, cwd: './bower_components/modernizr', src: ['./modernizr.js'], dest: 'dist/assets/js/libs/' },
{ expand: true, cwd: './js', src: ['./**/*.*'], dest: 'dist/assets/js' }
{ expand: true, flatten: true, cwd: './bower_components/jQuery', src: [ './dist/*.min.*' ], dest: 'dist/assets/js/libs/' },
{ expand: true, flatten: true, cwd: './bower_components/modernizr', src: [ './modernizr.js' ], dest: 'dist/assets/js/libs/' },
{ expand: true, cwd: './js', src: [ './**/*.*' ], dest: 'dist/assets/js' }
]
}
},
Expand Down Expand Up @@ -176,18 +176,29 @@ module.exports = function(grunt) {
base: 'dist',
repo: 'https://github.com/h5bp/Effeckt.css'
},
src: ['**/*']
src: [ '**/*' ]
}
}
},

jshint: {
demo:[ 'js/demo/*.js' ],
modules:[ 'js/modules/*.js' ],
all:[ 'js/**/*.js' ]
},
jscs: {
demo:[ 'js/demo/*.js' ],
modules:[ 'js/modules/*.js' ],
all:[ 'js/**/*.js' ]

This comment was marked as abuse.

}
});

grunt.registerTask('update', ['devUpdate']);
grunt.registerTask('default', ['sass', 'autoprefixer', 'assemble', 'copy']);
grunt.registerTask('scss', ['sass', 'autoprefixer', 'copy:css']);
grunt.registerTask('html', ['assemble']);
grunt.registerTask('js', ['copy:js', 'concat']);
grunt.registerTask('dev', ['connect', 'watch']);
grunt.registerTask('demo', ['copy:demo', 'assemble:demo']);
grunt.registerTask('deploy', ['gh-pages:remote']);
grunt.registerTask( 'update', [ 'devUpdate' ] );
grunt.registerTask( 'default', [ 'sass', 'autoprefixer', 'assemble', 'copy' ] );
grunt.registerTask( 'scss', [ 'sass', 'autoprefixer', 'copy:css' ] );
grunt.registerTask( 'html', [ 'assemble' ] );
grunt.registerTask( 'js', [ 'copy:js', 'concat' ] );
grunt.registerTask( 'dev', [ 'connect', 'watch' ] );
grunt.registerTask( 'demo', [ 'copy:demo', 'assemble:demo' ] );
grunt.registerTask( 'deploy', [ 'gh-pages:remote' ] );
grunt.registerTask( 'quality', [ 'jshint:all','jscs:all' ] );
};
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -9,13 +9,15 @@
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-connect": "^0.8.0",
"grunt-contrib-copy": "^0.6.0",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-watch": "^0.6.1",
"grunt-dev-update": "^0.9.0",
"grunt-gh-pages": "^0.9.1",
"grunt-jscs": "^1.8.0",
"grunt-sass": "^0.14.2",
"jit-grunt": "^0.8.0"
},
"engines": {
"node": ">=0.10"
"node": ">=0.12.4"

This comment was marked as abuse.

}
}