Reintroduces IIFE closures in test files because variables were
declared in the global namespace, and "const" now causes hard errors.
Bug: T339323
Change-Id: I69e9d7a29591137f185f3e5ab02dea590ec4dff6
The new mw eslint config comes with node 12 and the change will be
quite big due to the lock file. I wanted to keep the diff of actual
code changes seperate.
- Applied all code style recommendations
- Removed one test that's not giving any value
- Changed regex .match to .test for performance and convinience
Change-Id: I578be8c6460c7a4d1220354c028a9bfd9bb86d13
It's never used in another context but together with the
….Slider module.
Motivated by the confusion about the two types of require()
introduced in Idf1cc79.
Bug: T233279
Change-Id: I922d7ab56fd3ce80bc901f1a5d7174df6fe6756d
Each RL module comes with the cost of its name + hash being sent over every
request and in the startup module increasing the time to load the page.
Bug: T229791
Change-Id: I3ae230a84112a70ab369ffbff70e173b8f07ec1a
This is a direct follow up to the change done in I885f8e7. I found the
code very hard to read after the change, and tried to rearrange it a
little bit. This is what I came up with. What the code does is entirely
untouched.
This also rearranges the replaceWith calls so the replacements are done
from top to bottom.
This patch also avoids calling mw.config.set multiple times.
Change-Id: I1cbce8e8aa030d6ba5cd7d19ab26fa363e13474b
First I jumped on replacing both jscs and jshint with eslint but
it might be premature decision. Although linting with eslint
is possible (like in there is wikimedia config for eslint)
it is still not clear should it
But in case the change happens we will be ready.
Apart from config stuff this changes few bits spotted by eslint:
improves some indentation, removes weird spaces, completes some
doc blocks, changes IIFE forms in tests. These changes do not
seem controversial.
Change-Id: I9f8bf0f5745da8e662685f4cd879ea4baa609c01
This changes the previous behaviour of fetching always up to
500 most recent revisions.
Now the extensions fetches N revisions including the newer
revision selected to diff as the most recent revision.
N is number of revisions that would fit in the current
window when rendered as bars.
When user is close to either "end" of the slider, extensions
fetches another batch of up to N older or newer revisions,
as long as user does not reach the oldest or the newest
revision of the page.
Among others, this removes the limitations of the previous
approach: showing only 500 revisions, and failing to show
anything when any of selected revisions was older than
500 recent revisions.
This change also simplifies usage of Api class.
Bug: T135005
Change-Id: Ib3f4a6ac57ff17008f9d8784c4716bd294443096
Despite its documentation the "constructor" of RevisionList tends
to expect array of revision data in a format returned by API instead
of array of Revision objects.
Due to different name of ID fields in Revision object and in API array,
if "real" Revision object is passed to RevisionList, its ID is lost.
This changes RevisionList so that it only accepts an array of Revision
objects. This provides better abstraction.
This is basically a revert of I147270f28381038d05f8bcfd2317e8c269b2e458
which aimed at the same problem but suggested solution doesn't seem right.
Change-Id: Ic45cdd3e7b707a8c6a19eecf0a84d4c11696cd1f