From ae85f2ac6bd47a9c8fd8c95ad58c1d1afdec781c Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Wed, 18 Jan 2017 12:52:44 +0000 Subject: [PATCH] Replace jshint/jscs with eslint and add stylelint Change-Id: I9c33c65c913d891739b913d5363abba66c2cd0dd --- .eslintrc.json | 10 ++++++++++ .jscsrc | 3 --- .jshintignore | 2 -- .jshintrc | 7 ------- .stylelintrc | 3 +++ .../ext.confirmEdit.fancyCaptcha.css | 17 +++++++++-------- .../resources/ext.confirmEdit.fancyCaptcha.js | 2 +- Gruntfile.js | 19 +++++++++++-------- maintenance/GenerateFancyCaptchas.php | 2 +- package.json | 14 +++++++------- ...irmEdit.editPreview.ipwhitelist.styles.css | 4 ++-- 11 files changed, 44 insertions(+), 39 deletions(-) create mode 100644 .eslintrc.json delete mode 100644 .jscsrc delete mode 100644 .jshintignore delete mode 100644 .jshintrc create mode 100644 .stylelintrc diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..48432407d --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,10 @@ +{ + "extends": "wikimedia", + "env": { + "browser": true, + "jquery": true + }, + "globals": { + "mediaWiki": false + } +} diff --git a/.jscsrc b/.jscsrc deleted file mode 100644 index 9d22e3f24..000000000 --- a/.jscsrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "preset": "wikimedia" -} diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 82eaa05db..000000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/** -vendor/** diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index e1c2afe8a..000000000 --- a/.jshintrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "globals": { - "mediaWiki": true, - "jQuery": true - } -} - diff --git a/.stylelintrc b/.stylelintrc new file mode 100644 index 000000000..2c9073020 --- /dev/null +++ b/.stylelintrc @@ -0,0 +1,3 @@ +{ + "extends": "stylelint-config-wikimedia" +} diff --git a/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.css b/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.css index 96e4dd6a8..3be893382 100644 --- a/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.css +++ b/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.css @@ -1,6 +1,6 @@ .fancycaptcha-wrapper { display: table; - background-color: #FFF; + background-color: #fff; } /* Prevents the size of the container from changing, affecting page @@ -11,27 +11,28 @@ layout, for normal CAPTCHA sizes. */ display: inline-block; } -.client-nojs .fancycaptcha-reload { - display: none; -} - .fancycaptcha-reload { /* @embed */ - background: url(images/fancycaptcha-reload-icon.png) no-repeat scroll left center transparent; + background: url( images/fancycaptcha-reload-icon.png ) no-repeat scroll left center transparent; margin: 0 0 0 3px; padding: 1px 2px 1px 12px; - color: #0645AD; + color: #0645ad; cursor: pointer; cursor: hand; } +.client-nojs .fancycaptcha-reload { + display: none; +} + .fancycaptcha-reload:hover { text-decoration: underline; } + .fancycaptcha-reload-loading { /* @embed */ - background: url(images/ajax-loader-10x10.gif) no-repeat scroll left center transparent; + background: url( images/ajax-loader-10x10.gif ) no-repeat scroll left center transparent; } .fancycaptcha-image-container .fancycaptcha-reload { diff --git a/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js b/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js index c010db89e..b57b965e2 100644 --- a/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js +++ b/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js @@ -42,4 +42,4 @@ return false; } ); -} )( jQuery, mediaWiki ); +}( jQuery, mediaWiki ) ); diff --git a/Gruntfile.js b/Gruntfile.js index 4e1660c76..97f1b4855 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,19 +1,22 @@ -/*jshint node:true */ +/* eslint-env node */ module.exports = function ( grunt ) { - grunt.loadNpmTasks( 'grunt-contrib-jshint' ); - grunt.loadNpmTasks( 'grunt-jsonlint' ); grunt.loadNpmTasks( 'grunt-banana-checker' ); - grunt.loadNpmTasks( 'grunt-jscs' ); + grunt.loadNpmTasks( 'grunt-jsonlint' ); + grunt.loadNpmTasks( 'grunt-eslint' ); + grunt.loadNpmTasks( 'grunt-stylelint' ); grunt.initConfig( { - jshint: { + eslint: { all: [ '**/*.js', '!node_modules/**' ] }, - jscs: { - src: '<%= jshint.all %>' + stylelint: { + all: [ + '**/*.css', + '!node_modules/**' + ] }, banana: { all: [ @@ -30,6 +33,6 @@ module.exports = function ( grunt ) { } } ); - grunt.registerTask( 'test', [ 'jshint', 'jscs', 'jsonlint', 'banana' ] ); + grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'jsonlint', 'banana' ] ); grunt.registerTask( 'default', 'test' ); }; diff --git a/maintenance/GenerateFancyCaptchas.php b/maintenance/GenerateFancyCaptchas.php index b8b56923c..bb19d8bba 100644 --- a/maintenance/GenerateFancyCaptchas.php +++ b/maintenance/GenerateFancyCaptchas.php @@ -27,7 +27,7 @@ if ( getenv( 'MW_INSTALL_PATH' ) ) { $IP = __DIR__.'/../../..'; } -require_once ( "$IP/maintenance/Maintenance.php" ); +require_once ( "$IP/core/maintenance/Maintenance.php" ); /** * Maintenance script to change the password of a given user. diff --git a/package.json b/package.json index 42a7ab664..2a64d88d0 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,12 @@ "test": "grunt test" }, "devDependencies": { - "grunt": "0.4.5", - "grunt-cli": "0.1.13", - "grunt-contrib-jshint": "0.11.3", - "grunt-banana-checker": "0.4.0", - "grunt-jscs": "2.3.0", - "jscs-preset-wikimedia": "~1.0.0", - "grunt-jsonlint": "1.0.7" + "eslint-config-wikimedia": "0.3.0", + "grunt": "1.0.1", + "grunt-eslint": "19.0.0", + "grunt-banana-checker": "0.5.0", + "grunt-jsonlint": "1.1.0", + "grunt-stylelint": "0.6.0", + "stylelint-config-wikimedia": "0.3.0" } } diff --git a/resources/ext.confirmEdit.editPreview.ipwhitelist.styles.css b/resources/ext.confirmEdit.editPreview.ipwhitelist.styles.css index 9fc808041..b4d4c5c12 100644 --- a/resources/ext.confirmEdit.editPreview.ipwhitelist.styles.css +++ b/resources/ext.confirmEdit.editPreview.ipwhitelist.styles.css @@ -1,7 +1,7 @@ .mw-confirmedit-ip-notvalid { - background-color: #FF6C6C; + background-color: #ff6c6c; } .mw-confirmedit-ip-valid { - background-color: #90EE90; + background-color: #90ee90; }