Skip to content

Commit

Permalink
build: add stylelint (#1982)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Sep 7, 2019
1 parent 64c7c30 commit eef1fc6
Show file tree
Hide file tree
Showing 46 changed files with 1,051 additions and 181 deletions.
14 changes: 14 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": [
"stylelint-config-standard",
"stylelint-config-rational-order"
],
"rules": {
"order/properties-order": [],
"at-rule-no-unknown": null,
"number-leading-zero": null,
"no-descending-specificity": null,
"declaration-colon-newline-after": null,
"font-family-no-missing-generic-family-keyword": null
}
}
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"*.{ts,js}": [
"eslint",
"git add"
],
"*.{css,less}": [
"stylelint",
"git add"
]
},
"homepage": "https://github.com/youzan/vant-weapp#readme",
Expand Down Expand Up @@ -63,6 +67,10 @@
"postcss-loader": "^3.0.0",
"progress-bar-webpack-plugin": "^1.11.0",
"style-loader": "^1.0.0",
"stylelint": "^10.1.0",
"stylelint-config-rational-order": "^0.1.2",
"stylelint-config-standard": "^18.3.0",
"stylelint-order": "^3.0.1",
"typescript": "^3.5.3",
"vue": "2.6.10",
"vue-loader": "^15.7.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/action-sheet/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@

&__subname {
margin-left: 5px;
font-size: 12px;
color: @gray-darker;
font-size: 12px;
}

&__header {
font-size: 16px;
font-weight: 500;
font-size: 16px;
line-height: 44px;
text-align: center;
}
Expand All @@ -54,8 +54,8 @@
top: 0;
right: 0;
padding: 0 15px;
color: @gray-dark;
font-size: 18px !important;
line-height: inherit !important;
color: @gray-dark;
}
}
1 change: 1 addition & 0 deletions packages/area/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// empty
14 changes: 7 additions & 7 deletions packages/button/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
.van-button {
position: relative;
display: inline-block;
box-sizing: border-box;
height: 44px;
padding: 0;
font-size: 16px;
line-height: 42px;
text-align: center;
vertical-align: middle;
box-sizing: border-box;
border-radius: @button-border-radius;
-webkit-appearance: none;
-webkit-text-size-adjust: 100%;
Expand All @@ -24,9 +24,9 @@
border: inherit;
border-color: @black;
border-radius: inherit; /* inherit parent's border radius */
content: ' ';
opacity: 0;
transform: translate(-50%, -50%);
opacity: 0;
content: ' ';
}

// reset weapp default border
Expand Down Expand Up @@ -104,8 +104,8 @@
}

&--small {
height: 30px;
min-width: 60px;
height: 30px;
padding: 0 8px;
font-size: 12px;
line-height: 28px;
Expand Down Expand Up @@ -146,8 +146,8 @@
}

&__loading-text {
margin-left: 5px;
display: inline-block;
margin-left: 5px;
vertical-align: middle;
}

Expand All @@ -164,12 +164,12 @@
}

&--hairline {
border-width: 0;
padding-top: 1px; // add 1px padding for text vertical align middle
border-width: 0;

&::after {
border-width: 1px;
border-color: inherit;
border-width: 1px;
border-radius: @button-border-radius * 2;
}

Expand Down
16 changes: 8 additions & 8 deletions packages/card/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

.van-card {
position: relative;
box-sizing: border-box;
padding: 5px 15px;
font-size: 12px;
color: @text-color;
font-size: 12px;
background-color: @background-color-light;
box-sizing: border-box;

&__header {
display: flex;
Expand All @@ -19,10 +19,10 @@

&__thumb {
position: relative;
flex: none;
width: 90px;
height: 90px;
margin-right: 10px;
flex: none;

&:empty {
display: none;
Expand All @@ -36,8 +36,8 @@

&__content {
position: relative;
min-width: 0; /* hack for flex box ellipsis */
flex: 1;
min-width: 0; /* hack for flex box ellipsis */
}

&__title,
Expand All @@ -51,8 +51,8 @@
}

&__desc {
line-height: 20px;
color: @gray-darker;
line-height: 20px;
}

&__bottom {
Expand All @@ -61,15 +61,15 @@

&__price {
display: inline-block;
font-weight: bold;
color: @red;
font-weight: bold;
}

&__origin-price {
display: inline-block;
margin-left: 5px;
font-size: 10px;
color: @gray-darker;
font-size: 10px;
text-decoration: line-through;
}

Expand All @@ -84,8 +84,8 @@
}

&__footer {
flex: none;
width: 100%;
text-align: right;
flex: none;
}
}
2 changes: 1 addition & 1 deletion packages/cell-group/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

.van-cell-group {
&__title {
font-size: 14px;
padding: 15px 15px 5px;
color: @gray-dark;
font-size: 14px;
line-height: 16px;
}
}
10 changes: 5 additions & 5 deletions packages/cell/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
.van-cell {
position: relative;
display: flex;
box-sizing: border-box;
width: 100%;
padding: 10px 15px;
color: @text-color;
font-size: 14px;
line-height: 24px;
color: @text-color;
background-color: @white;
box-sizing: border-box;

&::after {
.hairline-bottom(@border-color, 15px);
Expand All @@ -26,9 +26,9 @@

&__label {
margin-top: 3px;
color: @gray-dark;
font-size: 12px;
line-height: 18px;
color: @gray-dark;
}

&__value {
Expand All @@ -50,9 +50,9 @@
&__left-icon-wrap,
&__right-icon-wrap {
display: flex;
align-items: center;
height: 24px;
font-size: 16px;
align-items: center;
}

&__left-icon-wrap {
Expand Down Expand Up @@ -83,8 +83,8 @@
&::before {
position: absolute;
left: 7px;
font-size: 14px;
color: @red;
font-size: 14px;
content: '*';
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/checkbox-group/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// empty
4 changes: 2 additions & 2 deletions packages/checkbox/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

&__icon {
display: block;
box-sizing: border-box;
width: @checkbox-size;
height: @checkbox-size;
font-size: 14px;
color: transparent;
font-size: 14px;
text-align: center;
border: 1px solid @checkbox-border-color;
box-sizing: border-box;
transition: @checkbox-transition-duration;

&--round {
Expand Down
2 changes: 1 addition & 1 deletion packages/collapse-item/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

&__content {
padding: @collapse-item-content-padding;
color: @collapse-item-content-text-color;
font-size: @collapse-item-content-font-size;
line-height: @collapse-item-content-line-height;
color: @collapse-item-content-text-color;
background-color: @collapse-item-content-background-color;
}
}
12 changes: 6 additions & 6 deletions packages/common/index.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Entry of basic styles
*/
/**
* Entry of basic styles
*/

@import "./style/var.less";
@import "./style/ellipsis.less";
@import "./style/clearfix.less";
@import "./style/var.less";
@import "./style/ellipsis.less";
@import "./style/clearfix.less";
@import "./style/hairline.less";
2 changes: 1 addition & 1 deletion packages/common/style/mixins/clearfix.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.clearfix() {
&::after {
content: '';
display: table;
clear: both;
content: '';
}
}
3 changes: 2 additions & 1 deletion packages/common/style/mixins/ellipsis.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
.multi-ellipsis(@lines) {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: @lines;

/* autoprefixer: ignore next */
-webkit-box-orient: vertical;
}
Expand Down
14 changes: 8 additions & 6 deletions packages/common/style/mixins/hairline.less
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
.hairline-common() {
content: ' ';
position: absolute;
pointer-events: none;
box-sizing: border-box;
transform-origin: center; /* cover wechat button:after default transforn-origin */
content: ' ';
pointer-events: none;
}

.hairline(@border-color: #eee) {
.hairline-common();

top: -50%;
left: -50%;
right: -50%;
bottom: -50%;
transform: scale(0.5);
left: -50%;
border: 0 solid @border-color;
transform: scale(0.5);
}

.hairline-bottom(@border-color: #eee, @left: 0) {
.hairline-common();

top: auto;
left: @left;
right: 0;
bottom: 0;
transform: scaleY(0.5);
left: @left;
border-bottom: 1px solid @border-color;
transform: scaleY(0.5);
}
1 change: 1 addition & 0 deletions packages/datetime-picker/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// empty
4 changes: 2 additions & 2 deletions packages/dialog/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
}

&-bounce-enter {
opacity: 0;
transform: translate3d(-50%, -50%, 0) scale(0.7);
opacity: 0;
}

&-bounce-leave-active {
opacity: 0;
transform: translate3d(-50%, -50%, 0) scale(0.9);
opacity: 0;
}
}
Loading

0 comments on commit eef1fc6

Please sign in to comment.