kidoOooOoooOOom

ゲーム開発やってます

gruntでjshintとjscsのlintをタスク化

jshintのチェックルールを.jshintrcに、jscsのチェックルールを .jscsrc とかで用意しておき、下記をGruntfile.js に追加する。

  grunt.initConfig({
    jshint: {
      files: [
        'lib/**/*.js',
        'test/**/*.js',
        '*.js',
      ],
      options: {
        jshintrc: '.jshintrc'
      }
    },
    jscs: {
      src: [
        '*.js',
        './**/*.js'
      ],
      options: {
        config: ".jscsrc",
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks("grunt-jscs");

  grunt.registerTask('lint', ['jshint', 'jscs']);

これで grunt lint を実行すれば OK.