stylelint: Enforce class name pattern

Change-Id: Ia41a08424f840d353eb7fc213815f7992da4a2ef
This commit is contained in:
Ed Sanders 2019-01-13 00:21:33 +00:00
parent 120b5896a3
commit 5461c56380
19 changed files with 31 additions and 15 deletions

View file

@ -1 +0,0 @@
lib/ve/.stylelintrc.json

6
.stylelintrc.json Normal file
View file

@ -0,0 +1,6 @@
{
"extends": "stylelint-config-wikimedia",
"rules": {
"selector-class-pattern": "^(ve|mw|oo-ui|client)-"
}
}

View file

@ -25,6 +25,7 @@
}
/* Mobile */
/* stylelint-disable-next-line selector-class-pattern */
.mw-body .heading-holder {
display: none;
}

View file

@ -4,6 +4,7 @@
* @copyright 2011-2019 VisualEditor Team and others; see http://ve.mit-license.org
*/
/* stylelint-disable-next-line selector-class-pattern */
.plainlinks a.ve-ce-linkAnnotation.ve-ce-annotation-active.external {
/*
* plainlinks is a MW core class which tries to suppress the normal
@ -19,7 +20,7 @@
* .ve-ce-linkAnnotation.ve-ce-annotation-active has as higher specificity
* than .external, so we need to re-override right padding
*/
/* stylelint-disable-next-line selector-class-pattern */
.ve-ce-linkAnnotation.ve-ce-annotation-active.external {
padding-right: 13px;
}

View file

@ -6,10 +6,12 @@
*/
/* Override tablesorter's cursor: pointer */
/* stylelint-disable-next-line selector-class-pattern */
.ve-ce-mwTableNode.jquery-tablesorter th.ve-ce-tableCellNode-header.headerSort {
cursor: default;
}
/* stylelint-disable-next-line selector-class-pattern */
.ve-ce-mwTableNode.jquery-tablesorter th.ve-ce-tableCellNode-header.ve-ce-tableCellNode-editing.headerSort {
cursor: text;
}

View file

@ -5,6 +5,7 @@
* @license The MIT License (MIT); see LICENSE.txt
*/
/* stylelint-disable-next-line selector-class-pattern */
.wikiEditor-ui-toolbar .ve-init-mw-editSwitch {
/* 12.8/12.7 */
font-size: 1.00787em;

View file

@ -5,6 +5,7 @@
* @license The MIT License (MIT); see LICENSE.txt
*/
/* stylelint-disable-next-line selector-class-pattern */
.skin-apex .ve-ui-surface {
margin-top: 0.8em;
}

View file

@ -5,6 +5,7 @@
* @license The MIT License (MIT); see LICENSE.txt
*/
/* stylelint-disable-next-line selector-class-pattern */
.ve-activated .vectorTabs .selected {
box-shadow: inset 0 -1px 0 #e1f1fc;
}
@ -73,8 +74,3 @@
margin-top: 1.71429em;
}
}
/* Prevent the progress bar from overlaying the welcome dialog */
.ve-init-mw-desktopArticleTarget-windowManager-welcome .oo-ui-dialog {
z-index: 2;
}

View file

@ -54,6 +54,7 @@
cursor: pointer;
}
/* stylelint-disable-next-line selector-class-pattern */
.ve-init-mw-desktopArticleTarget .redirectMsg a:hover {
text-decoration: none;
}

View file

@ -39,10 +39,13 @@
/* Swap the order to visually match the order in the actions menu */
/* Silly selector for high specificity to override Minerva styles */
/* stylelint-disable-next-line selector-class-pattern */
.content .mw-parser-output > * > span.mw-editsection {
display: flex;
}
/* stylelint-disable-next-line selector-class-pattern */
.content .mw-parser-output > * > span.mw-editsection .ve-edit-visual {
order: 2;
}

View file

@ -10,6 +10,7 @@
font-size: 1.28em; /* 0.8em / x-small */
}
/* stylelint-disable-next-line selector-class-pattern */
.mw-body a.external.ve-ce-linkAnnotation.ve-ce-annotation-active {
/* Reset -2px from VE-core */
margin-right: 0;

View file

@ -29,6 +29,7 @@
margin: 0.5em 0;
}
/* stylelint-disable-next-line selector-class-pattern */
.mw-body .external.ve-ce-linkAnnotation.ve-ce-annotation-active {
/* Reset -2px from VE-core */
margin-right: 0;

View file

@ -20,8 +20,7 @@ mw.libs.ve.WelcomeDialog = function VeInitWelcomeDialog( config ) {
mw.libs.ve.WelcomeDialog.super.call( this, config );
this.$element
.addClass( 've-init-mw-desktopArticleTarget-windowManager' )
.addClass( 've-init-mw-desktopArticleTarget-windowManager-welcome' );
.addClass( 've-init-mw-welcomeDialog' );
};
/* Inheritance */
@ -61,7 +60,7 @@ mw.libs.ve.WelcomeDialog.prototype.getSetupProcess = function ( data ) {
data = $.extend( {
title: mw.msg( 'visualeditor-welcomedialog-title', mw.user, mw.config.get( 'wgSiteName' ) ),
message: $( '<span>' )
.addClass( 'visualeditor-welcomedialog-content' )
.addClass( 've-init-mw-welcomeDialog-content' )
.append(
document.createTextNode( mw.msg( 'visualeditor-welcomedialog-content' ) ),
$( '<br>' ),

View file

@ -783,7 +783,7 @@ ve.ui.MWGalleryDialog.prototype.onHighlightItem = function ( item ) {
$( '<span>' ).append(
document.createTextNode( title.getMainText() + ' ' ),
$( '<a>' )
.addClass( 'visualeditor-dialog-media-content-description-link' )
.addClass( 've-ui-mwMediaDialog-description-link' )
.attr( 'href', title.getUrl() )
.attr( 'target', '_blank' )
.attr( 'rel', 'noopener' )

View file

@ -917,7 +917,7 @@ ve.ui.MWMediaDialog.prototype.updateFilenameFieldset = function () {
$( '<span>' ).append(
document.createTextNode( this.imageModel.getFilename() + ' ' ),
$( '<a>' )
.addClass( 'visualeditor-dialog-media-content-description-link' )
.addClass( 've-ui-mwMediaDialog-description-link' )
.attr( 'href', ve.resolveUrl( this.imageModel.getResourceName(), this.getFragment().getDocument().getHtmlDocument() ) )
.attr( 'target', '_blank' )
.attr( 'rel', 'noopener' )

View file

@ -79,6 +79,6 @@
margin-top: 0;
}
.visualeditor-dialog-media-content-description-link {
.ve-ui-mwMediaDialog-description-link {
font-size: 75%;
}

View file

@ -5,6 +5,7 @@
* @license The MIT License (MIT); see LICENSE.txt
*/
/* stylelint-disable-next-line selector-class-pattern */
.ve-ui-mwMobileSaveDialog .content {
margin: 0;
}

View file

@ -5,7 +5,7 @@
* @license The MIT License (MIT); see LICENSE.txt
*/
.visualeditor-welcomedialog-content:before {
.ve-init-mw-welcomeDialog-content:before {
content: '';
background: url( images/welcomeSplash-ltr.png ) center no-repeat;
background-size: contain;
@ -13,7 +13,7 @@
height: 8em;
}
.visualeditor-welcomedialog-content {
.ve-init-mw-welcomeDialog-content {
display: block;
text-align: center;
}

View file

@ -5,6 +5,8 @@
* @license The MIT License (MIT); see LICENSE.txt
*/
/* stylelint-disable selector-class-pattern */
.ve-ui-mwAceEditorWidget .ace_editor {
border: 1px solid #c8ccd1;
margin: 1px;

View file

@ -10,6 +10,7 @@
padding: 0;
}
/* stylelint-disable-next-line selector-class-pattern */
.ve-ui-mwCategoryItemWidget .oo-ui-labelElement-label.new {
color: #d33;
}