Skip to content

Commit

Permalink
feat: 引入 stylelint
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Mar 13, 2019
1 parent 076bfef commit 5c0b06d
Show file tree
Hide file tree
Showing 6 changed files with 918 additions and 18 deletions.
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,47 @@
"dist",
"node_modules"
],
"stylelint": {
"extends": "stylelint-config-standard",
"plugins": ["stylelint-scss"],
"rules": {
"function-name-case": null,
"at-rule-empty-line-before": null,
"color-hex-case": "upper",
"block-closing-brace-newline-after": [
"always",
{
"ignoreAtRules": [
"if",
"else"
]
}
],
"scss/at-else-closing-brace-newline-after": "always-last-in-chain",
"scss/at-else-closing-brace-space-after": "always-intermediate",
"scss/at-else-if-parentheses-space-before": "always",
"scss/at-function-parentheses-space-before": "never",
"scss/at-if-closing-brace-newline-after": "always-last-in-chain",
"scss/at-if-closing-brace-space-after": "always-intermediate",
"scss/at-mixin-parentheses-space-before": "never",
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
"scss/dollar-variable-colon-space-after": "always-single-line",
"scss/dollar-variable-colon-space-before": "never",
"scss/dollar-variable-empty-line-before": [
"always",
{
"except": [
"first-nested",
"after-comment",
"after-dollar-variable"
]
}
],
"scss/double-slash-comment-whitespace-inside": "always",
"scss/double-slash-comment-empty-line-before": "always"
}
},
"files": [
"src/components",
"src/styles"
Expand All @@ -44,6 +85,9 @@
"eslint-config-io": "^0.1.1",
"miniprogram-api-typings": "^2.4.2-2",
"standard-version": "^4.4.0",
"stylelint": "^9.10.1",
"stylelint-config-standard": "^18.2.0",
"stylelint-scss": "^3.5.4",
"typescript": "^3.3.3333"
}
}
5 changes: 5 additions & 0 deletions src/components/Picker/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,34 @@
background: white;
width: 100vw;
font-size: transformPx(17);

&__header {
display: flex;
align-items: center;
padding: transformPx(10) transformPx(15);
border-bottom: 1px solid $hairlineColor;
}

&__cancel {
flex-shrink: 0;
font-size: transformPx(17);
color: $grayColor;

&_hidden {
visibility: hidden;
opacity: 0;
pointer-events: none;
}
}

&__title {
flex-grow: 1;
text-align: center;
margin: 0 transformPx(15);
font-size: transformPx(19);
@include ellipsis;
}

&__confirm {
flex-shrink: 0;
font-size: transformPx(17);
Expand Down
1 change: 1 addition & 0 deletions src/components/PickerView/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
display: flex;
align-items: center;
justify-content: center;

&__label {
text-align: center;
@include ellipsis;
Expand Down
7 changes: 7 additions & 0 deletions src/components/Popup/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
bottom: 0;
right: 0;
display: flex;

&__mask {
position: absolute;
top: 0;
Expand All @@ -15,26 +16,32 @@
right: 0;
background: rgba(black, 0.6);
}

&__content {
position: relative;
z-index: 1;
}

&_center {
justify-content: center;
align-items: center;
}

&_top {
justify-content: center;
align-items: flex-start;
}

&_bottom {
justify-content: center;
align-items: flex-end;
}

&_left {
justify-content: flex-start;
align-items: center;
}

&_right {
justify-content: flex-end;
align-items: center;
Expand Down
2 changes: 1 addition & 1 deletion src/styles/settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $hairlineColor: #E5E5E5 !default;

// 文字溢出显示省略号
@mixin ellipsis($line: 1) {
@if $line == 1 {
@if ($line == 1) {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
Expand Down
Loading

0 comments on commit 5c0b06d

Please sign in to comment.