@cgzair/prettier-config-cgz 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +22 -4
  2. package/package.json +4 -2
package/index.js CHANGED
@@ -1,13 +1,10 @@
1
- // const organizeAttributes = require("prettier-plugin-organize-attributes");
2
1
  const styleOrder = require("prettier-plugin-two-style-order");
3
2
 
4
3
  module.exports = {
5
4
  trailingComma: "all",
6
5
  printWidth: 120,
7
6
  proseWrap: "never",
8
- attributeGroups: ["$CODE_GUIDE"],
9
- plugins: [styleOrder],
10
- // plugins: [organizeAttributes, styleOrder],
7
+ plugins: [styleOrder, "@trivago/prettier-plugin-sort-imports"],
11
8
  overrides: [
12
9
  {
13
10
  files: ".prettierrc",
@@ -16,4 +13,25 @@ module.exports = {
16
13
  },
17
14
  },
18
15
  ],
16
+ importOrder: [
17
+ // 1. react、vue 等框架
18
+ "^(react|react-dom|vue)$",
19
+ // 2. 框架配套(redux、router 等)
20
+ "^(redux|react-redux|@reduxjs/toolkit|vuex|vue-router|react-router|react-router-dom|dva)$",
21
+ // 3. UI 库(antd、element-ui)
22
+ "^(antd|@ant-design|element-ui)$",
23
+ // 4. 其他 external
24
+ "<THIRD_PARTY_MODULES>",
25
+ // 5. @/ @c/ 本地别名
26
+ "^@/",
27
+ "^@c/",
28
+ // 6. 相对路径
29
+ "^\\./",
30
+ "^\\.\\./",
31
+ // 7. 样式文件
32
+ ".*\\.(css|scss|sass|less)$",
33
+ ],
34
+ importOrderSeparation: false,
35
+ importOrderSortSpecifiers: false,
36
+ importOrderParserPlugins: ["typescript", "jsx"],
19
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cgzair/prettier-config-cgz",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Prettier shareable configuration for cgz frontend Guidelines",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -18,10 +18,12 @@
18
18
  "README.md"
19
19
  ],
20
20
  "dependencies": {
21
+ "@trivago/prettier-plugin-sort-imports": "^4.3.0",
21
22
  "prettier": "^2.5.1",
22
23
  "prettier-plugin-two-style-order": "^1.0.1"
23
24
  },
24
25
  "devDependencies": {
26
+ "@vue/compiler-sfc": "^3.5.25",
25
27
  "jest": "^27.3.1"
26
28
  },
27
29
  "publishConfig": {
@@ -48,5 +50,5 @@
48
50
  "cobertura"
49
51
  ]
50
52
  },
51
- "gitHead": "ac4f859f68745c4250c8aab06047ce03b0de733e"
53
+ "gitHead": "52c76a5b3b1284b9334639b4b54b3ebbc67a1c7e"
52
54
  }