Skip to content

Commit

Permalink
Merge pull request #165 from wikimedia/lint-fixes-0.6.0
Browse files Browse the repository at this point in the history
Update eslint-config-wikimedia and fix issues
  • Loading branch information
jdforrester authored Jul 19, 2018
2 parents 45b22b9 + b4a8ee5 commit d93facf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
8 changes: 6 additions & 2 deletions src/jquery.i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
String.locale = i18n.locale;

// Override String.localeString method
// FIXME: This is a mistake. We should not modify String.prototype
/* eslint-disable no-extend-native */
String.prototype.toLocaleString = function () {
var localeParts, localePartIndex, value, locale, fallbackIndex,
tryingLocale, message;
Expand Down Expand Up @@ -75,7 +77,8 @@
break;
}

locale = ( $.i18n.fallbacks[ i18n.locale ] && $.i18n.fallbacks[ i18n.locale ][ fallbackIndex ] ) ||
locale = ( $.i18n.fallbacks[ i18n.locale ] &&
$.i18n.fallbacks[ i18n.locale ][ fallbackIndex ] ) ||
i18n.options.fallbackLocale;
$.i18n.log( 'Trying fallback locale for ' + i18n.locale + ': ' + locale + ' (' + value + ')' );

Expand Down Expand Up @@ -146,7 +149,8 @@
// source extension should be json, but can have query params after that.
source.split( '?' )[ 0 ].split( '.' ).pop() !== 'json'
) {
// Load specified locale then check for fallbacks when directory is specified in load()
// Load specified locale then check for fallbacks when directory is
// specified in load()
sourceMap[ locale ] = source + '/' + locale + '.json';
fallbackLocales = ( $.i18n.fallbacks[ locale ] || [] )
.concat( this.options.fallbackLocale );
Expand Down
11 changes: 6 additions & 5 deletions src/jquery.i18n.parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@
anyCharacter = makeRegexParser( /^./ );
dollar = makeStringParser( '$' );
digits = makeRegexParser( /^\d+/ );
regularLiteral = makeRegexParser( /^[^{}\[\]$\\]/ );
regularLiteralWithoutBar = makeRegexParser( /^[^{}\[\]$\\|]/ );
regularLiteralWithoutSpace = makeRegexParser( /^[^{}\[\]$\s]/ );
regularLiteral = makeRegexParser( /^[^{}[\]$\\]/ );
regularLiteralWithoutBar = makeRegexParser( /^[^{}[\]$\\|]/ );
regularLiteralWithoutSpace = makeRegexParser( /^[^{}[\]$\s]/ );

// There is a general pattern:
// parse a thing;
Expand Down Expand Up @@ -209,7 +209,7 @@
templateName = transform(
// see $wgLegalTitleChars
// not allowing : due to the need to catch "PLURAL:$1"
makeRegexParser( /^[ !"$&'()*,.\/0-9;=?@A-Z\^_`a-z~\x80-\xFF+\-]+/ ),
makeRegexParser( /^[ !"$&'()*,./0-9;=?@A-Z^_`a-z~\x80-\xFF+-]+/ ),

function ( result ) {
return result.toString();
Expand Down Expand Up @@ -294,7 +294,8 @@
/*
* For success, the pos must have gotten to the end of the input
* and returned a non-null.
* n.b. This is part of language infrastructure, so we do not throw an internationalizable message.
* n.b. This is part of language infrastructure, so we do not throw an
* internationalizable message.
*/
if ( result === null || pos !== message.length ) {
throw new Error( 'Parse error at position ' + pos.toString() + ' in input: ' + message );
Expand Down
6 changes: 3 additions & 3 deletions src/languages/he.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
switch ( form ) {
case 'prefixed':
case 'תחילית': // the same word in Hebrew
// Duplicate prefixed "Waw", but only if it's not already double
// Duplicate prefixed "Waw", but only if it's not already double
if ( word.slice( 0, 1 ) === 'ו' && word.slice( 0, 2 ) !== 'וו' ) {
word = 'ו' + word;
}

// Remove the "He" if prefixed
// Remove the "He" if prefixed
if ( word.slice( 0, 1 ) === 'ה' ) {
word = word.slice( 1 );
}

// Add a hyphen (maqaf) before numbers and non-Hebrew letters
// Add a hyphen (maqaf) before numbers and non-Hebrew letters
if ( word.slice( 0, 1 ) < 'א' || word.slice( 0, 1 ) > 'ת' ) {
word = '־' + word;
}
Expand Down
3 changes: 1 addition & 2 deletions src/languages/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
// vowel 'U' in cyrillic Ossetic.
// Examples: {{grammar:genitive|аунеу}} = аунеуы,
// {{grammar:genitive|лæппу}} = лæппуйы.
if ( !word.slice( -2, -1 )
.match( /[аæеёиоыэюя]$/i ) ) {
if ( !word.slice( -2, -1 ).match( /[аæеёиоыэюя]$/i ) ) {
jot = 'й';
}
} else if ( !word.match( /[бвгджзйклмнопрстфхцчшщьъ]$/i ) ) {
Expand Down

0 comments on commit d93facf

Please sign in to comment.