From 44bc4a7dedf4524107cd086c331fad1797dbd30a Mon Sep 17 00:00:00 2001 From: Remco Tolsma Date: Tue, 24 Sep 2019 12:01:50 +0200 Subject: [PATCH] No longer use Grunt JSHint, switched to ESLint, just run `npm run-script eslint`. --- .eslintignore | 4 ++++ .eslintrc | 5 +++++ .travis.yml | 4 +++- Gruntfile.js | 6 ------ package.json | 6 ++++-- 5 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..34932e6e --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +/build/ +/node_modules/ +/vendor/ +/wordpress/ diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..91cd68a3 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,5 @@ +{ + "plugins": [ + "json" + ] +} diff --git a/.travis.yml b/.travis.yml index 853d4bde..72c301f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ env: jobs: include: - php: 7.3 - env: WP_VERSION=^5.1 COVERAGE=1 PHPCS=1 PHPSTAN=1 + env: WP_VERSION=^5.1 COVERAGE=1 PHPCS=1 PHPSTAN=1 ESLINT=1 - php: 7.3 env: WP_VERSION=^5.0 - php: 7.2 @@ -79,6 +79,8 @@ install: - composer show script: + # ESLint + - if [ "$ESLINT" == "1" ]; then npm run-script eslint; fi # PHPLint - composer run-script phplint # PHPUnit diff --git a/Gruntfile.js b/Gruntfile.js index b8d9fb43..b9cc826b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -175,17 +175,11 @@ module.exports = function( grunt ) { target: [ 'scss/**/*.scss' ] - }, - - // JSHint. - jshint: { - all: [ 'Gruntfile.js', 'composer.json', 'package.json' ] } } ); // Default task(s). - grunt.registerTask( 'default', [ 'jshint' ] ); grunt.registerTask( 'assets', [ 'sasslint', 'sass', 'postcss', 'copy:scripts', 'copy:assets' ] ); grunt.registerTask( 'min', [ 'uglify' ] ); diff --git a/package.json b/package.json index df006229..fac0cab0 100644 --- a/package.json +++ b/package.json @@ -41,11 +41,12 @@ "devDependencies": { "autoprefixer": "^9.6.1", "cssnano": "^4.1.10", + "eslint": "^6.4.0", + "eslint-plugin-json": "^1.4.0", "grunt": "^1.0.4", "grunt-contrib-clean": "^2.0.0", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-imagemin": "^3.1.0", - "grunt-contrib-jshint": "^2.1.0", "grunt-contrib-sass": "^1.0.0", "grunt-contrib-uglify": "^4.0.1", "grunt-postcss": "^0.9.0", @@ -61,6 +62,7 @@ "build-image-svg-wp-admin": "svgo images/src/pronamic-pay-wp-admin-fresh-base.svg -o images/dist/pronamic-pay-wp-admin-fresh-base.svgo-min.svg", "build-image-png-512": "rsvg-convert -w 512 -h 512 images/src/pronamic-pay.svg -o images/src/pronamic-pay-512.png", "build-image-png-512-min": "pngquant images/src/pronamic-pay-512.png --output images/dist/pronamic-pay-512.pngquant-min.png --force", - "build-image-ico": "icon-gen --input images/src/pronamic-pay.svg --output images/dist --ico name=pronamic-pay --icns name=pronamic-pay -r" + "build-image-ico": "icon-gen --input images/src/pronamic-pay.svg --output images/dist --ico name=pronamic-pay --icns name=pronamic-pay -r", + "eslint": "eslint . --ext .json --ext .js" } }