Skip to content

Commit

Permalink
added .jshintrc
Browse files Browse the repository at this point in the history
updated JSHint rules
added jsbeautifier grunt task
  • Loading branch information
cmaurer committed Jan 22, 2014
1 parent 092afb3 commit 0ffb6e3
Show file tree
Hide file tree
Showing 12 changed files with 6,274 additions and 5,916 deletions.
25 changes: 25 additions & 0 deletions .jshintrc
@@ -0,0 +1,25 @@
{
"camelcase" : true,
"indent": 2,
"undef": true,
"quotmark": "single",
"trailing": true,
"curly": true,
"browser": true,
"esnext": true,
"bitwise": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"regexp": true,
"unused": "vars",
"strict": true,
"smarttabs": true,
"predef": [
"angular",
"d3",
"nv"
]
}
178 changes: 85 additions & 93 deletions Gruntfile.js
@@ -1,100 +1,92 @@
/*global module:false*/
module.exports = function (grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= pkg.license %> */\n',
// Task configuration.
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
js: {
src: ['src/**/intro.js', 'src/**/legendDirectives.js', 'src/**/nvD3LegendConfiguration.js', 'src/**/nvD3Events.js', 'src/**/nvD3AxisConfiguration.js', 'src/**/nvd3Directives.js', 'src/**/outro.js'],
dest: 'dist/<%= pkg.name %>.js'
}
},
clean: ['dist/'],
jshint: {
options: {
jshintrc: true
},
afterconcat: ['dist/angularjs-nvd3-directives.js'],
gruntfile: {
src: 'Gruntfile.js'
}
},
jsbeautifier : {
files : ['dist/angularjs-nvd3-directives.js'],
options : {
js: {
evalCode: true,
indentSize: 2,
indentChar: ' ',
spaceInParen: true,
jslintHappy: true,
indentLevel: 0
}
}
},
copy: {
main: {
files: [
{src: ['build/components/angular/angular.js'], dest: 'examples/js/angular.js', filter: 'isFile'},
{src: ['build/components/d3/d3.js'], dest: 'examples/js/d3.js', filter: 'isFile'},
{src: ['build/components/nvd3/nv.d3.js'], dest: 'examples/js/nv.d3.js', filter: 'isFile'},
{src: ['build/components/nvd3/nv.d3.css'], dest: 'examples/stylesheets/nv.d3.css', filter: 'isFile'},
{src: ['build/components/moment/moment.js'], dest: 'examples/js/moment.js', filter: 'isFile'}
]
}
},
bower: {
install: {
options: {
targetDir: './build/components',
layout: 'byComponent',
cleanTargetDir: true,
cleanBowerDir: false,
verbose: true
}
}
},
changelog: {
options: {
version: 'v0.0.5-beta'
}
}
});

// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= pkg.license %> */\n',
// Task configuration.
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
js: {
src: ['src/**/intro.js', 'src/**/legendDirectives.js', 'src/**/nvD3LegendConfiguration.js', 'src/**/nvD3Events.js', 'src/**/nvD3AxisConfiguration.js', 'src/**/nvd3Directives.js', 'src/**/outro.js'],
dest: 'dist/<%= pkg.name %>.js'
}
},
clean: ["dist/"],
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
unused: true,
boss: true,
eqnull: true,
browser: true,
globals: {"angular": false, "nv": false, "d3": false, "configureYaxis": false, "configureXaxis": false}
},
afterconcat: ['dist/angularjs-nvd3-directives.js'],
gruntfile: {
src: 'Gruntfile.js'
}
},
copy: {
main: {
files: [
{src: ['build/components/angular/angular.js'], dest: 'examples/js/angular.js', filter: 'isFile'},
{src: ['build/components/d3/d3.js'], dest: 'examples/js/d3.js', filter: 'isFile'},
{src: ['build/components/nvd3/nv.d3.js'], dest: 'examples/js/nv.d3.js', filter: 'isFile'},
{src: ['build/components/nvd3/nv.d3.css'], dest: 'examples/stylesheets/nv.d3.css', filter: 'isFile'},
{src: ['build/components/moment/moment.js'], dest: 'examples/js/moment.js', filter: 'isFile'}
]
}
},
bower: {
install: {
options:{
targetDir: './build/components',
layout: 'byComponent',
cleanTargetDir: true,
cleanBowerDir: false,
verbose: true
}
}
},
changelog: {
options: {
version: 'v0.0.5-beta'
}
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
lib_test: {
files: '<%= jshint.lib_test.src %>',
tasks: ['jshint:lib_test', 'qunit']
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-bower-task');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-karma-coveralls');
grunt.loadNpmTasks('grunt-conventional-changelog');
grunt.loadNpmTasks('grunt-jsbeautifier');

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-bower-task');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-karma-coveralls');
grunt.loadNpmTasks('grunt-conventional-changelog');
grunt.registerTask('bower', ['bower:install']);

grunt.registerTask('bower', ['bower:install']);

// Default task.
grunt.registerTask('default', ['clean', 'concat', 'jshint']);
// Default task.
grunt.registerTask('default', ['clean', 'concat', 'jsbeautifier', 'jshint']);

};

0 comments on commit 0ffb6e3

Please sign in to comment.