build: Replace jscs+jshint with eslint

Change-Id: I7f114267fbb4efd62a9162758445cff4fb3c0973
This commit is contained in:
Ed Sanders
2016-11-02 21:56:31 +00:00
parent 4bd38a0fcf
commit 811944c49a
14 changed files with 69 additions and 100 deletions

View File

@@ -132,9 +132,7 @@
};
mw.uls.getCountryCode = function () {
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
return window.Geo && ( window.Geo.country || window.Geo.country_code );
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
};
mw.uls.getAcceptLanguageList = function () {

View File

@@ -17,6 +17,8 @@
* @licence MIT License
*/
/* eslint-disable no-use-before-define */
( function ( $, mw ) {
'use strict';
@@ -51,6 +53,9 @@
/**
* @class
* @constructor
* @param {string|jQuery} interlanguageList Selector for interlanguage list
* @param {Object} options
*/
function CompactInterlanguageList( interlanguageList, options ) {
this.$interlanguageList = $( interlanguageList );
@@ -289,7 +294,8 @@
* Not all previous languages will be present in interlanguage links,
* so we are filtering them.
*
* @return {Array} List of language codes supported by the article
* @param {string[]} languages Language codes
* @return {string[]} List of language codes supported by the article
*/
function filterByPreviousLanguages( languages ) {
var previousLanguages = mw.uls.getPreviousLanguages();
@@ -302,7 +308,8 @@
/**
* Filter the language list by site picks.
*
* @return {Array} List of language codes supported by the article
* @param {string[]} languages Language codes
* @return {string[]} List of language codes supported by the article
*/
function filterBySitePicks( languages ) {
var picks = mw.config.get( 'wgULSCompactLinksPrepend' ) || [];
@@ -316,7 +323,8 @@
* Filter the language list by common languages.
* Common languages are the most probable languages predicted by ULS.
*
* @return {Array} List of language codes supported by the article
* @param {string[]} languages Language codes
* @return {string[]} List of language codes supported by the article
*/
function filterByCommonLanguages( languages ) {
var commonLanguages = mw.uls.getFrequentLanguageList();
@@ -330,12 +338,15 @@
* Filter the language list by globally common languages, i.e.
* this list is not user specific.
*
* @return {Array} List of language codes supported by the article
* @param {string[]} languages Language codes
* @return {string[]} List of language codes supported by the article
*/
function getExtraCommonLanguages( languages ) {
var commonLanguages = [ 'zh', 'en', 'hi', 'ur', 'es', 'ar', 'ru', 'id', 'ms', 'pt',
'fr', 'de', 'bn', 'ja', 'pnb', 'pa', 'jv', 'te', 'ta', 'ko', 'mr', 'tr', 'vi',
'it', 'fa', 'sv', 'nl', 'pl' ];
var commonLanguages = [
'zh', 'en', 'hi', 'ur', 'es', 'ar', 'ru', 'id', 'ms', 'pt',
'fr', 'de', 'bn', 'ja', 'pnb', 'pa', 'jv', 'te', 'ta', 'ko', 'mr', 'tr', 'vi',
'it', 'fa', 'sv', 'nl', 'pl'
];
return $.grep( commonLanguages, function ( language ) {
return $.inArray( language, languages ) >= 0;
@@ -346,7 +357,8 @@
* Filter the language list by Translate's assistant languages.
* Where available, they're languages deemed useful by the user.
*
* @return {Array} List of those language codes which are supported by article
* @param {string[]} languages Language codes
* @return {string[]} List of language codes supported by the article
*/
function filterByAssistantLanguages( languages ) {
var assistantLanguages = mw.user.options.get( 'translate-editlangs' );
@@ -369,7 +381,8 @@
* The reader doesn't necessarily know this language, but it
* appears relevant to the page.
*
* @return {Array} List of language codes supported by the article
* @param {string[]} languages Language codes
* @return {string[]} List of language codes supported by the article
*/
CompactInterlanguageList.prototype.filterByLangsInText = function ( languages ) {
var languagesInText = [];
@@ -440,7 +453,8 @@
/**
* Get common languages - the most probable languages predicted by ULS.
*
* @param {Array} languages Array of all languages.
* @param {string[]} languages Language codes
* @return {string[]} List of all common language codes
*/
CompactInterlanguageList.prototype.getCommonLanguages = function ( languages ) {
if ( this.commonInterlanguageList === null ) {

View File

@@ -296,7 +296,7 @@
left: displaySettings.$parent.left,
top: displaySettings.$parent.top,
onReady: function () {
var $wrap,
var $wrap,
uls = this,
$back = $( '<div>' )
.addClass( 'uls-icon-back' );
@@ -625,6 +625,8 @@
/**
* Callback for save preferences
*
* @param {boolean} success
*/
onSave: function ( success ) {
if ( success ) {

View File

@@ -498,6 +498,8 @@
/**
* Callback for save preferences
*
* @param {boolean} success
*/
onSave: function ( success ) {
if ( success ) {

View File

@@ -194,6 +194,9 @@
/**
* The tooltip to be shown when language changed using ULS.
* It also allows to undo the language selection.
*
* @param {string} previousLang
* @param {string} previousAutonym
*/
function showUndoTooltip( previousLang, previousAutonym ) {
var $ulsTrigger, ulsPopup,
@@ -258,7 +261,7 @@
padded: true,
width: 300,
align: 'forwards',
classes: [ 'uls-tipsy' ],
classes: [ 'uls-tipsy' ],
$content: ( function () {
var link = $( '<a>' ).text( previousAutonym )
.attr( {

View File

@@ -26,6 +26,8 @@
/**
* Wrapper for localStorage, falls back to cookie
* when localStorage not supported by browser.
*
* @return {Object}
*/
function preferenceStore() {
@@ -110,6 +112,7 @@
* Get a preference value for the given preference name
*
* @param {string} key
* @return {Mixed}
*/
get: function ( key ) {
return this.preferences[ key ];

View File

@@ -88,8 +88,8 @@
detected = false;
if ( $.client.test( {
msie: false
} ) ) {
msie: false
} ) ) {
// IE shows a different tofu for unassigned code points!
text = tofuSalt + text;
}
@@ -139,7 +139,8 @@
*
* @param {Object} repository
* @param {string} language
* @param {Array} classes
* @param {string[]} classes
* @return {string|null}
*/
fontSelector: function ( repository, language, classes ) {
var font, autonym, defaultFont;