-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Stylelint #3736
Add Stylelint #3736
Changes from 2 commits
e745065
6fdef6e
30de9ce
3e14e8c
0927e48
8e27f84
502acf0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
extends: 'stylelint-config-standard-scss', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's the config for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Q] Any rules that are missing that we should have turned on? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think some of the rules for "Max and min" would be useful for us as most of our current problems originate from that. max-nesting-depth There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added max and min rules!
Had multiple accounts of I think having a max of two for each of these is a good thing to aim for in the future but we could discuss numbers for each in the future! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
rules: { | ||
'custom-property-pattern': null, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a mixture of camelCase and kebab case rules in our styles thanks to our own CSS module classes, targeting 3rd party components like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can't control other packages but I think we use camelCase, right? We should turn on and exclude files/lines where we can't update. It will probably encourage us to wrap external modules in specific places instead of using them all throughout the code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All kebab-case rules should be inside
Not sure if it applies in this case, but if we can ignore global we could set the rule correctly to camelCase. On another note (out of scope), unless it's really specific to the current CSS module ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will need to move turning on camelCase rules to a followup. Turns out it involves adjusting quite a few files :) |
||
'selector-class-pattern': null, | ||
'scss/percent-placeholder-pattern': null, | ||
'selector-pseudo-class-no-unknown': null, | ||
'scss/percent-placeholder-pattern': null | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* stylelint-disable no-descending-specificity */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Personally, I think taking care of these will lower the chance of specificity issues and clean things up more but we could also consider turning off this rule entirely if we think it's too strict to upkeep. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it is a useful rule we should fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be really good to fix these. It might be too big for this PR, but a follow up just for this would be great. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Glad we're all in agreement! Will plan to do this in a followup. |
||
// Variables | ||
|
||
@import '../../../shared/variables.scss'; | ||
@import '../../../shared/mixins.scss'; | ||
@import '../../../shared/variables'; | ||
@import '../../../shared/mixins'; | ||
|
||
$nested-row-padding: 1.35rem; | ||
$row-border: 1px solid $border-color; | ||
|
||
$edge-padding: 0.8rem; | ||
$cell-padding: 0.5rem; | ||
$workspace-row-edge-margin: $edge-padding - $cell-padding; | ||
|
@@ -50,6 +50,7 @@ $badge-size: 0.85rem; | |
align-items: center; | ||
width: 100%; | ||
height: 100%; | ||
|
||
&:hover { | ||
& .copyButton { | ||
display: block; | ||
|
@@ -85,6 +86,10 @@ $badge-size: 0.85rem; | |
text-overflow: ellipsis; | ||
} | ||
|
||
%noSelect { | ||
user-select: none; | ||
} | ||
|
||
// Concrete selectors | ||
|
||
@keyframes spin { | ||
|
@@ -93,12 +98,9 @@ $badge-size: 0.85rem; | |
} | ||
} | ||
|
||
.noSelect { | ||
user-select: none; | ||
} | ||
|
||
.isColumnResizing { | ||
@extend .noSelect; | ||
@extend %noSelect; | ||
|
||
cursor: col-resize; | ||
|
||
* { | ||
|
@@ -148,7 +150,7 @@ $badge-size: 0.85rem; | |
|
||
.experimentsTable.withExpColumnShadow .experimentsTr > *:first-child { | ||
&::after { | ||
box-shadow: 3px 0px 3px $shadow; | ||
box-shadow: 3px 0 3px $shadow; | ||
} | ||
|
||
> div::after { | ||
|
@@ -161,13 +163,13 @@ $badge-size: 0.85rem; | |
position: relative; | ||
border: none; | ||
background: none; | ||
padding: 0; | ||
text-align: center; | ||
padding: 0.25rem; | ||
margin: 0.025rem; | ||
width: 1.5rem; | ||
height: 1.5rem; | ||
cursor: pointer; | ||
|
||
svg { | ||
fill: $icon-color; | ||
} | ||
|
@@ -220,17 +222,18 @@ $badge-size: 0.85rem; | |
|
||
.experimentsTh { | ||
height: auto; | ||
background-color: $header-bg-color; | ||
font-size: 0.7rem; | ||
background-color: $header-bg-color; | ||
|
||
&::before { | ||
@extend %cellBorderLeft; | ||
|
||
background-color: $header-border-color; | ||
} | ||
|
||
.cellContents { | ||
@extend %truncateLeftChild; | ||
|
||
display: block; | ||
|
||
span[draggable='true'] { | ||
|
@@ -297,9 +300,7 @@ $badge-size: 0.85rem; | |
|
||
.dropTargetHeaderCell { | ||
background: $header-dnd-drop-background; | ||
outline-width: 2px; | ||
outline-style: dashed; | ||
outline-color: $header-dnd-outline; | ||
outline: $header-dnd-outline dashed 2px; | ||
outline-offset: -4px; | ||
|
||
.iconMenu ul[role='menu'] { | ||
|
@@ -330,14 +331,15 @@ $badge-size: 0.85rem; | |
ul[role='menu'] { | ||
background-color: $header-bg-color; | ||
padding-left: 2px; | ||
margin: 0px 0px 0px 4px; | ||
margin: 0 0 0 4px; | ||
border: none; | ||
|
||
button { | ||
width: 13px; | ||
height: 11px; | ||
|
||
svg { | ||
fill: currentColor; | ||
fill: currentcolor; | ||
transform: scale(0.7); | ||
} | ||
} | ||
|
@@ -355,6 +357,7 @@ $badge-size: 0.85rem; | |
|
||
.timestampHeader { | ||
@extend %headerCellPadding; | ||
|
||
overflow-x: hidden; | ||
text-overflow: ellipsis; | ||
text-align: left; | ||
|
@@ -363,6 +366,7 @@ $badge-size: 0.85rem; | |
|
||
.experimentHeader { | ||
@extend %headerCellPadding; | ||
|
||
padding-left: $cell-padding; | ||
text-align: left; | ||
direction: ltr; | ||
|
@@ -373,8 +377,10 @@ $badge-size: 0.85rem; | |
.headerCellText { | ||
@extend %truncateLeftParent; | ||
@extend %headerCellPadding; | ||
|
||
direction: rtl; | ||
opacity: 0.6; | ||
|
||
// to prevent extra dragLeave and dragEnter fired | ||
// should be on parent div, not span to work on text-overflow: ellipsis | ||
pointer-events: none; | ||
|
@@ -543,6 +549,7 @@ $badge-size: 0.85rem; | |
|
||
.innerCell { | ||
@extend %baseInnerCell; | ||
|
||
justify-content: flex-end; | ||
} | ||
|
||
|
@@ -596,6 +603,7 @@ $badge-size: 0.85rem; | |
|
||
.indicatorCount { | ||
z-index: 2; | ||
|
||
&[title='0'] { | ||
display: none; | ||
} | ||
|
@@ -653,7 +661,7 @@ $badge-size: 0.85rem; | |
|
||
.normalExperiment & { | ||
line-height: 0; | ||
background: currentColor; | ||
background: currentcolor; | ||
border-radius: 100%; | ||
} | ||
|
||
|
@@ -671,8 +679,8 @@ $badge-size: 0.85rem; | |
vertical-align: middle; | ||
border: 1.5px solid $checkbox-background; | ||
border-radius: 100%; | ||
border-right: 1.5px solid currentColor; | ||
border-top: 1.5px solid currentColor; | ||
border-right: 1.5px solid currentcolor; | ||
border-top: 1.5px solid currentcolor; | ||
animation: spin 1s cubic-bezier(0.53, 0.21, 0.29, 0.67) infinite; | ||
background-color: $checkbox-background; | ||
} | ||
|
@@ -704,6 +712,7 @@ $badge-size: 0.85rem; | |
|
||
.expandedRowArrow { | ||
@extend %expandableRowArrow; | ||
|
||
transform: rotate(45deg); | ||
right: 1px; | ||
bottom: 2px; | ||
|
@@ -715,6 +724,7 @@ $badge-size: 0.85rem; | |
|
||
.contractedRowArrow { | ||
@extend %expandableRowArrow; | ||
|
||
transform: rotate(-45deg); | ||
right: 4px; | ||
bottom: 0; | ||
|
@@ -729,7 +739,8 @@ $badge-size: 0.85rem; | |
} | ||
|
||
.experimentCellText { | ||
@extend .cellContents; | ||
@extend %cellContentsBase; | ||
|
||
display: block; | ||
line-height: normal; | ||
direction: ltr; | ||
|
@@ -804,18 +815,21 @@ $badge-size: 0.85rem; | |
.timestampInnerCell { | ||
@extend %baseInnerCell; | ||
@extend %truncateLeftParent; | ||
|
||
line-height: normal; | ||
text-align: left; | ||
height: 32px; | ||
} | ||
|
||
.timestampDate { | ||
@extend %truncateLeftChild; | ||
|
||
font-size: 0.7em; | ||
} | ||
|
||
.timestampTime { | ||
@extend %truncateLeftChild; | ||
|
||
font-size: 0.9em; | ||
} | ||
|
||
|
@@ -858,6 +872,7 @@ $badge-size: 0.85rem; | |
|
||
.buttonAsLink { | ||
@extend %link; | ||
|
||
background: none; | ||
border: none; | ||
padding: 0; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, only
webview
has CSS but I chose to make it global since the VSCode extension for stylelint requires the workspace to have stylelint and config file to be in the root of the workspace. Any reasons not too though?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move as set
stylelint.config
in the.vscode/settings
file? or is there another option?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And do we need to disable the built-in linters as per: https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint#disable-vs-codes-built-in-linters-optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got the hot tip that:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Disabled now.
On further research
stylelint-config-prettier
is depreciated andsass-guidelines
is indeed in use inside of our current scss plugin!I managed to move our stylelint config file to be inside of webview but I couldn't figure out a way to move stylelint packages inside of
webview
.I tried to install stylelint packages inside of
webview
via thestylelint.stylelintPath
config option, butstylelint
kept getting installed inside the root for some reason, even after moving packages inside ofwebview/package.json
, deletingnode_modules
, and starting out of a fresh install. I even tried to revertyarn.lock
to a previous commit and fresh install the packages butstylelint
still appeared inside of/node_modules
instead of/webview/node_modules
. Kept the packages installed in the root for now but can revisit this later