Remove eslint-disable no-use-before-define
authorFomafix <fomafix@googlemail.com>
Sat, 26 May 2018 12:58:37 +0000 (14:58 +0200)
committerKrinkle <krinklemail@gmail.com>
Sun, 27 May 2018 20:16:26 +0000 (20:16 +0000)
mediawiki.js: Reorder setGlobalMapValue() to avoid a forward reference.
mediawiki.action.edit.stash.js: Reorder two functions without to avoid
  forward references.

In all other cases add eslint-disable-next-line no-use-before-define.

Change-Id: Ic8b2f8cf61dcfb1a215ad3d3dddfd40282e3e836

resources/src/mediawiki.Uri/Uri.js
resources/src/mediawiki.action/mediawiki.action.edit.stash.js
resources/src/mediawiki.page.image.pagination.js
resources/src/mediawiki/mediawiki.js

index 7f12835..7467d50 100644 (file)
@@ -50,8 +50,6 @@
  * @class mw.Uri
  */
 
-/* eslint-disable no-use-before-define */
-
 ( function ( mw, $ ) {
        var parser, properties;
 
                                        return uri;
                                }
                                href = hrefCur;
+                               // eslint-disable-next-line no-use-before-define
                                uri = new Uri( href );
                                return uri;
                        };
index 5ae91e8..1be0052 100644 (file)
@@ -1,7 +1,7 @@
 /*!
  * Scripts for pre-emptive edit preparing on action=edit
  */
-/* eslint-disable no-use-before-define */
+
 ( function ( mw, $ ) {
        if ( !mw.config.get( 'wgAjaxEditStash' ) ) {
                return;
                        return;
                }
 
+               // Whether the body text content changed since the last stashEdit()
+               function isTextChanged() {
+                       return lastText !== $text.textSelection( 'getContents' );
+               }
+
+               // Whether the edit summary has changed since the last stashEdit()
+               function isSummaryChanged() {
+                       return lastSummary !== $summary.textSelection( 'getContents' );
+               }
+
                // Send a request to stash the edit to the API.
                // If a request is in progress, abort it since its payload is stale and the API
                // may limit concurrent stash parses.
@@ -43,6 +53,7 @@
                        if ( stashReq ) {
                                if ( lastPriority > priority ) {
                                        // Stash request for summary change should wait on pending text change stash
+                                       // eslint-disable-next-line no-use-before-define
                                        stashReq.then( checkStash );
                                        return;
                                }
                        } );
                }
 
-               // Whether the body text content changed since the last stashEdit()
-               function isTextChanged() {
-                       return lastText !== $text.textSelection( 'getContents' );
-               }
-
-               // Whether the edit summary has changed since the last stashEdit()
-               function isSummaryChanged() {
-                       return lastSummary !== $summary.textSelection( 'getContents' );
-               }
-
                // Check whether text or summary have changed and call stashEdit()
                function checkStash() {
                        if ( !isTextChanged() && !isSummaryChanged() ) {
index 06c34a5..1823ef0 100644 (file)
@@ -2,8 +2,6 @@
  * Implement AJAX navigation for multi-page images so the user may browse without a full page reload.
  */
 
-/* eslint-disable no-use-before-define */
-
 ( function ( mw, $ ) {
        var jqXhr, $multipageimage, $spinner,
                cache = {},
@@ -86,6 +84,7 @@
                        // Replace table contents
                        $multipageimage.empty().append( $contents.clone() );
 
+                       // eslint-disable-next-line no-use-before-define
                        bindPageNavigation( $multipageimage );
 
                        // Fire hook because the page's content has changed
index 702c18d..2d3f6ad 100644 (file)
@@ -9,7 +9,6 @@
  */
 
 /* global mwNow */
-/* eslint-disable no-use-before-define */
 
 ( function ( $ ) {
        'use strict';
                }() );
        }
 
+       /**
+        * Alias property to the global object.
+        *
+        * @private
+        * @static
+        * @member mw.Map
+        * @param {mw.Map} map
+        * @param {string} key
+        * @param {Mixed} value
+        */
+       function setGlobalMapValue( map, key, value ) {
+               map.values[ key ] = value;
+               log.deprecate(
+                       window,
+                       key,
+                       value,
+                       // Deprecation notice for mw.config globals (T58550, T72470)
+                       map === mw.config && 'Use mw.config instead.'
+               );
+       }
+
        /**
         * Create an object that can be read from or written to via methods that allow
         * interaction both with single and multiple properties at once.
                }
        }
 
-       /**
-        * Alias property to the global object.
-        *
-        * @private
-        * @static
-        * @param {mw.Map} map
-        * @param {string} key
-        * @param {Mixed} value
-        */
-       function setGlobalMapValue( map, key, value ) {
-               map.values[ key ] = value;
-               log.deprecate(
-                       window,
-                       key,
-                       value,
-                       // Deprecation notice for mw.config globals (T58550, T72470)
-                       map === mw.config && 'Use mw.config instead.'
-               );
-       }
-
        Map.prototype = {
                constructor: Map,
 
                                        mw.loader.store.set( module, registry[ module ] );
                                        for ( m in registry ) {
                                                if ( registry[ m ].state === 'loaded' && allReady( registry[ m ].dependencies ) ) {
+                                                       // eslint-disable-next-line no-use-before-define
                                                        execute( m );
                                                }
                                        }