Skip to content

Commit ec4c360

Browse files
authored
Sasslint to stylelint (#1747)
* replace sass-lint with stylelint * fix pre-commit hook script
1 parent 554b46f commit ec4c360

32 files changed

+671
-744
lines changed

.lintstagedrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"*.js": ["yarn format", "eslint"],
33
"packages/zent/src/**/*.{ts,tsx}": ["yarn format", "eslint"],
44
"packages/zent/scripts/cruiser/**/*.{ts,tsx}": ["yarn format", "eslint"],
5-
"site/**/*.scss": ["yarn format", "sass-lint -vq"],
6-
"packages/zent/**/*.scss": ["yarn format", "sass-lint -vq", "yarn workspace zent lint-style"]
5+
"site/**/*.scss": ["yarn format", "stylelint"],
6+
"packages/zent/**/*.scss": ["yarn format", "stylelint"]
77
}

.stylelintrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"extends": [
3+
"stylelint-config-recommended-scss",
4+
"stylelint-config-prettier"
5+
],
6+
"rules": {
7+
"no-descending-specificity": null,
8+
"no-duplicate-selectors": null,
9+
"declaration-no-important": true,
10+
"keyframe-declaration-no-important": true,
11+
"color-no-hex": true,
12+
"color-named": "never",
13+
"length-zero-no-unit": true,
14+
"declaration-block-no-duplicate-properties": [
15+
true,
16+
{
17+
"ignore": [
18+
"consecutive-duplicates"
19+
]
20+
}
21+
]
22+
}
23+
}

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"lint": "yarn lint-ts && yarn lint-js && yarn lint-style",
1111
"lint-ts": "yarn workspace zent lint-ts && yarn workspace zent-docs lint-ts",
1212
"lint-js": "yarn workspace zent lint-js && yarn workspace babel-plugin-zent lint-js && yarn workspace zent-docs lint-js",
13-
"lint-style": "sass-lint -vq && yarn workspace zent lint-style",
13+
"lint-style": "yarn workspace zent-docs lint-style && yarn workspace zent lint-style",
1414
"format": "prettier --write",
1515
"prettify-style": "prettier --write -- \"packages/zent/assets/**/*.scss\" \"site/src/**/*.scss\"",
1616
"prettify-js": "prettier --write -- \"packages/*/__tests__/**/*.js\" \"site/{src,scripts,webpack,zent}/**/*.js\"",
@@ -56,7 +56,10 @@
5656
"husky": "^6.0.0",
5757
"lint-staged": "^11.0.0",
5858
"prettier": "^2.2.0",
59-
"sass-lint": "^1.12.1",
59+
"stylelint": "^13.13.1",
60+
"stylelint-config-recommended-scss": "^4.3.0",
61+
"stylelint-scss": "^3.20.1",
62+
"stylelint-config-prettier": "^8.0.2",
6063
"typescript": "~4.3.5"
6164
},
6265
"dependencies": {}

packages/zent/assets/base/normalize.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import '../theme/font';
22
@import '../theme/default';
33

4-
// sass-lint:disable-all
4+
/* stylelint-disable */
55

66
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
77

packages/zent/assets/block-header.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
}
1616

1717
&-minimum {
18-
// sass-lint:disable-block no-duplicate-properties
1918
box-shadow: 0 1px 0 0 $theme-stroke-6;
2019
box-shadow: 0 1px 0 0 theme-rgb(stroke, 6);
2120
}

packages/zent/assets/cascader.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,12 @@ $menuHeight: 180px;
402402
margin-left: 5px;
403403

404404
&:after {
405+
@include theme-color(background, stroke, 9);
405406
content: '';
406407
display: inline-block;
407408
position: absolute;
408409
height: 10px;
409410
width: 4px;
410-
background: white;
411411
animation: 1s linear zent-ani-spin infinite;
412412
transform-origin: 8px 3px;
413413
left: -1px;

packages/zent/assets/colorpicker.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
margin-left: 10px;
7474
margin-bottom: 10px;
7575
cursor: pointer;
76-
box-shadow: inset 0 0 0 1px rgba(black, 0.15); // border
76+
box-shadow: inset 0 0 0 1px rgba($color-black, 0.15); // border
7777
border-radius: 2px;
7878
}
7979
}

packages/zent/assets/dialog.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ X X X
144144
*/
145145

146146
// no header and has close button
147-
// sass-lint:disable-block no-mergeable-selectors
148147
.zent-dialog-r {
149148
// only content
150149
.zent-dialog-r-body-content {
@@ -208,7 +207,7 @@ X X X
208207
right: 0;
209208
left: 0;
210209
bottom: 0;
211-
background-color: rgba(black, 0.6);
210+
background-color: rgba($color-black, 0.6);
212211
height: 100%;
213212
z-index: $z-index;
214213
}

packages/zent/assets/disabled.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/** DO NOT REMOVE. babel-plugin-zent transformation requires this file to exist. */

packages/zent/assets/drawer.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $z-index: 1010;
1515
right: 0;
1616
left: 0;
1717
bottom: 0;
18-
background-color: rgba(black, 0.6);
18+
background-color: rgba($color-black, 0.6);
1919
height: 100%;
2020
z-index: $z-index;
2121
}

0 commit comments

Comments
 (0)