8
0

jshint.js 798 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* global module */
  2. /* global require */
  3. 'use strict';
  4. var tools = require( './res/tools' );
  5. module.exports = function( grunt ) {
  6. // Base task configuration, targetting "all" by default.
  7. var config = {
  8. all: [ '**/*.js' ],
  9. options: defaultConfig
  10. };
  11. var isGitTask = ( grunt.cli.tasks.indexOf( 'jshint:git' ) > -1 ),
  12. isDefaultTask = ( grunt.cli.tasks.indexOf( 'default' ) > -1 ) || !grunt.cli.tasks.length;
  13. // Create the :git configuration on the fly, if necessary.
  14. if ( isGitTask || isDefaultTask ) {
  15. delete config.all;
  16. config.git = tools.getGitDirtyFiles();
  17. }
  18. // Merge with configurations set in gruntfile.js.
  19. grunt.config.merge( {
  20. jshint: config
  21. } );
  22. grunt.loadNpmTasks( 'grunt-contrib-jshint' );
  23. };
  24. var defaultConfig = {
  25. 'globalstrict': true,
  26. 'validthis': true
  27. };