Skip to content

Commit

Permalink
update:Reformat code style with prettier. (rsuite#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyangguo authored and simonguo committed Aug 29, 2018
1 parent a326043 commit 88ce01c
Show file tree
Hide file tree
Showing 81 changed files with 1,417 additions and 1,406 deletions.
64 changes: 31 additions & 33 deletions stylelint.config.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,49 @@
module.exports = {
'extends': 'stylelint-config-standard',
'rules': {
// 覆盖 stylelint-config-standard 规则
// `stylelint-config-standard`中的一些规则并不适用,这里进行了覆盖
extends: 'stylelint-config-standard',
rules: {
// Overwrite stylelint-config-standard rules
// ----------------------------------

// 不检查函数之后是否有空白
// style-lint 无法区分 less mixin 还是 css function 这里直接禁用掉该检查项
// Don't check if there is a whitespace after the function.
// Style-lint can't distinguish less mixin or css function. Disable this check item directly here.
'function-whitespace-after': null,
// 不允许小于1数字的前导零
'number-leading-zero': 'never',
// Require a leading zero for fractional numbers less than 1.
'number-leading-zero': 'always',

// 扩充规则
// - 启用了最严格的 vendor-prefix 限制,该限制会适用 {@link https://caniuse.com} 的数据进行判断
// Extended rules
// - The most restrictive vendor-prefix limit is enabled, which is determined by the data of {@link https://caniuse.com}
// ----------------------------------

// 禁止 at 规则( @keyframes )使用浏览器引擎前缀
// Forbidden the at rule (eg: @keyframes ) to use the browser prefix.
'at-rule-no-vendor-prefix': true,
// 指定一个在声明中允许使用的属性和单位的白名单
// Specify a whitelist of attributes and units allowed in the declaration.
'declaration-property-unit-whitelist': {
'font-size': ['px', 'em', '%'],
'/^animation/': ['s'],
'/^animation/': ['s']
},
// 禁止 media 特性名称( @media )带有浏览器引擎前缀
// Forbidden @media use the browser prefix.
'media-feature-name-no-vendor-prefix': true,
// 限制允许嵌套的深度
// Limit the depth of nesting allowed.
'max-nesting-depth': 5,
// 不禁止低优先级的选择器出现在高优先级的选择器之后
// [优先级的描述]{@link https://www.w3.org/TR/css3-selectors/#specificity}
// Don't forbidden low specificity selectors from appearing after high specificity selectors.
// [Specificity description]{@link https://www.w3.org/TR/css3-selectors/#specificity}
'no-descending-specificity': null,
// 类选择器使用 snake case
// Class selector naming rules use snake case. eg: .class-name
'selector-class-pattern': '^[a-z0-9]+(-?[a-z0-9]+)*$',
// ID 选择器使用小驼峰命名
'selector-id-pattern': '^([a-z]+([A-Z][a-z]+)?)$',
// 禁止属性使用浏览器引擎前缀
// ID selector naming rules use camel case , excepted `icon-`. eg: #loginButton,#icon-login
'selector-id-pattern': '^([a-z]+([A-Z][a-z]+)?)||(icon-([a-z-]+))$',
// Forbidden use the browser prefix.
'property-no-vendor-prefix': true,
// 限制复合选择器的数量
'selector-no-vendor-prefix': true,
'value-no-vendor-prefix': true,
// Limit the number of composite selectors in a selector.
'selector-max-compound-selectors': 6,
// 限制 ID 选择器的数量
// Limit the number of ID selectors in a selector.
'selector-max-id': 1,
// 限制通配符(*)在一个选择器的数量
// Limit the number of universal selectors in a selector.
'selector-max-universal': 1,
// 禁止使用浏览器引擎前缀
'selector-no-vendor-prefix': true,
// 指定一个允许使用的伪类选择器的白名单(仅可使用 IE9+ 浏览器支持的伪类)
// [CSS选择器的浏览器支持]{@link https://labs.qianduan.net/css-selector/}
// Specify a whitelist of allowed pseudo-class selectors.(Only use pseudo-classes supported by IE10+ browsers)
// [CSS selector browser support]{@link https://labs.qianduan.net/css-selector/}
'selector-pseudo-class-whitelist': [
// CSS 1
'active',
Expand Down Expand Up @@ -73,10 +72,9 @@ module.exports = {
'root',
'target'
],
// 字符串使用双引号
'string-quotes': 'double',
// 禁止给值添加浏览器引擎前缀
'value-no-vendor-prefix': true,
// String using single quotes
'string-quotes': 'single',
'declaration-colon-newline-after': null,
'value-list-comma-newline-after': 'always-multi-line'
}
};

10 changes: 5 additions & 5 deletions styles/alert.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "common";
@import "mixins/alert";
@import 'common';
@import 'mixins/alert';

//
// Alerts
Expand Down Expand Up @@ -96,17 +96,17 @@
// The same to @keyframe alertMoveOut 100%.
&-alert &-fade-exited {
transform-origin: 0% 0%;
transform: scaleY(.8);
transform: scaleY(0.8);
max-height: 0;
overflow: hidden;
}

&-alert &-fade-entered {
animation: alertMoverIn .3s ease-in forwards;
animation: alertMoverIn 0.3s ease-in forwards;
}

&-alert &-fade-leave-active {
animation: alertMoveOut .3s ease-out forwards;
animation: alertMoveOut 0.3s ease-out forwards;
}
}

Expand Down
4 changes: 2 additions & 2 deletions styles/auto-complete.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "common";
@import "mixins/picker";
@import 'common';
@import 'mixins/picker';

.@{ns}auto-complete {
&-menu > {
Expand Down
4 changes: 2 additions & 2 deletions styles/breadcrumb.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "common";
@import 'common';

//
// Breadcrumbs
Expand All @@ -17,7 +17,7 @@
// If breadcrumbs has a ci
&-item > a {
cursor: pointer;
transition: color .3s linear;
transition: color 0.3s linear;
}

// Separator has gap with text
Expand Down
8 changes: 4 additions & 4 deletions styles/button-group.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import "common";
@import "mixins/button";
@import "mixins/button-group";
@import 'common';
@import 'mixins/button';
@import 'mixins/button-group';

//
// Button groups
Expand Down Expand Up @@ -317,7 +317,7 @@

&::before,
&::after {
content: "";
content: '';
display: block;
position: absolute;
width: @btn-ghost-border-width;
Expand Down
16 changes: 8 additions & 8 deletions styles/button.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "common";
@import "mixins/button";
@import 'common';
@import 'mixins/button';

//
// Buttons
Expand Down Expand Up @@ -27,7 +27,7 @@
> .@{ns}btn-spin {
&::before,
&::after {
content: "";
content: '';
position: absolute;
width: @btn-loading-spin-default-diameter;
height: @btn-loading-spin-default-diameter;
Expand All @@ -48,15 +48,15 @@
border: @btn-loading-spin-ring-wide solid @btn-loading-spin-ring-color;

.@{ns}btn-primary& {
opacity: .3;
opacity: 0.3;
}
}

&::after {
border-width: @btn-loading-spin-ring-wide;
border-color: @btn-spin-light-color transparent transparent;
border-style: solid;
animation: buttonSpin .6s infinite linear;
animation: buttonSpin 0.6s infinite linear;

.@{ns}btn-default&,
.@{ns}btn-link&,
Expand Down Expand Up @@ -219,9 +219,9 @@
}

// Specificity overrides
input[type="submit"],
input[type="reset"],
input[type="button"] {
input[type='submit'],
input[type='reset'],
input[type='button'] {
&.@{ns}btn-block {
width: 100%;
}
Expand Down
8 changes: 4 additions & 4 deletions styles/cascader.less
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@import "common";
@import "mixins/picker";
@import "mixins/dropdown";
@import 'common';
@import 'mixins/picker';
@import 'mixins/dropdown';

// Cascader
// ----------------------

// Cascader Picker Name Space
@cspns: ~"@{ns}@{cascader-picker-prefix}";
@cspns: ~'@{ns}@{cascader-picker-prefix}';

.@{cspns}-menu-items > div {
.clearfix;
Expand Down
22 changes: 11 additions & 11 deletions styles/check-picker.less
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@import "picker";
@import "mixins/checkbox";
@import 'picker';
@import 'mixins/checkbox';

// Check Picker
// ----------------------

// Check picker name space
@ckpns: ~"@{ns}@{check-picker-prefix}";
@ckpns: ~'@{ns}@{check-picker-prefix}';

// Menu Items
.@{ckpns}-menu-items {
Expand Down Expand Up @@ -57,15 +57,15 @@
left: @picker-menu-padding + @picker-children-check-item-padding-left;
}

[type="checkbox"] {
[type='checkbox'] {
display: none;
}

&::before,
&::after,
.@{ckpns}-menu-item-inner::before,
.@{ckpns}-menu-item-inner::after {
content: "";
content: '';
position: absolute;
left: 0;
top: 0;
Expand All @@ -84,9 +84,9 @@
.checkbox-inner-wrap(@checkbox-checked-border-color);

transform: scale(1);
opacity: .7;
opacity: 0.7;
visibility: hidden;
transition: transform .2s linear, opacity .2s linear;
transition: transform 0.2s linear, opacity 0.2s linear;

.@{ckpns}-menu-item-active & {
transform: scale(1.5);
Expand All @@ -107,7 +107,7 @@
.@{ckpns}-menu-item-inner::before {
.checkbox-inner-wrap(@checkbox-default-border-color);

transition: background .2s linear, border .2s linear, box-shadow .2s linear;
transition: background 0.2s linear, border 0.2s linear, box-shadow 0.2s linear;

.@{ckpns}-menu-item-active & {
border-color: @checkbox-checked-border-color;
Expand All @@ -120,7 +120,7 @@
}

.@{ckpns}-menu-item-disabled.@{ckpns}-menu-item-active & {
opacity: .3;
opacity: 0.3;
}
}

Expand All @@ -129,7 +129,7 @@
.opacity(0);

transform: rotate(45deg) scale(0);
transition: opacity .2s ease-in, transform .2s cubic-bezier(.12, .4, .29, 1.46);
transition: opacity 0.2s ease-in, transform 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46);

.@{ckpns}-menu-item-active & {
border: solid @B000;
Expand All @@ -150,7 +150,7 @@
.@{ckpns}-menu-item-inner::before {
.checkbox-inner-active-shadow(@checkbox-default-border-color);

@hover: ~":hover";
@hover: ~':hover';

@{hover}& {
.checkbox-inner-active-shadow(@checkbox-checked-border-color);
Expand Down
20 changes: 10 additions & 10 deletions styles/check-tree-picker.less
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@import "common";
@import "mixins/checkbox";
@import "mixins/tree-picker";
@import 'common';
@import 'mixins/checkbox';
@import 'mixins/tree-picker';

// Check Tree Picker
// ----------------------

// Check tree picker name space
@ctpns: ~"@{ns}@{check-tree-picker-prefix}";
@ctpns: ~'@{ns}@{check-tree-picker-prefix}';

.@{ctpns}-view {
background-color: @picker-tree-bg;
Expand Down Expand Up @@ -44,9 +44,9 @@
}

&::before {
content: "";
content: '';
position: absolute;
width: @picker-tree-arrow-down-width+@picker-tree-arrow-down-gap + 30px; // checkbox-spacing = 30
width: @picker-tree-arrow-down-width+ @picker-tree-arrow-down-gap + 30px; // checkbox-spacing = 30
height: 100%;
background-color: @picker-tree-bg;
top: 0;
Expand Down Expand Up @@ -88,15 +88,15 @@
left: @checkbox-sense-width+10px;
top: @checkbox-sense-width;

[type="checkbox"] {
[type='checkbox'] {
display: none;
}

&::before,
&::after,
.@{ctpns}-view-inner::before,
.@{ctpns}-view-inner::after {
content: "";
content: '';
position: absolute;
left: 0;
top: 0;
Expand Down Expand Up @@ -134,7 +134,7 @@
}

.@{ctpns}-view-node-disabled.@{ns}picker-check-menu-item-active & {
opacity: .3;
opacity: 0.3;
}
}

Expand Down Expand Up @@ -175,7 +175,7 @@
.@{ctpns}-view-inner::before {
.checkbox-inner-active-shadow(@checkbox-default-border-color);

@hover: ~":hover";
@hover: ~':hover';

@{hover}& {
.checkbox-inner-active-shadow(@checkbox-checked-border-color);
Expand Down
Loading

0 comments on commit 88ce01c

Please sign in to comment.