build: Update linters

Change-Id: I0c7b153461300840deb75c695f893b3b4a778dcf
This commit is contained in:
Ed Sanders 2019-11-15 16:40:39 +00:00
parent 670e3d8190
commit c4bc2c7d36
5 changed files with 387 additions and 316 deletions

View file

@ -2,10 +2,10 @@
"root": true,
"extends": [
"wikimedia/client",
"wikimedia/jquery"
"wikimedia/jquery",
"wikimedia/mediawiki"
],
"globals": {
"mw": "readonly",
"OO": "readonly"
},
"rules": {

View file

@ -18,7 +18,6 @@ module.exports = function ( grunt ) {
grunt.initConfig( {
eslint: {
options: {
reportUnusedDisableDirectives: true,
extensions: [ '.js', '.json' ],
cache: true
},

View file

@ -342,9 +342,9 @@
* Sets up the iframe in place of the textarea to allow more advanced operations
*/
setupCodeEditor: function () {
var box, lang, basePath, container, editdiv, session;
var $box, lang, basePath, container, editdiv, session;
box = context.$textarea;
$box = context.$textarea;
lang = mw.config.get( 'wgCodeEditorCurrentLanguage' );
basePath = mw.config.get( 'wgExtensionAssetsPath', '' );
if ( basePath.slice( 0, 2 ) === '//' ) {
@ -360,26 +360,26 @@
// We'll stub this out to sit on top of it...
// line-height is needed to compensate for oddity in WikiEditor extension, which zeroes the line-height on a parent container
// eslint-disable-next-line no-jquery/no-parse-html-literal
container = context.$codeEditorContainer = $( '<div style="position: relative"><div class="editor" style="line-height: 1.5em; top: 0; left: 0; right: 0; bottom: 0; position: absolute;"></div></div>' ).insertAfter( box );
container = context.$codeEditorContainer = $( '<div style="position: relative"><div class="editor" style="line-height: 1.5em; top: 0; left: 0; right: 0; bottom: 0; position: absolute;"></div></div>' ).insertAfter( $box );
editdiv = container.find( '.editor' );
box.css( 'display', 'none' );
container.height( box.height() );
$box.css( 'display', 'none' );
container.height( $box.height() );
// Non-lazy loaded dependencies: Enable code completion
ace.require( 'ace/ext/language_tools' );
// Load the editor now
context.codeEditor = ace.edit( editdiv[ 0 ] );
context.codeEditor.getSession().setValue( box.val() );
box.textSelection( 'register', textSelectionFn );
context.codeEditor.getSession().setValue( $box.val() );
$box.textSelection( 'register', textSelectionFn );
// Disable some annoying commands
context.codeEditor.commands.removeCommand( 'replace' ); // ctrl+R
context.codeEditor.commands.removeCommand( 'transposeletters' ); // ctrl+T
context.codeEditor.commands.removeCommand( 'gotoline' ); // ctrl+L
context.codeEditor.setReadOnly( box.prop( 'readonly' ) );
context.codeEditor.setReadOnly( $box.prop( 'readonly' ) );
context.codeEditor.setShowInvisibles( context.showInvisibleChars );
// The options to enable
@ -395,9 +395,9 @@
readOnly: true
} );
box.closest( 'form' )
.submit( context.evt.codeEditorSubmit )
.find( '#wpSave' ).click( context.evt.codeEditorSave );
$box.closest( 'form' )
.on( 'submit', context.evt.codeEditorSubmit )
.find( '#wpSave' ).on( 'click', context.evt.codeEditorSave );
session = context.codeEditor.getSession();
@ -417,7 +417,7 @@
// Use jquery.ui.resizable so user can make the box taller too
container.resizable( {
handles: 's',
minHeight: box.height(),
minHeight: $box.height(),
resize: function () {
context.codeEditor.resize();
}

668
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -8,15 +8,15 @@
},
"devDependencies": {
"ace-builds": "1.2.9",
"eslint-config-wikimedia": "0.14.3",
"eslint-config-wikimedia": "0.15.0",
"grunt": "1.0.4",
"grunt-banana-checker": "0.8.1",
"grunt-contrib-clean": "2.0.0",
"grunt-contrib-copy": "1.0.0",
"grunt-eslint": "22.0.0",
"grunt-exec": "3.0.0",
"grunt-stylelint": "0.11.1",
"grunt-stylelint": "0.12.0",
"postcss-less": "1.1.3",
"stylelint-config-wikimedia": "0.6.0"
"stylelint-config-wikimedia": "0.7.0"
}
}