From 5461c5638095440fb6e0d384741e983c8a5be628 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Sun, 13 Jan 2019 00:21:33 +0000 Subject: [PATCH] stylelint: Enforce class name pattern Change-Id: Ia41a08424f840d353eb7fc213815f7992da4a2ef --- .stylelintrc.json | 7 ++++++- modules/ve-mw-collab/ve.init.mw.CollabTarget.css | 1 + .../styles/annotations/ve.ce.MWExternalLinkAnnotation.css | 3 ++- modules/ve-mw/ce/styles/nodes/ve.ce.MWTableNode.css | 2 ++ .../styles/ve.init.MWVESwitchConfirmDialog-monobook.css | 1 + .../init/styles/ve.init.mw.DesktopArticleTarget-apex.css | 1 + .../init/styles/ve.init.mw.DesktopArticleTarget-vector.css | 6 +----- .../ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.css | 1 + .../ve.init.mw.DesktopArticleTarget.init-minerva.css | 3 +++ .../init/styles/ve.init.mw.DesktopTarget-monobook.css | 1 + .../ve-mw/init/styles/ve.init.mw.DesktopTarget-vector.css | 1 + modules/ve-mw/init/ve.init.MWWelcomeDialog.js | 5 ++--- modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js | 2 +- modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js | 2 +- modules/ve-mw/ui/styles/dialogs/ve.ui.MWMediaDialog.css | 2 +- .../ve-mw/ui/styles/dialogs/ve.ui.MWMobileSaveDialog.css | 1 + modules/ve-mw/ui/styles/dialogs/ve.ui.MWWelcomeDialog.css | 4 ++-- .../ve-mw/ui/styles/widgets/ve.ui.MWAceEditorWidget.css | 2 ++ .../ve-mw/ui/styles/widgets/ve.ui.MWCategoryItemWidget.css | 1 + 19 files changed, 31 insertions(+), 15 deletions(-) mode change 120000 => 100644 .stylelintrc.json diff --git a/.stylelintrc.json b/.stylelintrc.json deleted file mode 120000 index a9ace292f4..0000000000 --- a/.stylelintrc.json +++ /dev/null @@ -1 +0,0 @@ -lib/ve/.stylelintrc.json \ No newline at end of file diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 0000000000..d025dc9595 --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,6 @@ +{ + "extends": "stylelint-config-wikimedia", + "rules": { + "selector-class-pattern": "^(ve|mw|oo-ui|client)-" + } +} diff --git a/modules/ve-mw-collab/ve.init.mw.CollabTarget.css b/modules/ve-mw-collab/ve.init.mw.CollabTarget.css index ebda838c88..03bd8f39dd 100644 --- a/modules/ve-mw-collab/ve.init.mw.CollabTarget.css +++ b/modules/ve-mw-collab/ve.init.mw.CollabTarget.css @@ -25,6 +25,7 @@ } /* Mobile */ +/* stylelint-disable-next-line selector-class-pattern */ .mw-body .heading-holder { display: none; } diff --git a/modules/ve-mw/ce/styles/annotations/ve.ce.MWExternalLinkAnnotation.css b/modules/ve-mw/ce/styles/annotations/ve.ce.MWExternalLinkAnnotation.css index 874cbbbcce..1d55ebbe43 100644 --- a/modules/ve-mw/ce/styles/annotations/ve.ce.MWExternalLinkAnnotation.css +++ b/modules/ve-mw/ce/styles/annotations/ve.ce.MWExternalLinkAnnotation.css @@ -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; } diff --git a/modules/ve-mw/ce/styles/nodes/ve.ce.MWTableNode.css b/modules/ve-mw/ce/styles/nodes/ve.ce.MWTableNode.css index 0aeb2e727a..e856abe00a 100644 --- a/modules/ve-mw/ce/styles/nodes/ve.ce.MWTableNode.css +++ b/modules/ve-mw/ce/styles/nodes/ve.ce.MWTableNode.css @@ -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; } diff --git a/modules/ve-mw/init/styles/ve.init.MWVESwitchConfirmDialog-monobook.css b/modules/ve-mw/init/styles/ve.init.MWVESwitchConfirmDialog-monobook.css index feae17bf03..e7f6c94674 100644 --- a/modules/ve-mw/init/styles/ve.init.MWVESwitchConfirmDialog-monobook.css +++ b/modules/ve-mw/init/styles/ve.init.MWVESwitchConfirmDialog-monobook.css @@ -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; diff --git a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-apex.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-apex.css index 21ec554198..6448208a64 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-apex.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-apex.css @@ -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; } diff --git a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-vector.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-vector.css index ba6bf15800..e16e20b757 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-vector.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-vector.css @@ -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; -} diff --git a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.css index 53663cf224..18a0348695 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.css @@ -54,6 +54,7 @@ cursor: pointer; } +/* stylelint-disable-next-line selector-class-pattern */ .ve-init-mw-desktopArticleTarget .redirectMsg a:hover { text-decoration: none; } diff --git a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init-minerva.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init-minerva.css index ebe06cd6f7..1c28a3f5c0 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init-minerva.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init-minerva.css @@ -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; } diff --git a/modules/ve-mw/init/styles/ve.init.mw.DesktopTarget-monobook.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopTarget-monobook.css index 7474286423..d270c66bfd 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.DesktopTarget-monobook.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopTarget-monobook.css @@ -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; diff --git a/modules/ve-mw/init/styles/ve.init.mw.DesktopTarget-vector.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopTarget-vector.css index 9ac34472bc..e624982ab2 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.DesktopTarget-vector.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopTarget-vector.css @@ -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; diff --git a/modules/ve-mw/init/ve.init.MWWelcomeDialog.js b/modules/ve-mw/init/ve.init.MWWelcomeDialog.js index a3ea51bff0..8fd4b05b1f 100644 --- a/modules/ve-mw/init/ve.init.MWWelcomeDialog.js +++ b/modules/ve-mw/init/ve.init.MWWelcomeDialog.js @@ -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: $( '' ) - .addClass( 'visualeditor-welcomedialog-content' ) + .addClass( 've-init-mw-welcomeDialog-content' ) .append( document.createTextNode( mw.msg( 'visualeditor-welcomedialog-content' ) ), $( '
' ), diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index be7549e6c2..96e3869c08 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -783,7 +783,7 @@ ve.ui.MWGalleryDialog.prototype.onHighlightItem = function ( item ) { $( '' ).append( document.createTextNode( title.getMainText() + ' ' ), $( '' ) - .addClass( 'visualeditor-dialog-media-content-description-link' ) + .addClass( 've-ui-mwMediaDialog-description-link' ) .attr( 'href', title.getUrl() ) .attr( 'target', '_blank' ) .attr( 'rel', 'noopener' ) diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js index f353b14ee9..5861b9cab1 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js @@ -917,7 +917,7 @@ ve.ui.MWMediaDialog.prototype.updateFilenameFieldset = function () { $( '' ).append( document.createTextNode( this.imageModel.getFilename() + ' ' ), $( '' ) - .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' ) diff --git a/modules/ve-mw/ui/styles/dialogs/ve.ui.MWMediaDialog.css b/modules/ve-mw/ui/styles/dialogs/ve.ui.MWMediaDialog.css index 2349c5e605..b29cc87f8d 100644 --- a/modules/ve-mw/ui/styles/dialogs/ve.ui.MWMediaDialog.css +++ b/modules/ve-mw/ui/styles/dialogs/ve.ui.MWMediaDialog.css @@ -79,6 +79,6 @@ margin-top: 0; } -.visualeditor-dialog-media-content-description-link { +.ve-ui-mwMediaDialog-description-link { font-size: 75%; } diff --git a/modules/ve-mw/ui/styles/dialogs/ve.ui.MWMobileSaveDialog.css b/modules/ve-mw/ui/styles/dialogs/ve.ui.MWMobileSaveDialog.css index 62a7f24882..ba55f034a3 100644 --- a/modules/ve-mw/ui/styles/dialogs/ve.ui.MWMobileSaveDialog.css +++ b/modules/ve-mw/ui/styles/dialogs/ve.ui.MWMobileSaveDialog.css @@ -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; } diff --git a/modules/ve-mw/ui/styles/dialogs/ve.ui.MWWelcomeDialog.css b/modules/ve-mw/ui/styles/dialogs/ve.ui.MWWelcomeDialog.css index ef4b2cfcfb..ad88d4f3df 100644 --- a/modules/ve-mw/ui/styles/dialogs/ve.ui.MWWelcomeDialog.css +++ b/modules/ve-mw/ui/styles/dialogs/ve.ui.MWWelcomeDialog.css @@ -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; } diff --git a/modules/ve-mw/ui/styles/widgets/ve.ui.MWAceEditorWidget.css b/modules/ve-mw/ui/styles/widgets/ve.ui.MWAceEditorWidget.css index b7e00fbbf3..8906815077 100644 --- a/modules/ve-mw/ui/styles/widgets/ve.ui.MWAceEditorWidget.css +++ b/modules/ve-mw/ui/styles/widgets/ve.ui.MWAceEditorWidget.css @@ -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; diff --git a/modules/ve-mw/ui/styles/widgets/ve.ui.MWCategoryItemWidget.css b/modules/ve-mw/ui/styles/widgets/ve.ui.MWCategoryItemWidget.css index a57257085d..49252b5aa3 100644 --- a/modules/ve-mw/ui/styles/widgets/ve.ui.MWCategoryItemWidget.css +++ b/modules/ve-mw/ui/styles/widgets/ve.ui.MWCategoryItemWidget.css @@ -10,6 +10,7 @@ padding: 0; } +/* stylelint-disable-next-line selector-class-pattern */ .ve-ui-mwCategoryItemWidget .oo-ui-labelElement-label.new { color: #d33; }