diff --git a/.eslintrc.json b/.eslintrc.json index c8c03e1..2c59667 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -42,7 +42,6 @@ } }], "object-property-newline": "error", - "computed-property-spacing": 0, "no-use-before-define": 0, "no-underscore-dangle": 0 } diff --git a/resources/skins.minerva.scripts/downloadPageAction.js b/resources/skins.minerva.scripts/downloadPageAction.js index d65125d..03c594b 100644 --- a/resources/skins.minerva.scripts/downloadPageAction.js +++ b/resources/skins.minerva.scripts/downloadPageAction.js @@ -15,7 +15,7 @@ */ function getAndroidVersion( userAgent ) { var match = userAgent.toLowerCase().match( /android\s(\d\.]*)/ ); - return match ? parseInt( match[1] ) : false; + return match ? parseInt( match[ 1 ] ) : false; } /** @@ -26,7 +26,7 @@ */ function getChromeVersion( userAgent ) { var match = userAgent.toLowerCase().match( /chrom(e|ium)\/(\d+)\./ ); - return match ? parseInt( match[2] ) : false; + return match ? parseInt( match[ 2 ] ) : false; } /** diff --git a/resources/skins.minerva.scripts/init.js b/resources/skins.minerva.scripts/init.js index 3918ff2..e8acfbc 100644 --- a/resources/skins.minerva.scripts/init.js +++ b/resources/skins.minerva.scripts/init.js @@ -85,7 +85,7 @@ */ function getDeviceLanguage() { var lang = navigator && navigator.languages ? - navigator.languages[0] : + navigator.languages[ 0 ] : navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage; diff --git a/resources/skins.minerva.scripts/pageIssues.js b/resources/skins.minerva.scripts/pageIssues.js index 66ddd53..5e04be7 100644 --- a/resources/skins.minerva.scripts/pageIssues.js +++ b/resources/skins.minerva.scripts/pageIssues.js @@ -147,13 +147,13 @@ } } ); // store it for later - allIssues[section] = issueSummaries; + allIssues[ section ] = issueSummaries; if ( inline ) { issueSummaries.forEach( function ( issueSummary, i ) { var isGrouped = issueSummary.issue.grouped, - lastIssueIsGrouped = issueSummaries[ i - 1] && - issueSummaries[ i - 1].issue.grouped; + lastIssueIsGrouped = issueSummaries[ i - 1 ] && + issueSummaries[ i - 1 ].issue.grouped; // only render the first grouped issue of each group if ( isGrouped && !lastIssueIsGrouped ) { createPageIssueBannerMultiple( issueSummary, mw.msg( 'skin-minerva-issue-learn-more' ), issueUrl, overlayManager ); @@ -176,14 +176,14 @@ */ function getIssues( section ) { if ( section !== KEYWORD_ALL_SECTIONS ) { - return allIssues[section] || []; + return allIssues[ section ] || []; } // Note section.all may not exist, depending on the structure of the HTML page. // It will only exist when Minerva has been run in desktop mode. // If it's absent, we'll reduce all the other lists into one. return allIssues.all || Object.keys( allIssues ).reduce( function ( all, key ) { - return all.concat( allIssues[key] ); + return all.concat( allIssues[ key ] ); }, [] ); @@ -200,7 +200,7 @@ return Object.keys( allIssues ).reduce( function ( acc, section ) { if ( allIssues[ section ].length ) { allIssues[ section ].forEach( function ( issue, i ) { - var lastIssue = allIssues[ section ][i - 1]; + var lastIssue = allIssues[ section ][ i - 1 ]; // If the last issue belongs to a "Multiple issues" template, // and so does the current one, don't add the current one. if ( lastIssue && lastIssue.grouped && issue.grouped ) { diff --git a/resources/skins.minerva.scripts/pageIssuesParser.js b/resources/skins.minerva.scripts/pageIssuesParser.js index a667c64..1c3a626 100644 --- a/resources/skins.minerva.scripts/pageIssuesParser.js +++ b/resources/skins.minerva.scripts/pageIssuesParser.js @@ -109,7 +109,7 @@ function parseSeverity( box ) { var severity, identified; identified = Object.keys( SEVERITY_REGEX ).some( function ( key ) { - var regex = SEVERITY_REGEX[key]; + var regex = SEVERITY_REGEX[ key ]; severity = key; return regex.test( box.className ); } ); @@ -124,13 +124,13 @@ function parseType( box, severity ) { var identified, identifiedType; identified = Object.keys( TYPE_REGEX ).some( function ( type ) { - var regex = TYPE_REGEX[type]; + var regex = TYPE_REGEX[ type ]; identifiedType = type; return regex.test( box.className ); } ); return { - name: identified ? ICON_NAME.TYPE[identifiedType] : ICON_NAME.SEVERITY[severity], - severity: identified ? TYPE_SEVERITY[identifiedType] : severity + name: identified ? ICON_NAME.TYPE[ identifiedType ] : ICON_NAME.SEVERITY[ severity ], + severity: identified ? TYPE_SEVERITY[ identifiedType ] : severity }; } @@ -151,7 +151,7 @@ var nameSeverity = parseType( box, severity ); // The icon with color variant as expected by ResourceLoader, // {iconName}-{severityColorVariant}. - return nameSeverity.name + '-' + ICON_COLOR[nameSeverity.severity]; + return nameSeverity.name + '-' + ICON_COLOR[ nameSeverity.severity ]; } /** @@ -160,7 +160,7 @@ */ function maxSeverity( severityLevels ) { return severityLevels.reduce( function ( max, severity ) { - return SEVERITY_LEVEL[max] > SEVERITY_LEVEL[severity] ? max : severity; + return SEVERITY_LEVEL[ max ] > SEVERITY_LEVEL[ severity ] ? max : severity; }, 'DEFAULT' ); } diff --git a/resources/skins.minerva.scripts/references.js b/resources/skins.minerva.scripts/references.js index 1e1e72c..8ecaa7a 100644 --- a/resources/skins.minerva.scripts/references.js +++ b/resources/skins.minerva.scripts/references.js @@ -49,7 +49,7 @@ // fragment urlComponents = href.split( '#' ); if ( urlComponents.length > 1 ) { - href = '#' + urlComponents[1]; + href = '#' + urlComponents[ 1 ]; } result = drawer.showReference( href, page, $dest.text() ); // Previously showReference method returns nothing so we check its truthy diff --git a/tests/qunit/skins.minerva.scripts/pageIssuesParser.test.js b/tests/qunit/skins.minerva.scripts/pageIssuesParser.test.js index 367671f..3402b77 100644 --- a/tests/qunit/skins.minerva.scripts/pageIssuesParser.test.js +++ b/tests/qunit/skins.minerva.scripts/pageIssuesParser.test.js @@ -72,9 +72,9 @@ ]; tests.forEach( function ( params, i ) { var - className = params[0], - expect = params[1], - test = params[2], + className = params[ 0 ], + expect = params[ 1 ], + test = params[ 2 ], box = newBox( className ); assert.strictEqual( pageIssuesParser.test.parseSeverity( box ), @@ -97,13 +97,13 @@ ]; tests.forEach( function ( params, i ) { var - className = params[0], - severity = params[1], + className = params[ 0 ], + severity = params[ 1 ], expect = { - name: params[2], + name: params[ 2 ], severity: severity }, - test = params[3], + test = params[ 3 ], box = newBox( className ); assert.propEqual( pageIssuesParser.test.parseType( box, severity ), @@ -121,9 +121,9 @@ ]; tests.forEach( function ( params, i ) { var - parentClassName = params[0], - expect = params[1], - test = params[2], + parentClassName = params[ 0 ], + expect = params[ 1 ], + test = params[ 2 ], parent, box = newBox( '' ); if ( parentClassName !== undefined ) { @@ -154,9 +154,9 @@ ]; tests.forEach( function ( params, i ) { var - className = params[0], - severity = params[1], - expect = params[2], + className = params[ 0 ], + severity = params[ 1 ], + expect = params[ 2 ], box = newBox( className ); assert.strictEqual( pageIssuesParser.iconName( box, severity ), @@ -177,8 +177,8 @@ [ [ 'DEFAULT', 'HIGH', 'LOW', 'MEDIUM' ], 'HIGH' ] ]; tests.forEach( function ( params, i ) { - var severities = params[0], - expect = params[1]; + var severities = params[ 0 ], + expect = params[ 1 ]; assert.strictEqual( pageIssuesParser.maxSeverity( severities ),