aboutsummaryrefslogtreecommitdiffstats
path: root/.eslintrc.json
Commit message (Collapse)AuthorAgeFilesLines
* eslint: Remove no-shadow setting, already set upstreamEd Sanders2021-06-051-2/+1
| | | | Change-Id: I278117d3b1e4bccf7d083b2757972fb73a458e0e
* build: Updating npm dependencieslibraryupgrader2021-01-031-0/+1
| | | | | | | | | | | * ini: 1.3.5 → 1.3.8 * https://npmjs.com/advisories/1589 Additional changes: * Removed useless -p option to phpcbf in "composer fix" command. * Set `root: true` in .eslintrc.json (T206485). Change-Id: I0116578751fd73e43b07c2830adc629f4b85c784
* eslint: Move `mediawiki/valid-package-file-require` disables inlineJames D. Forrester2020-08-261-1/+0
| | | | Change-Id: I5af1fcb5b77106671fbb684158027870211b8186
* eslint: Enforce `no-shadow` for variable shadowingEd Sanders2020-06-241-1/+2
| | | | Change-Id: I1ffff6d103f7a4ca56afee3a910d9b3fee6eb72f
* build: Update eslint-config-wikimedia to 0.16.2Ed Sanders2020-06-181-10/+2
| | | | | | Use jsduck config. Change-Id: I3a1a0c8f0ca535c9661b3774498866fdb98a4255
* Replace @context with @thisEd Sanders2020-06-151-2/+0
| | | | | | | @context is a jsduck custom tag used in very few places. Rename to @this to make migrating to JSDoc easier. Change-Id: I10394e85354b7002d96e0fa1af1cb7ae7534db8d
* eslint: Remove duplicate OO global, now upstreamEd Sanders2020-06-081-2/+1
| | | | Change-Id: I6e99919e6c6d3ff76c081a77c57f0d6915cd9031
* eslint: Update to eslint-config-wikimedia 0.16.0Ed Sanders2020-06-021-0/+11
| | | | | | | * valid-jsdoc replaced with jsdoc plugin * New /selenium config Change-Id: I471eebac0312cb25c539c3f6a3ecfc7cfd4ed8d6
* eslint: Remove quote-props override, already set upstreamEd Sanders2020-04-161-1/+0
| | | | | | This rule is the same as it is set in eslit-config-wikimedia. Change-Id: Ie275444481ace90e06398b0ad8bf1bc295899061
* build: Fix mediawiki/class-doc errors and enableEd Sanders2020-04-151-1/+0
| | | | Change-Id: I39003ea454be3ca449dd0795adf4b98a07faee54
* build: Provide linting for .vue files from upstreamRoan Kattouw2020-04-151-0/+2
| | | | | | | | Was first attempted in f1eaa06d5e2222f3a94dc269977cccfb6e891a25, and reverted in 0b3fe4fe8ca0c69d189e86c31f4ef08982133683. Now this is done in eslint-config-wikimedia for all repos. Change-Id: I9ee735eef40085b6373b565838d67e186e438657
* Revert "build: Linting for .vue files"Catrope2020-03-301-4/+2
| | | | | | | | | This reverts commit f1eaa06d5e2222f3a94dc269977cccfb6e891a25. Reason for revert: accidentally allowed ES6 syntax. Looking for a way to redo this that doesn't break our linting as badly. Change-Id: I78974b97001bdbea9aff5717c69d71b8a2582ade
* build: Linting for .vue filesRoan Kattouw2020-02-051-2/+4
| | | | | | | | | | | | | | | | Install eslint-plugin-vue, which lints JS inside <script> blocks in .vue files, and also lints Vue templates. Configure eslint and stylelint to run on .vue files. stylelint automatically picks up on CSS in <style> tags. You may have to change a setting in your text editor or IDE to make it run eslint and stylelint in .vue files. For eslint, see https://eslint.vuejs.org/user-guide/#editor-integrations ; for stylelint, I had to install the linter-stylelint-plus Atom plugin then add source.css.embedded.html to the "Base Scopes" setting for that plugin. Change-Id: I7e6a13317792fc25c29106739b0c24864fd8d301
* build: Update linters and fix errorsEd Sanders2019-10-231-6/+4
| | | | Change-Id: Ieb1eff174f5168bf6c9e9aaeb58ec1a1bcd33538
* Use plugin to ensure all message keys are documentedEd Sanders2019-10-211-6/+8
| | | | | Bug: T235502 Change-Id: If77ddf2caf667504bd0f7e0150649745ae31c4e2
* build: Update eslint-config-wikimedia to 0.11.0Ed Sanders2019-02-201-1/+1
| | | | Change-Id: Iee025a518962e68c5ec2c07d952f402cd2a7f69b
* build: Update eslint-config-wikimedia to 0.10.0Ed Sanders2019-01-081-1/+3
| | | | Change-Id: I2930bcabeeb7b7b2eb36063e77b26e664a691b43
* eslint: Drop 'dot-notation' ruleEd Sanders2018-11-271-1/+0
| | | | | Bug: T210552 Change-Id: I07620ed2e3a1acfd3193e411c8369722ae751ffa
* build: Use eslint-config-wikimedia v0.9.0 and make passEd Sanders2018-11-231-190/+4
| | | | Change-Id: I7b5d228a3de4b3006751a427dec907a5bebf2f51
* eslintrc: Disallow calling String/Array/Object methods introduced in ES6 or ↵Bartosz Dziewoński2018-11-071-0/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | later This aims to disallow using the methods listed below, which are supported by Chromium 69 but not supported by Internet Explorer 11. Most of them were introduced in ECMAScript 6, but some are more recent or experimental. We keep breaking IE 11 support by using them. Recent examples include: * mediawiki/core: Ic85063dfbbcf26a99d343845c9fb801f1888d750 * mediawiki/extensions/MultimediaViewer: I0954c42a37668b0eb46c3e864a2e13152a6dc68a * mediawiki/extensions/UploadWizard: I70d37a8f0abcc96b5e39fa71a93cda6f3421c87c * VisualEditor/VisualEditor: Ic1971549da37091c41a847229d18e95aff5c9952 This will unfortunately almost certainly cause false positives, but hopefully not too many of them. Common false positives can be disallowed more precisely using 'no-restricted-syntax' rather than 'no-restricted-properties'. Disallowed methods: String.prototype: codePointAt endsWith includes normalize padEnd (ES 2017) padStart (ES 2017) repeat startsWith trimEnd (experimental/proposed) trimLeft (experimental/proposed) trimRight (experimental/proposed) trimStart (experimental/proposed) Array.prototype: copyWithin entries fill find findIndex flat (experimental/proposed) flatMap (experimental/proposed) includes (ES 2016) keys values String: fromCodePoint raw Array: from of Object: assign entries (ES 2017) getOwnPropertyDescriptors (ES 2017) getOwnPropertySymbols is values (ES 2017) I compiled the list based on running the following code in each browser's console, since there doesn't seem to be an authoritative list anywhere on the Internet: console.log( Object.getOwnPropertyNames( String.prototype ) ) console.log( Object.getOwnPropertyNames( Array.prototype ) ) console.log( Object.getOwnPropertyNames( Object.prototype ) ) console.log( Object.getOwnPropertyNames( String ) ) console.log( Object.getOwnPropertyNames( Array ) ) console.log( Object.getOwnPropertyNames( Object ) ) Change-Id: Ic44c79834f99c52863fbc544ad657787f70fb9bb
* resources: Strip '$' and 'mw' from file closuresTimo Tijhof2018-09-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follows-up Id6d13bbea6: - '$': mw.loader.implement does this already. - 'mw': Use the canonical name directly. This replaces the following patterns: File closures (common): - `( function ( $, mw ) {` => `( function () {` - `( function ( $ ) {` => `( function () {` - `( function ( mw ) {` => `( function () {` - `( function ( mw, $ ) {` => `( function () {` File closures (rare): - `( function ( mw, $, OO ) {` => `( function () {` - `( function ( mw, OO, $ ) {` => `( function () {` - `( function ( mw, document ) {` => `( function () {` Combined dom-ready and file closure (rare): - `jQuery( function ( $ ) {` => `$( function () { - `jQuery( function () {` => `$( function () { Remaining references in files without a closure, as found by the new ESLint setting (rare): - `jQuery` => `$` - `mediaWiki` => `mw` Change-Id: I7cf2426cde597259e8c6f3f6f615a1a81a0ca82b
* Hygiene: Discourage use of $.eachjdlrobson2018-09-051-0/+5
| | | | | | | | | | | Even though Array.prototype.forEach only works on arrays, and $.each is more generic, I think it makes sense to begin discouraging the usage of $.each now. This can be overriden by ignore lines or by Array.prototype.forEach compatible lines. This doesn't seem too much of an ask of engineers and helps future migrations Bug: T200877 Change-Id: I339cff311a830699c8e32f07cec338a39870c53f
* Replace $.proxy by Function.prototype.bindFomafix2018-09-051-0/+5
| | | | | | | | | | Also prevent further usage by an eslint rule. jQuery.proxy is deprecated: * https://github.com/jquery/jquery/issues/2958 Bug: T200877 Change-Id: I3a4977f9b90c2104db320d2d939a1cbaa1819de0
* Merge "resourceloader: Remove obsolete aliases from closure"jenkins-bot2018-09-041-2/+4
|\
| * resourceloader: Remove obsolete aliases from closureTimo Tijhof2018-08-301-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | == jQuery ResourceLoader wraps and executes all modules in the system via a closure that explicitly binds '$', 'jQuery'. This means there is no point in aliasing jQuery to $ in every single file. ResourceLoader already does this. This is a very very old habit that was introduced in 2009 when we didn't have ResourceLoader and were concerned with wikis loading their own copy of jQuery that could redefine the global 'jQuery' and '$' variables. We simply hoped that "our module" initialised before "that module" cache the reference we got in the file closure. Then in 2010, when building ResourceLoader, we found this didn't always work. And we also sometimes forgot to add the closure. Which is why in 2010 (before ResourceLoader went to prod, in 2011) we fixed the above issue in ResourceLoader itself by "magically" providing a private binding to '$' and 'jQuery' in every mw.loader.implement() closure. (r79246, bd93eeb85). So, these in-file closure references are redundant. And have been since 2010. == jQuery, again. While redundant, they remained in most files. Harmless, right? However, that same problem of duplicate jQuery copys on a page came up again in 2013. Why did our magic binding not work? It was *because* the file also did its own binding: 1. ResourceLoader stores reference to proper jQuery. 2. ResourceLoader provides private reference to it as '$'. 3. .. time passes .. 4. Module executes, and is given the proper jQuery via the private '$' reference. The module file ignores this because it instead looks up current jQuery, and caches that. So, we expande the magic binding to also bind the name 'jQuery'. (2013-2014; 5742c1f38527). == mediaWiki We export the binding as 'mw' and 'mediaWiki'. We internally mostly use 'mw' (in HTML, and documentation, and the canonical name in the JSDuck index). But, rather than using the shorter name, we use the longer name and alias it in every single file. There was never a concern about this global being redefined as far as I know. However, if that happens one day, we should.. provide a magic binding for it. Change-Id: Id6d13bbea6927a4c7354ca1edd98f13f0fae30c1
* | Remove jQuery.inArray usagespetarpetkovic2018-09-031-0/+5
|/ | | | | | | | | Replace jQuery.inArray with Array.prototype.indexOf. Also enforce this via eslint rule. Bug: T200877 Change-Id: Idbd06e6a1681300c4ab9142c7b57e4376f474041
* Fix eslint warnings and switch to error codejdlrobson2018-08-141-1/+1
| | | | | | | | | | | | Follow up to I4552191f639b1022cb085ef5eb4abda835c2d91c * Add eslint-ignores to various files * Correct various uses of isFunction, trim, map, grep where easy fix is available * Switch from eslint warning to error Bug: T200877 Change-Id: I8420db21e548772332e51769aa8ec92d5958715f
* Warn against certain jQuery methodsjdlrobson2018-08-101-0/+28
| | | | | | | | | | | For time being these messages will warn. In a follow up, I plan to fix issues and add eslint-ignore lines and make this error rather than warn. Bug: T200877 Change-Id: I4552191f639b1022cb085ef5eb4abda835c2d91c
* build: Enable and make pass no-prototype-builtinsJames D. Forrester2018-07-051-2/+1
| | | | Change-Id: I26a98be16c005c1c864ec592e1a41b44943f8f29
* build: Upgrade eslint to 5.xJames D. Forrester2018-07-051-1/+3
| | | | | | Add two exceptions for max-len and no-prototype-builtins. Change-Id: I5d3f7a3e282a237fb5de9f0eb29b579a08c32652
* qunit: Make eslint config pass on qunit test filesTimo Tijhof2017-02-221-2/+1
| | | | | | | | | | | | Follows-up c0fb8a8836, I890e6e49b. * Disable 'qunit' env in general source code. And re-declare locally in the few src files that use it properly. * Create separate eslint config for tests/qunit with various rules disabled (e.g. valid-jsdoc and es3-keywords). Change-Id: I37ccec2019de55edfee92697eb80478df7cb6220
* resourceloader: Use perf.now() for mediaWikiLoadStart in startup.jsTimo Tijhof2017-02-091-1/+0
| | | | | | | | | | | | | | | | | Currently we're using 'new Date' which is less accurate for high accuracy performance measures. On top of that, we are actually using performance.now() in Navigation Timing to measure mediaWikiLoadEnd, and subsequently relating it to mediaWikiLoadStart to produce mediaWikiLoadComplete. Mixing Date and performance.now produces inaccurate results since the two are usually not in sync. See T153819 for further details. Solve this by moving the polyfil to startup.js instead. Also add a basic unit test for mw.now(). Bug: T153819 Change-Id: Ib44538155aa9ba432ec4c58b09ead5333a3a942d
* eslint: Re-enable valid-jsdoc and make a passEd Sanders2016-11-171-2/+1
| | | | Change-Id: I5c3c942d5a9c51628619227c4bbaefd1d92a842d
* build: Replace jscs+jshint with eslintEd Sanders2016-11-151-0/+19
Change-Id: Id0a23c03aabadfaf2ec705528ae4b3bd0908fa3e