build: add style lint

This commit is contained in:
Qiuxia Fan 2021-12-21 15:08:29 +08:00
parent 2f6853e151
commit d8e4fc1d2c
4 changed files with 127 additions and 1 deletions

6
package-lock.json generated
View File

@ -15595,6 +15595,12 @@
"integrity": "sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ==", "integrity": "sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ==",
"dev": true "dev": true
}, },
"postcss-scss": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-4.0.2.tgz",
"integrity": "sha512-xfdkU128CkKKKVAwkyt0M8OdnelJ3MRcIRAPPQkRpoPeuzWY3RIeg7piRCpZ79MK7Q16diLXMMAD9dN5mauPlQ==",
"dev": true
},
"postcss-selector-parser": { "postcss-selector-parser": {
"version": "6.0.6", "version": "6.0.6",
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz", "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz",

View File

@ -43,6 +43,7 @@
"husky": "^7.0.4", "husky": "^7.0.4",
"lint-staged": "^12.1.3", "lint-staged": "^12.1.3",
"node-sass": "^6.0.1", "node-sass": "^6.0.1",
"postcss-scss": "^4.0.2",
"prettier": "^2.2.1", "prettier": "^2.2.1",
"sass-loader": "^10.2.0", "sass-loader": "^10.2.0",
"stylelint": "^14.1.0", "stylelint": "^14.1.0",

View File

@ -18,85 +18,111 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.flex-h { .flex-h {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
} }
.ell { .ell {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
} }
.cp { .cp {
cursor: pointer; cursor: pointer;
} }
.cm { .cm {
cursor: move; cursor: move;
} }
.auto { .auto {
margin-right: auto; margin-right: auto;
margin-left: auto; margin-left: auto;
} }
.green { .green {
color: #4caf50; color: #4caf50;
} }
.red { .red {
color: #e54c17; color: #e54c17;
} }
.blue { .blue {
color: #448dfe; color: #448dfe;
} }
.purple { .purple {
color: #6e40aa; color: #6e40aa;
} }
.yellow { .yellow {
color: #fbb03b; color: #fbb03b;
} }
.grey { .grey {
color: #a7aebb; color: #a7aebb;
} }
.white { .white {
color: #fff; color: #fff;
} }
.bg-green { .bg-green {
background-color: #4caf50; background-color: #4caf50;
} }
.bg-red { .bg-red {
background-color: #e54c17; background-color: #e54c17;
} }
.bg-blue { .bg-blue {
background-color: #448dfe; background-color: #448dfe;
} }
.bg-purple { .bg-purple {
background-color: #6e40aa; background-color: #6e40aa;
} }
.bg-yellow { .bg-yellow {
background-color: #fbb03b; background-color: #fbb03b;
} }
.bg-grey { .bg-grey {
background-color: #a7aebb; background-color: #a7aebb;
} }
.ml-5 { .ml-5 {
margin-left: 5px; margin-left: 5px;
} }
.ml-10 { .ml-10 {
margin-left: 10px; margin-left: 10px;
} }
.ml-15 { .ml-15 {
margin-left: 15px; margin-left: 15px;
} }
.ml-20 { .ml-20 {
margin-left: 20px; margin-left: 20px;
} }
.mr-5 { .mr-5 {
margin-right: 5px; margin-right: 5px;
} }
.mr-10 { .mr-10 {
margin-right: 10px; margin-right: 10px;
} }
.mr-15 { .mr-15 {
margin-right: 15px; margin-right: 15px;
} }
.mr-20 { .mr-20 {
margin-right: 20px; margin-right: 20px;
} }

93
stylelint.config.js Normal file
View File

@ -0,0 +1,93 @@
module.exports = {
root: true,
plugins: ["stylelint-order"],
customSyntax: "postcss-scss",
extends: ["stylelint-config-standard", "stylelint-config-prettier"],
rules: {
"selector-class-pattern": null,
"selector-pseudo-class-no-unknown": [
true,
{
ignorePseudoClasses: ["global"],
},
],
"selector-pseudo-element-no-unknown": [
true,
{
ignorePseudoElements: ["v-deep"],
},
],
"at-rule-no-unknown": [
true,
{
ignoreAtRules: [
"tailwind",
"apply",
"variants",
"responsive",
"screen",
"function",
"if",
"each",
"include",
"mixin",
],
},
],
"no-empty-source": null,
"named-grid-areas-no-invalid": null,
"unicode-bom": "never",
"no-descending-specificity": null,
"font-family-no-missing-generic-family-keyword": null,
"declaration-colon-space-after": "always-single-line",
"declaration-colon-space-before": "never",
// 'declaration-block-trailing-semicolon': 'always',
"rule-empty-line-before": [
"always",
{
ignore: ["after-comment", "first-nested"],
},
],
"unit-no-unknown": [true, { ignoreUnits: ["rpx"] }],
"order/order": [
[
"dollar-variables",
"custom-properties",
"at-rules",
"declarations",
{
type: "at-rule",
name: "supports",
},
{
type: "at-rule",
name: "media",
},
"rules",
],
{ severity: "warning" },
],
},
ignoreFiles: ["**/*.js", "**/*.jsx", "**/*.tsx", "**/*.ts"],
overrides: [
{
files: ["*.vue", "**/*.vue", "*.html", "**/*.html"],
extends: ["stylelint-config-recommended", "stylelint-config-html"],
rules: {
"keyframes-name-pattern": null,
"selector-pseudo-class-no-unknown": [
true,
{
ignorePseudoClasses: ["deep", "global"],
},
],
"selector-pseudo-element-no-unknown": [
true,
{
ignorePseudoElements: ["v-deep", "v-global", "v-slotted"],
},
],
},
},
],
};