Skip to content

Commit

Permalink
Feat/optimize eslint config (#1191)
Browse files Browse the repository at this point in the history
* feat: add hex color rule

* fix: correct color token variables

* feat: add disallowed named color rule

* fix: color vars lint error

---------

Co-authored-by: sunzhe <[email protected]>
  • Loading branch information
xiaosansiji and sunzhe authored Mar 14, 2023
1 parent fd559d8 commit fa8bec9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
12 changes: 11 additions & 1 deletion .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,15 @@
"color-function-notation": "legacy",
"value-keyword-case": null
},
"overrides": [{ "files": ["**/*.less"], "customSyntax": "postcss-less" }]
"overrides": [
{ "files": ["**/*.less"], "customSyntax": "postcss-less" },
{
"files": ["style/web/components/**/*.less"],
"ignoreFiles": ["**/_docs.less"],
"rules": {
"color-no-hex": true,
"color-named": "never"
}
}
]
}
13 changes: 9 additions & 4 deletions style/web/components/color-picker/_index.less
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
height: @color-picker-slider-thumb-size;
border-radius: @border-radius-circle;
box-shadow: @color-picker-thumbs-shadow;
background: white;
background: @text-color-anti;
color: @text-color-brand;
padding: @color-picker-slider-thumb-padding;
box-sizing: border-box;
Expand Down Expand Up @@ -117,10 +117,12 @@
}

&::before {
/* stylelint-disable-next-line color-no-hex */
background: linear-gradient(90deg, #fff, transparent);
}

&::after {
/* stylelint-disable-next-line color-no-hex */
background: linear-gradient(0deg, #000, transparent);
}

Expand All @@ -133,6 +135,7 @@
}

.transparentBgImage () {
/* stylelint-disable-next-line color-no-hex */
background-image: linear-gradient(45deg, #c5c5c5 25%, transparent 0, transparent 75%, #c5c5c5 0, #c5c5c5), linear-gradient(45deg, #c5c5c5 25%, transparent 0, transparent 75%, #c5c5c5 0, #c5c5c5);
background-size: 6px 6px;
background-position: 0 0, 3px 3px;
Expand All @@ -144,11 +147,12 @@
position: relative;

&--hue-type {
/* stylelint-disable-next-line color-named */
background: red;
}

&--alpha-type {
background: #fff;
background: @text-color-anti;
.transparentBgImage();
}
}
Expand Down Expand Up @@ -193,6 +197,7 @@
}

.@{prefix}-color-picker__hue {
/* stylelint-disable color-no-hex, color-named */
background: linear-gradient(
90deg,
red,
Expand Down Expand Up @@ -228,7 +233,7 @@
height: @color-picker-gradient-preview-height;
border-radius: @color-picker-gradient-preview-radius;
overflow: hidden;
background: #fff;
background: @text-color-anti;
.transparentBgImage();

&-inner {
Expand Down Expand Up @@ -544,7 +549,7 @@
border-radius: @color-picker-slider-wrapper-radius;

.@{prefix}-color-picker--bg-alpha {
background: #fff;
background: @text-color-anti;
.transparentBgImage();
}
}
Expand Down
3 changes: 1 addition & 2 deletions style/web/components/loading/_index.less
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,11 @@
&-conic {
width: 100%;
height: 100%;
background: conic-gradient(from 90deg at 50% 50%, #fff 0deg, currentcolor 360deg);
border-radius: @border-radius-circle;
/* stylelint-disable-next-line */
-webkit-mask: radial-gradient(transparent calc(50% ~"-" .5px), #fff 50%);

/* stylelint-disable-next-line */
/* stylelint-disable-next-line color-no-hex */
mask: radial-gradient(transparent calc(50% ~"-" .5px), #fff 50%);
}
}
10 changes: 5 additions & 5 deletions style/web/components/tooltip/_index.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
.@{prefix}-popup__content {
color: @tooltip-text-color;
background: @tooltip-bg;
box-shadow: inset 0 .5px 0 #5e5e5e, inset .5px 0 0 #5e5e5e, inset 0 -.5px 0 #5e5e5e, inset -.5px 0 0 #5e5e5e;
box-shadow: inset 0 .5px 0 @gray-color-9, inset .5px 0 0 @gray-color-9, inset 0 -.5px 0 @gray-color-9, inset -.5px 0 0 @gray-color-9;
}

&[data-popper-placement^="left"] .@{prefix}-popup__arrow:before {
box-shadow: inset -.5px 0 0 #5e5e5e, inset 0 .5px 0 #5e5e5e;
box-shadow: inset -.5px 0 0 @gray-color-9, inset 0 .5px 0 @gray-color-9;
}

&[data-popper-placement^="right"] .@{prefix}-popup__arrow:before {
box-shadow: inset .5px 0 0 #5e5e5e, inset 0 -.5px 0 #5e5e5e;
box-shadow: inset .5px 0 0 @gray-color-9, inset 0 -.5px 0 @gray-color-9;
}

&[data-popper-placement^="top"] .@{prefix}-popup__arrow:before {
box-shadow: inset 0 -.5px 0 #5e5e5e, inset -.5px 0 0 #5e5e5e;
box-shadow: inset 0 -.5px 0 @gray-color-9, inset -.5px 0 0 @gray-color-9;
}

&[data-popper-placement^="bottom"] .@{prefix}-popup__arrow:before {
box-shadow: inset .5px 0 0 #5e5e5e, inset 0 .5px 0 #5e5e5e;
box-shadow: inset .5px 0 0 @gray-color-9, inset 0 .5px 0 @gray-color-9;
}
}

Expand Down

0 comments on commit fa8bec9

Please sign in to comment.