Skip to content
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

[stylelint-polaris] Custom stylelint messages #7696

Merged
merged 23 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
01093df
[stylelint-polaris] PoC for custom messages
chloerice Nov 10, 2022
a4aea47
Refactor with secondary category options and utility supported functi…
chloerice Dec 6, 2022
a10fcc9
Updated the messages for custom properties allowed list plugin
chloerice Dec 7, 2022
1a3e10c
Updated the messages for custom media queries allowed list plugin
chloerice Dec 7, 2022
5a08d4d
Add dynamic rule metadata
chloerice Dec 7, 2022
1031674
fix typo in README.md
chloerice Dec 7, 2022
16e82fc
Move coverage config description to the config type
chloerice Dec 7, 2022
c86332e
fix util typos
chloerice Dec 7, 2022
23a027e
doc other rule func param
chloerice Dec 7, 2022
50ecd1c
fix args for at-rule-disallowed-list
chloerice Dec 7, 2022
d5242e8
Append stylelint rule name to coverage category rule name; only allow…
chloerice Dec 8, 2022
1fd86a1
cleanup plugin namespace, names, and messages
chloerice Dec 9, 2022
5ca3ab0
continue drafting rules section of README.md...
chloerice Dec 9, 2022
047ae87
revert README.md changes (creating separate PR)
chloerice Dec 9, 2022
b03c5ee
change log entry
chloerice Dec 9, 2022
ce0804f
update at-rule-disallowed-list message
chloerice Dec 9, 2022
aa2d926
fix custom-propert-allowed-list message
chloerice Dec 9, 2022
2710d40
update disable comments for custom-property-allowed-list rename
chloerice Dec 9, 2022
05e1c72
PR review fixes
chloerice Dec 9, 2022
f152ccd
revert removal of duplicate namespace; fix custom-property-allowed-li…
chloerice Dec 9, 2022
625db06
more feedback updates
chloerice Dec 12, 2022
c989fb3
generate meta URL from config instead of hard code
chloerice Dec 13, 2022
8a9e30a
Fix disable comments (needless, missing dashes)
chloerice Dec 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thirty-jobs-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/stylelint-polaris': patch
---

Implemented custom message configuration support for polaris/coverage plugin
4 changes: 2 additions & 2 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/** @type {import('stylelint').Config} */
module.exports = {
extends: ['@shopify/stylelint-plugin/prettier', './stylelint-polaris'],
// Disabling @shopify/stylelint-plugin/configs/core no-unknown-animations as stylelint
// is not aware of global Polaris keyframes
// Disabling @shopify/stylelint-plugin/configs/core no-unknown-animations as stylelint is not aware of global Polaris keyframes
// TODO: create custom plugin to ensure animation-names match Polaris keyframe names
customSyntax: 'postcss-scss',
rules: {
'no-unknown-animations': null,
'value-keyword-case': ['lower', {camelCaseSvgKeywords: true}],
Expand Down
7 changes: 3 additions & 4 deletions polaris-react/src/components/Button/Button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
.plain {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@include recolor-icon(var(--p-interactive));
// stylelint-disable-next-line polaris/conventions/polaris/custom-properties-allowed-list -- generated by polaris-migrator DO NOT COPY
// stylelint-disable-next-line -- polaris/conventions/polaris/custom-property-allowed-list
margin: calc(-1 * var(--pc-button-vertical-padding))
calc(-1 * var(--p-space-2));
padding-left: var(--p-space-2);
Expand Down Expand Up @@ -357,10 +357,10 @@
}

&.sizeLarge {
// stylelint-disable polaris/conventions/polaris/custom-properties-allowed-list -- generated by polaris-migrator DO NOT COPY
// stylelint-disable -- polaris/conventions/polaris/custom-property-allowed-list
margin: calc(-1 * var(--pc-button-large-vertical-padding))
calc(-1 * var(--p-space-5));
// stylelint-enable polaris/conventions/polaris/custom-properties-allowed-list
// stylelint-enable -- polaris/conventions/polaris/custom-property-allowed-list
}

&.iconOnly {
Expand Down Expand Up @@ -411,7 +411,6 @@
margin-right: 0;
}
}
// stylelint-enable selector-max-specificity, selector-max-class

.fullWidth {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
Expand Down
3 changes: 1 addition & 2 deletions polaris-react/src/components/DropZone/DropZone.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ $dropzone-stacking-order: (
&:not(.focused) {
&::after {
@include reset-after;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY

@include set-border-radius;
border-color: var(--p-border-neutral-subdued);
}
Expand Down Expand Up @@ -145,7 +145,6 @@ $dropzone-stacking-order: (
}

.Overlay {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@include set-border-radius;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
position: absolute;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// stylelint-disable selector-max-compound-selectors -- generated by polaris-migrator DO NOT COPY
// stylelint-disable selector-max-type -- generated by polaris-migrator DO NOT COPY
.ConnectedFilterControl {
// stylelint-disable polaris/conventions/polaris/custom-properties-allowed-list -- generated by polaris-migrator DO NOT COPY
// stylelint-disable -- polaris/conventions/polaris/custom-property-allowed-list
--pc-connceted-filter-control-item: 10;
--pc-connceted-filter-control-focused: 20;
// stylelint-enable polaris/conventions/polaris/custom-properties-allowed-list
// stylelint-enable -- polaris/conventions/polaris/custom-property-allowed-list
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
display: flex;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
Expand Down Expand Up @@ -125,8 +125,3 @@
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
flex-grow: 0;
}
// stylelint-enable selector-max-specificity
// stylelint-enable selector-max-combinators
// stylelint-enable selector-max-class
// stylelint-enable selector-max-type
// stylelint-enable selector-max-compound-selectors
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,13 @@ $range-output-size: 32px;
transform: translateY(calc(-1 * var(--pc-range-slider-output-spacing)));

@media #{$p-breakpoints-md-up} {
// stylelint-disable polaris/conventions/polaris/custom-properties-allowed-list -- generated by polaris-migrator DO NOT COPY
// stylelint-disable-next-line -- polaris/conventions/polaris/custom-property-allowed-list
transform: translateY(
calc(-1 * (var(--pc-range-slider-output-spacing) * 0.5))
);
// stylelint-enable polaris/conventions/polaris/custom-properties-allowed-list
}
}
// stylelint-enable selector-max-specificity, selector-max-combinators, selector-max-class
// stylelint-enable selector-max-specificity, selector-max-combinators, selector-max-class -- generated by polaris-migrator DO NOT COPY

> :first-child {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@
width: 100%;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
height: var(--pc-range-slider-track-height);
// stylelint-disable polaris/conventions/polaris/custom-properties-allowed-list -- Polaris component custom properties
// stylelint-disable -- polaris/conventions/polaris/custom-property-allowed-list -- Polaris component custom properties
background-image: linear-gradient(
to right,
var(--pc-single-thumb-gradient-colors)
);
// stylelint-enable polaris/conventions/polaris/custom-properties-allowed-list
// stylelint-enable -- polaris/conventions/polaris/custom-property-allowed-list
border: none;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
border-radius: var(--pc-range-slider-track-height);
Expand Down Expand Up @@ -141,19 +141,19 @@

&::-ms-thumb {
margin-top: 0;
// stylelint-disable polaris/conventions/polaris/custom-properties-allowed-list -- generated by polaris-migrator DO NOT COPY
// stylelint-disable -- polaris/conventions/polaris/custom-property-allowed-list -- generated by polaris-migrator DO NOT COPY
transform: translateY(calc(var(--pc-range-slider-thumb-size) * 0.2))
scale(0.4);
// stylelint-enable polaris/conventions/polaris/custom-properties-allowed-list
// stylelint-enable -- polaris/conventions/polaris/custom-property-allowed-list
}

&::-webkit-slider-thumb {
// stylelint-disable polaris/conventions/polaris/custom-properties-allowed-list, function-calc-no-unspaced-operator -- generated by polaris-migrator DO NOT COPY
// stylelint-disable -- polaris/conventions/polaris/custom-property-allowed-list, function-calc-no-unspaced-operator
margin-top: calc(
(var(--pc-range-slider-thumb-size) - var(--pc-range-slider-track-height)) *
-0.5
);
// stylelint-enable polaris/conventions/polaris/custom-properties-allowed-list, function-calc-no-unspaced-operator
// stylelint-enable -- polaris/conventions/polaris/custom-property-allowed-list, function-calc-no-unspaced-operator
}

&:active {
Expand Down Expand Up @@ -202,11 +202,11 @@

/// Output value indicator
$range-output-size: 32px;
// stylelint-disable polaris/conventions/polaris/custom-properties-allowed-list -- generated by polaris-migrator DO NOT COPY
// stylelint-disable -- polaris/conventions/polaris/custom-property-allowed-list
$range-output-translate-x: calc(
-50% + var(--pc-range-slider-output-factor) * var(--pc-range-slider-thumb-size)
);
// stylelint-enable polaris/conventions/polaris/custom-properties-allowed-list
// stylelint-enable -- polaris/conventions/polaris/custom-property-allowed-list

.Output {
// stylelint-disable-next-line -- Polaris component custom properties
Expand All @@ -228,17 +228,17 @@ $range-output-translate-x: calc(
transition-timing-function: var(--p-ease);

.Input:active + & {
// stylelint-disable polaris/layout/polaris/global-disallowed-list -- generated by polaris-migrator DO NOT COPY
// stylelint-disable -- polaris/layout/polaris/global-disallowed-list
$range-thumb-size-difference: var(--p-range-slider-thumb-size-active) -
var(--p-range-slider-thumb-size-base);
// stylelint-enable polaris/layout/polaris/global-disallowed-list
// stylelint-enable -- polaris/layout/polaris/global-disallowed-list
opacity: 1;
visibility: visible;
// stylelint-disable polaris/layout/declaration-property-value-disallowed-list, polaris/conventions/polaris/custom-properties-allowed-list -- generated by polaris-migrator DO NOT COPY
// stylelint-disable -- polaris/layout/declaration-property-value-disallowed-list, polaris/conventions/polaris/custom-property-allowed-list -- generated by polaris-migrator DO NOT COPY
bottom: calc(
var(--pc-range-slider-thumb-size) + #{$range-thumb-size-difference}
);
// stylelint-enable polaris/layout/declaration-property-value-disallowed-list, polaris/conventions/polaris/custom-properties-allowed-list
// stylelint-enable -- polaris/layout/declaration-property-value-disallowed-list, polaris/conventions/polaris/custom-property-allowed-list
}
}

Expand Down Expand Up @@ -268,11 +268,10 @@ $range-output-translate-x: calc(
transform: translateY(calc(-1 * var(--pc-range-slider-output-spacing)));

@media #{$p-breakpoints-md-up} {
// stylelint-disable polaris/conventions/polaris/custom-properties-allowed-list -- generated by polaris-migrator DO NOT COPY
// stylelint-disable-next-line -- polaris/conventions/polaris/custom-property-allowed-list
transform: translateY(
calc(-1 * (var(--pc-range-slider-output-spacing) * 0.4))
);
// stylelint-enable polaris/conventions/polaris/custom-properties-allowed-list
}
}
// stylelint-enable selector-max-specificity, selector-max-combinators, selector-max-class
Expand Down