Browse Source

添加stylint自动排序

chuzhixin 4 years ago
parent
commit
f40d15a770
3 changed files with 6 additions and 42 deletions
  1. 1 33
      .stylelintrc.js
  2. 3 6
      .vscode/settings.json
  3. 2 3
      package.json

+ 1 - 33
.stylelintrc.js

@@ -1,35 +1,3 @@
 module.exports = {
-  extends: ["stylelint-config-standard", "stylelint-config-recess-order"],
-  rules: {
-    "at-rule-no-unknown": [
-      true,
-      {
-        ignoreAtRules: [
-          "mixin",
-          "extend",
-          "content",
-          "include",
-          "for",
-          "function",
-          "return",
-        ],
-      },
-    ],
-    "selector-pseudo-element-no-unknown": [
-      true,
-      {
-        ignorePseudoElements: ["v-deep"],
-      },
-    ],
-    "selector-pseudo-class-no-unknown": [
-      true,
-      {
-        ignorePseudoClasses: ["export"],
-      },
-    ],
-    indentation: 2,
-    "no-descending-specificity": null,
-    "declaration-colon-newline-after": null,
-  },
-  ignoreFiles: ["**/*.js", "dist/*.*", "node_modules", "**/*.ts", "**/*.md"],
+  extends: ["stylelint-config-recess-order", "stylelint-config-prettier"],
 };

+ 3 - 6
.vscode/settings.json

@@ -11,11 +11,6 @@
   "emmet.triggerExpansionOnTab": true,
   "editor.formatOnSave": true,
   "javascript.format.enable": true,
-  "stylelint.enable": true,
-  "css.validate": false,
-  "less.validate": false,
-  "scss.validate": false,
-  "stylelint.autoFixOnSave": true,
   "git.enableSmartCommit": true,
   "git.autofetch": true,
   "git.confirmSync": false,
@@ -30,6 +25,7 @@
     "**/.idea": true
   },
   "editor.codeActionsOnSave": {
+    "source.fixAll.stylelint": true,
     "source.fixAll.eslint": true
   },
   "[javascript]": {
@@ -51,5 +47,6 @@
   "docthis.includeAuthorTag": true,
   "docthis.includeDescriptionTag": true,
   "docthis.enableHungarianNotationEvaluation": true,
-  "docthis.inferTypesFromNames": true
+  "docthis.inferTypesFromNames": true,
+  "vetur.format.defaultFormatter.html": "prettier"
 }

+ 2 - 3
package.json

@@ -13,7 +13,7 @@
     "build:report": "vue-cli-service build --report",
     "globle": "npm install -g cnpm --registry=https://registry.npm.taobao.org&&cnpm i rimraf npm-check-updates nrm -g&&rimraf node_modules&&cnpm i",
     "lint": "vue-cli-service lint --fix",
-    "lint:style": "stylelint **/*.{vue,css,scss} --fix",
+    "lint:style": "stylelint-config-prettier-check",
     "inspect": "vue-cli-service inspect",
     "template": "plop",
     "clear": "rimraf node_modules&&cnpm i&&increase-memory-limit",
@@ -107,9 +107,8 @@
     "sass-loader": "^9.0.3",
     "script-loader": "^0.7.2",
     "stylelint": "^13.6.1",
+    "stylelint-config-prettier": "^8.0.2",
     "stylelint-config-recess-order": "^2.1.0",
-    "stylelint-config-standard": "^20.0.0",
-    "stylelint-order": "^4.1.0",
     "svg-sprite-loader": "^5.0.0",
     "svgo": "^1.3.2",
     "vue-template-compiler": "^2.6.12",