소스 검색

moved to eslint

  * jshint is old, and has fallen out of favor
  * neither currently supports immed, newcap, sub as they're deprecated
  in jshint. This means you must move to jcss if you want style
  checking. I left that that excercise to someone else. Everything else
  works and the options have been ported to eslint (defaults removed).
  Eslint requires less configuration and defaults to sane and safe.
Evan Carroll 7 년 전
부모
커밋
87d4d4e911
3개의 변경된 파일22개의 추가작업 그리고 27개의 파일을 삭제
  1. 12 0
      .eslintrc.json
  2. 7 25
      Gruntfile.js
  3. 3 2
      package.json

+ 12 - 0
.eslintrc.json

@@ -0,0 +1,12 @@
+{
+	"rules": {
+		"no-use-before-define": 2,
+		"no-caller": 2,
+		"no-eq-null": 2
+	},
+	"parserOptions": { "ecmaVersion": 6 },
+	"env": {
+		"browser": true,
+		"node": true
+	}
+}

+ 7 - 25
Gruntfile.js

@@ -4,25 +4,7 @@ module.exports = function(grunt) {
   // Project configuration.
   grunt.initConfig({
     // Task configuration.
-    jshint: {
-      options: {
-        curly: true,
-        eqeqeq: true,
-        immed: true,
-        latedef: true,
-        newcap: true,
-        noarg: true,
-        sub: true,
-        undef: true,
-        unused: true,
-        boss: true,
-        eqnull: true,
-        node: true,
-        globals: {
-          jQuery: true,
-          window: true,
-        }
-      },
+    eslint: {
       gruntfile: {
         src: 'Gruntfile.js'
       },
@@ -35,22 +17,22 @@ module.exports = function(grunt) {
     },
     watch: {
       gruntfile: {
-        files: '<%= jshint.gruntfile.src %>',
-        tasks: ['jshint:gruntfile']
+        files: '<%= eslint.gruntfile.src %>',
+        tasks: ['eslint:gruntfile']
       },
       lib_test: {
-        files: '<%= jshint.lib_test.src %>',
-        tasks: ['jshint:lib_test', 'nodeunit']
+        files: '<%= eslint.lib_test.src %>',
+        tasks: ['eslint:lib_test', 'nodeunit']
       }
     }
   });
 
   // These plugins provide necessary tasks.
   grunt.loadNpmTasks('grunt-contrib-nodeunit');
-  grunt.loadNpmTasks('grunt-contrib-jshint');
+	grunt.loadNpmTasks("gruntify-eslint");
   grunt.loadNpmTasks('grunt-contrib-watch');
 
   // Default task.
-  grunt.registerTask('default', ['jshint', 'nodeunit']);
+  grunt.registerTask('default', ['eslint', 'nodeunit']);
 
 };

+ 3 - 2
package.json

@@ -29,10 +29,11 @@
     "start": "grunt default watch"
   },
   "devDependencies": {
-    "grunt": "~0.4.1",
+    "grunt": "^0.4.5",
     "grunt-cli": "~1.2.0",
+    "grunt-contrib-eslint": "~0.6.4",
     "grunt-contrib-nodeunit": "~0.2.0",
     "grunt-contrib-watch": "~0.5.3",
-    "grunt-contrib-jshint": "~0.6.4"
+    "gruntify-eslint": "^5.0.0"
   }
 }