mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-24 06:13:54 +00:00
eslint: Remove exception for computed-property-spacing
Change-Id: Ief22145c02379bdb3d37c96c5e1ef50f0ab519cf
This commit is contained in:
parent
dc5077dbae
commit
6c53e320bf
|
@ -42,7 +42,6 @@
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
"object-property-newline": "error",
|
"object-property-newline": "error",
|
||||||
"computed-property-spacing": 0,
|
|
||||||
"no-use-before-define": 0,
|
"no-use-before-define": 0,
|
||||||
"no-underscore-dangle": 0
|
"no-underscore-dangle": 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
function getAndroidVersion( userAgent ) {
|
function getAndroidVersion( userAgent ) {
|
||||||
var match = userAgent.toLowerCase().match( /android\s(\d\.]*)/ );
|
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 ) {
|
function getChromeVersion( userAgent ) {
|
||||||
var match = userAgent.toLowerCase().match( /chrom(e|ium)\/(\d+)\./ );
|
var match = userAgent.toLowerCase().match( /chrom(e|ium)\/(\d+)\./ );
|
||||||
return match ? parseInt( match[2] ) : false;
|
return match ? parseInt( match[ 2 ] ) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
*/
|
*/
|
||||||
function getDeviceLanguage() {
|
function getDeviceLanguage() {
|
||||||
var lang = navigator && navigator.languages ?
|
var lang = navigator && navigator.languages ?
|
||||||
navigator.languages[0] :
|
navigator.languages[ 0 ] :
|
||||||
navigator.language || navigator.userLanguage ||
|
navigator.language || navigator.userLanguage ||
|
||||||
navigator.browserLanguage || navigator.systemLanguage;
|
navigator.browserLanguage || navigator.systemLanguage;
|
||||||
|
|
||||||
|
|
|
@ -147,13 +147,13 @@
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
// store it for later
|
// store it for later
|
||||||
allIssues[section] = issueSummaries;
|
allIssues[ section ] = issueSummaries;
|
||||||
|
|
||||||
if ( inline ) {
|
if ( inline ) {
|
||||||
issueSummaries.forEach( function ( issueSummary, i ) {
|
issueSummaries.forEach( function ( issueSummary, i ) {
|
||||||
var isGrouped = issueSummary.issue.grouped,
|
var isGrouped = issueSummary.issue.grouped,
|
||||||
lastIssueIsGrouped = issueSummaries[ i - 1] &&
|
lastIssueIsGrouped = issueSummaries[ i - 1 ] &&
|
||||||
issueSummaries[ i - 1].issue.grouped;
|
issueSummaries[ i - 1 ].issue.grouped;
|
||||||
// only render the first grouped issue of each group
|
// only render the first grouped issue of each group
|
||||||
if ( isGrouped && !lastIssueIsGrouped ) {
|
if ( isGrouped && !lastIssueIsGrouped ) {
|
||||||
createPageIssueBannerMultiple( issueSummary, mw.msg( 'skin-minerva-issue-learn-more' ), issueUrl, overlayManager );
|
createPageIssueBannerMultiple( issueSummary, mw.msg( 'skin-minerva-issue-learn-more' ), issueUrl, overlayManager );
|
||||||
|
@ -176,14 +176,14 @@
|
||||||
*/
|
*/
|
||||||
function getIssues( section ) {
|
function getIssues( section ) {
|
||||||
if ( section !== KEYWORD_ALL_SECTIONS ) {
|
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.
|
// 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.
|
// 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.
|
// If it's absent, we'll reduce all the other lists into one.
|
||||||
return allIssues.all || Object.keys( allIssues ).reduce(
|
return allIssues.all || Object.keys( allIssues ).reduce(
|
||||||
function ( all, key ) {
|
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 ) {
|
return Object.keys( allIssues ).reduce( function ( acc, section ) {
|
||||||
if ( allIssues[ section ].length ) {
|
if ( allIssues[ section ].length ) {
|
||||||
allIssues[ section ].forEach( function ( issue, i ) {
|
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,
|
// If the last issue belongs to a "Multiple issues" template,
|
||||||
// and so does the current one, don't add the current one.
|
// and so does the current one, don't add the current one.
|
||||||
if ( lastIssue && lastIssue.grouped && issue.grouped ) {
|
if ( lastIssue && lastIssue.grouped && issue.grouped ) {
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
function parseSeverity( box ) {
|
function parseSeverity( box ) {
|
||||||
var severity, identified;
|
var severity, identified;
|
||||||
identified = Object.keys( SEVERITY_REGEX ).some( function ( key ) {
|
identified = Object.keys( SEVERITY_REGEX ).some( function ( key ) {
|
||||||
var regex = SEVERITY_REGEX[key];
|
var regex = SEVERITY_REGEX[ key ];
|
||||||
severity = key;
|
severity = key;
|
||||||
return regex.test( box.className );
|
return regex.test( box.className );
|
||||||
} );
|
} );
|
||||||
|
@ -124,13 +124,13 @@
|
||||||
function parseType( box, severity ) {
|
function parseType( box, severity ) {
|
||||||
var identified, identifiedType;
|
var identified, identifiedType;
|
||||||
identified = Object.keys( TYPE_REGEX ).some( function ( type ) {
|
identified = Object.keys( TYPE_REGEX ).some( function ( type ) {
|
||||||
var regex = TYPE_REGEX[type];
|
var regex = TYPE_REGEX[ type ];
|
||||||
identifiedType = type;
|
identifiedType = type;
|
||||||
return regex.test( box.className );
|
return regex.test( box.className );
|
||||||
} );
|
} );
|
||||||
return {
|
return {
|
||||||
name: identified ? ICON_NAME.TYPE[identifiedType] : ICON_NAME.SEVERITY[severity],
|
name: identified ? ICON_NAME.TYPE[ identifiedType ] : ICON_NAME.SEVERITY[ severity ],
|
||||||
severity: identified ? TYPE_SEVERITY[identifiedType] : severity
|
severity: identified ? TYPE_SEVERITY[ identifiedType ] : severity
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
var nameSeverity = parseType( box, severity );
|
var nameSeverity = parseType( box, severity );
|
||||||
// The icon with color variant as expected by ResourceLoader,
|
// The icon with color variant as expected by ResourceLoader,
|
||||||
// {iconName}-{severityColorVariant}.
|
// {iconName}-{severityColorVariant}.
|
||||||
return nameSeverity.name + '-' + ICON_COLOR[nameSeverity.severity];
|
return nameSeverity.name + '-' + ICON_COLOR[ nameSeverity.severity ];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
*/
|
*/
|
||||||
function maxSeverity( severityLevels ) {
|
function maxSeverity( severityLevels ) {
|
||||||
return severityLevels.reduce( function ( max, severity ) {
|
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' );
|
}, 'DEFAULT' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
// fragment
|
// fragment
|
||||||
urlComponents = href.split( '#' );
|
urlComponents = href.split( '#' );
|
||||||
if ( urlComponents.length > 1 ) {
|
if ( urlComponents.length > 1 ) {
|
||||||
href = '#' + urlComponents[1];
|
href = '#' + urlComponents[ 1 ];
|
||||||
}
|
}
|
||||||
result = drawer.showReference( href, page, $dest.text() );
|
result = drawer.showReference( href, page, $dest.text() );
|
||||||
// Previously showReference method returns nothing so we check its truthy
|
// Previously showReference method returns nothing so we check its truthy
|
||||||
|
|
|
@ -72,9 +72,9 @@
|
||||||
];
|
];
|
||||||
tests.forEach( function ( params, i ) {
|
tests.forEach( function ( params, i ) {
|
||||||
var
|
var
|
||||||
className = params[0],
|
className = params[ 0 ],
|
||||||
expect = params[1],
|
expect = params[ 1 ],
|
||||||
test = params[2],
|
test = params[ 2 ],
|
||||||
box = newBox( className );
|
box = newBox( className );
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
pageIssuesParser.test.parseSeverity( box ),
|
pageIssuesParser.test.parseSeverity( box ),
|
||||||
|
@ -97,13 +97,13 @@
|
||||||
];
|
];
|
||||||
tests.forEach( function ( params, i ) {
|
tests.forEach( function ( params, i ) {
|
||||||
var
|
var
|
||||||
className = params[0],
|
className = params[ 0 ],
|
||||||
severity = params[1],
|
severity = params[ 1 ],
|
||||||
expect = {
|
expect = {
|
||||||
name: params[2],
|
name: params[ 2 ],
|
||||||
severity: severity
|
severity: severity
|
||||||
},
|
},
|
||||||
test = params[3],
|
test = params[ 3 ],
|
||||||
box = newBox( className );
|
box = newBox( className );
|
||||||
assert.propEqual(
|
assert.propEqual(
|
||||||
pageIssuesParser.test.parseType( box, severity ),
|
pageIssuesParser.test.parseType( box, severity ),
|
||||||
|
@ -121,9 +121,9 @@
|
||||||
];
|
];
|
||||||
tests.forEach( function ( params, i ) {
|
tests.forEach( function ( params, i ) {
|
||||||
var
|
var
|
||||||
parentClassName = params[0],
|
parentClassName = params[ 0 ],
|
||||||
expect = params[1],
|
expect = params[ 1 ],
|
||||||
test = params[2],
|
test = params[ 2 ],
|
||||||
parent,
|
parent,
|
||||||
box = newBox( '' );
|
box = newBox( '' );
|
||||||
if ( parentClassName !== undefined ) {
|
if ( parentClassName !== undefined ) {
|
||||||
|
@ -154,9 +154,9 @@
|
||||||
];
|
];
|
||||||
tests.forEach( function ( params, i ) {
|
tests.forEach( function ( params, i ) {
|
||||||
var
|
var
|
||||||
className = params[0],
|
className = params[ 0 ],
|
||||||
severity = params[1],
|
severity = params[ 1 ],
|
||||||
expect = params[2],
|
expect = params[ 2 ],
|
||||||
box = newBox( className );
|
box = newBox( className );
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
pageIssuesParser.iconName( box, severity ),
|
pageIssuesParser.iconName( box, severity ),
|
||||||
|
@ -177,8 +177,8 @@
|
||||||
[ [ 'DEFAULT', 'HIGH', 'LOW', 'MEDIUM' ], 'HIGH' ]
|
[ [ 'DEFAULT', 'HIGH', 'LOW', 'MEDIUM' ], 'HIGH' ]
|
||||||
];
|
];
|
||||||
tests.forEach( function ( params, i ) {
|
tests.forEach( function ( params, i ) {
|
||||||
var severities = params[0],
|
var severities = params[ 0 ],
|
||||||
expect = params[1];
|
expect = params[ 1 ];
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
pageIssuesParser.maxSeverity( severities ),
|
pageIssuesParser.maxSeverity( severities ),
|
||||||
|
|
Loading…
Reference in a new issue