From 922c1968ca83ed484e7b77337af5008f809fc49d Mon Sep 17 00:00:00 2001 From: hacksalot Date: Mon, 12 Feb 2018 03:34:55 -0500 Subject: [PATCH] chore: add build-time eslint support --- .eslintrc.yml | 17 +++++++++++++++++ Gruntfile.js | 53 +++++++++------------------------------------------ package.json | 2 +- 3 files changed, 27 insertions(+), 45 deletions(-) create mode 100644 .eslintrc.yml diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 0000000..330ddcc --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,17 @@ +env: + es6: true + node: true +extends: 'eslint:recommended' +rules: + # indent: + # - error + # - 4 + linebreak-style: + - error + - unix + quotes: + - error + - single + semi: + - error + - always diff --git a/Gruntfile.js b/Gruntfile.js index f230908..8506b81 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -39,42 +39,13 @@ module.exports = function (grunt) { all: { src: ['test/*.js'] } }, - // jsdoc : { - // dist : { - // src: ['src/**/*.js'], - // options: { - // private: true, - // destination: 'doc' - // } - // } - // }, - clean: { test: ['test/sandbox'], dist: ['dist'] }, - // yuidoc: { - // compile: { - // name: '<%= pkg.name %>', - // description: '<%= pkg.description %>', - // version: '<%= pkg.version %>', - // url: '<%= pkg.homepage %>', - // options: { - // paths: 'src/', - // outdir: 'docs/' - // } - // } - // }, - - jshint: { - options: { - laxcomma: true, - expr: true, - eqnull: true, - esversion: 6 - }, - all: ['Gruntfile.js', 'dist/cli/**/*.js', 'test/*.js'] + eslint: { + target: ['Gruntfile.js', 'dist/cli/**/*.js', 'test/*.js'] } }; @@ -83,28 +54,22 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-coffee'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-simple-mocha'); - //grunt.loadNpmTasks('grunt-contrib-yuidoc'); - //grunt.loadNpmTasks('grunt-jsdoc'); - grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-eslint'); grunt.loadNpmTasks('grunt-contrib-clean'); // Use 'grunt test' for local testing grunt.registerTask('test', 'Test the HackMyResume application.', function( config ) { - grunt.task.run(['clean:test','build',/*'jshint',*/'simplemocha:all']); - }); - - // Use 'grunt document' to build docs - // grunt.registerTask('document', 'Generate HackMyResume documentation.', - // function( config ) { - // grunt.task.run( ['jsdoc'] ); - // }); + grunt.task.run(['clean:test','build','eslint','simplemocha:all']); + } + ); // Use 'grunt build' to build HMR grunt.registerTask('build', 'Build the HackMyResume application.', function( config ) { - grunt.task.run( ['clean:dist','copy','coffee'] ); - }); + grunt.task.run( ['clean:dist','copy','coffee','eslint'] ); + } + ); // Default task does everything grunt.registerTask('default', [ 'test', 'document' ]); diff --git a/package.json b/package.json index 568de57..c5309f3 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "grunt-contrib-clean": "^1.1.0", "grunt-contrib-coffee": "^2.0.0", "grunt-contrib-copy": "^1.0.0", - "grunt-contrib-jshint": "^1.1.0", + "grunt-eslint": "^20.1.0", "grunt-simple-mocha": "*", "jsonresume-theme-boilerplate": "^0.1.2", "jsonresume-theme-classy": "^1.0.9",