jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/370118 )
Change subject: build: Replace jshint/jscs with eslint and csslint with stylelint ...................................................................... build: Replace jshint/jscs with eslint and csslint with stylelint Also upgrade banana and jsonlint to latest. Change-Id: Ief51508b119300abc64a42260ccb72505e4b52dd --- D .csslintrc A .eslintrc.json D .jscsrc D .jshintignore D .jshintrc A .stylelintrc M Gruntfile.js M package.json M resources/ext.pronunciationRecording.pronunciationRecorder.js M resources/ext.pronunciationRecording.specialPage.js 10 files changed, 63 insertions(+), 90 deletions(-) Approvals: Umherirrender: Looks good to me, approved jenkins-bot: Verified diff --git a/.csslintrc b/.csslintrc deleted file mode 100644 index e777c7f..0000000 --- a/.csslintrc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "adjoining-classes": false, - "box-model": false, - "box-sizing": false, - "fallback-colors": false, - "important": false, - "outline-none": false, - "qualified-headings": false, - "universal-selector": false, - "unqualified-attributes": false -} diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..b8371ee --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,13 @@ +{ + "extends": "wikimedia", + "env": { + "browser": true, + "jquery": true, + "qunit": true + }, + "globals": { + "mediaWiki": false, + "Recorder": false + }, + "rules": {} +} diff --git a/.jscsrc b/.jscsrc deleted file mode 100644 index 9d22e3f..0000000 --- a/.jscsrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "preset": "wikimedia" -} diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index a1581ce..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -resources/mediawiki.libs.recorderjs -node_modules diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index b44b4e7..0000000 --- a/.jshintrc +++ /dev/null @@ -1,25 +0,0 @@ -{ - // Enforcing - "bitwise": true, - "eqeqeq": true, - "freeze": true, - "latedef": true, - "noarg": true, - "nonew": true, - "undef": true, - "unused": true, - "strict": false, - - // Relaxing - "es5": false, - - // Environment - "browser": true, - "jquery": true, - - "globals": { - "mediaWiki": false, - "Recorder": false, - "AudioContext": false - } -} diff --git a/.stylelintrc b/.stylelintrc new file mode 100644 index 0000000..0fc57dc --- /dev/null +++ b/.stylelintrc @@ -0,0 +1,3 @@ +{ + "extends": "stylelint-config-wikimedia" +} diff --git a/Gruntfile.js b/Gruntfile.js index 362c2f7..1246162 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,49 +4,45 @@ * @package PronunciationRecording */ -/*jshint node:true */ +/* eslint-env node, es6 */ module.exports = function ( grunt ) { grunt.loadNpmTasks( 'grunt-banana-checker' ); - grunt.loadNpmTasks( 'grunt-contrib-csslint' ); - grunt.loadNpmTasks( 'grunt-contrib-jshint' ); grunt.loadNpmTasks( 'grunt-contrib-watch' ); - grunt.loadNpmTasks( 'grunt-jscs' ); + grunt.loadNpmTasks( 'grunt-eslint' ); grunt.loadNpmTasks( 'grunt-jsonlint' ); + grunt.loadNpmTasks( 'grunt-stylelint' ); grunt.initConfig( { - jshint: { - options: { - jshintrc: true - }, + eslint: { all: [ '*.js', 'resources/**/*.js', '!resources/mediawiki.libs.recorderjs/*' ] }, - jscs: { - src: '<%= jshint.all %>' - }, - csslint: { + stylelint: { src: 'resources/**/*.css' - }, - jsonlint: { - all: 'i18n/*.json' }, banana: { all: 'i18n/' }, + jsonlint: { + all: [ + '*.json', + '.stylelintrc', + 'i18n/*.json' + ] + }, watch: { files: [ - '.{jshintignore,jshintrc,jscsrc,csslintrc}', - '<%= jshint.all %>', - '<%= csslint.all %>', - '<%= jsonlint.all %>' + '.{stylelintrc,eslintrc.json}', + '<%= eslint.all %>', + '<%= stylelint.all %>' ], tasks: 'test' } } ); - grunt.registerTask( 'test', [ 'jshint', 'jscs', 'csslint', 'jsonlint', 'banana' ] ); + grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'jsonlint', 'banana' ] ); grunt.registerTask( 'default', 'test' ); }; diff --git a/package.json b/package.json index e77148c..c7757c7 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,24 @@ { - "name": "PronunciationRecording", - "version": "0.0.0", - "private": true, - "description": "Build tools for PronunciationRecording.", - "scripts": { - "test": "grunt test" - }, - "repository": { - "type": "git", - "url": "https://gerrit.wikimedia.org/r/p/mediawiki/extensions/PronunciationRecording.git" - }, - "devDependencies": { - "grunt": "1.0.1", - "grunt-banana-checker": "0.4.0", - "grunt-contrib-csslint": "0.5.0", - "grunt-contrib-jshint": "0.11.3", - "grunt-contrib-watch": "1.0.0", - "grunt-jscs": "2.1.0", - "grunt-jsonlint": "1.0.7" - } + "name": "PronunciationRecording", + "version": "0.0.0", + "private": true, + "description": "Build tools for the PronunciationRecording extension.", + "scripts": { + "test": "grunt test" + }, + "repository": { + "type": "git", + "url": "https://gerrit.wikimedia.org/r/p/mediawiki/extensions/PronunciationRecording.git" + }, + "devDependencies": { + "eslint-config-wikimedia": "0.4.0", + "grunt": "1.0.1", + "grunt-banana-checker": "0.6.0", + "grunt-contrib-watch": "1.0.0", + "grunt-eslint": "20.0.0", + "grunt-jsonlint": "1.1.0", + "grunt-stylelint": "0.8.0", + "stylelint": "7.8.0", + "stylelint-config-wikimedia": "0.4.1" + } } diff --git a/resources/ext.pronunciationRecording.pronunciationRecorder.js b/resources/ext.pronunciationRecording.pronunciationRecorder.js index dbb6e20..176fd57 100644 --- a/resources/ext.pronunciationRecording.pronunciationRecorder.js +++ b/resources/ext.pronunciationRecording.pronunciationRecorder.js @@ -1,5 +1,5 @@ ( function ( mw, $ ) { - mw.PronunciationRecorder = function ( ) { + mw.PronunciationRecorder = function () { var audioContext, recorder, uploadHandler, uploadWizardUpload, cachedBlob, userAgent = mw.message( 'pronunciationrecording-title' ).text(); @@ -45,6 +45,11 @@ text: fileDetails.generateWikiText() }; + function publishFail() { + err(); + mw.log( 'Upload could not be successfully published' ); + } + function publishOk( response ) { if ( response.upload.result === 'Success' ) { ok(); @@ -52,11 +57,6 @@ } else { publishFail(); } - } - - function publishFail() { - err(); - mw.log( 'Upload could not be successfully published' ); } uploadWizardUpload.api.postWithEditToken( params, publishOk, publishFail ); @@ -104,7 +104,7 @@ // this is the asynchronous callback that's called when exportWAV finishes encoding function ( blob ) { var message, upload; - message = $( '<br><audio controls class="mw-pronunciationrecording-preview-audio"><source src="' + URL.createObjectURL( blob ) + '" type="audio/wav"></audio>' ); + message = $( '<br><audio controls class="mw-pronunciationrecording-preview-audio"><source src="' + URL.createObjectURL( blob ) + '" type="audio/wav"></audio>' ); upload = $( '<br><button class="mw-pronunciationrecording-upload">' + mw.message( 'pronunciationrecording-toolbar-upload-label' ).escaped() + '</button>' ); $( '.mw-pronunciationrecording-preview-div' ).empty(); upload.prependTo( '.mw-pronunciationrecording-preview-div' ); diff --git a/resources/ext.pronunciationRecording.specialPage.js b/resources/ext.pronunciationRecording.specialPage.js index 2f4a7ac..7b8eee7 100644 --- a/resources/ext.pronunciationRecording.specialPage.js +++ b/resources/ext.pronunciationRecording.specialPage.js @@ -2,7 +2,7 @@ $( document ).ready( function () { var pronunciationRecorder; try { - pronunciationRecorder = new mw.PronunciationRecorder( ); + pronunciationRecorder = new mw.PronunciationRecorder(); $( '.mw-pronunciationrecording-message' ).text( mw.message( 'pronunciationrecording-mic-access-notify' ).text() ); $( '.mw-pronunciationrecording-record' ).on( 'click', function () { $( '.mw-pronunciationrecording-record' ).attr( 'disabled', 'disabled' ); @@ -32,7 +32,7 @@ $( '.mw-pronunciationrecording-upload' ).attr( 'disabled', 'disabled' ); pronunciationRecorder.startUploading( function () { var name, $fileLink; - name = 'File:' + pronunciationRecorderFileDetails.generateFileName() ; + name = 'File:' + pronunciationRecorderFileDetails.generateFileName(); $fileLink = $( '<a>' ); $fileLink.attr( 'href', mw.util.wikiGetlink( name ) ); $fileLink.text( name ); -- To view, visit https://gerrit.wikimedia.org/r/370118 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ief51508b119300abc64a42260ccb72505e4b52dd Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/PronunciationRecording Gerrit-Branch: master Gerrit-Owner: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: Legoktm <lego...@member.fsf.org> Gerrit-Reviewer: Umherirrender <umherirrender_de...@web.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits