Jforrester has uploaded a new change for review. ( 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 --- A .eslintrc.json A .stylelintrc M Gruntfile.js M package.json M resources/ext.pronunciationRecording.pronunciationRecorder.js M resources/ext.pronunciationRecording.specialPage.js 6 files changed, 63 insertions(+), 49 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PronunciationRecording refs/changes/18/370118/1 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/.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: newchange Gerrit-Change-Id: Ief51508b119300abc64a42260ccb72505e4b52dd Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PronunciationRecording Gerrit-Branch: master Gerrit-Owner: Jforrester <jforres...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits