Skip to content

Commit b573cc9

Browse files
committed
feat(prettier): change to esm package
1 parent 09c097f commit b573cc9

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

packages/prettier-config-ali/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# 更新日志
22

3+
## 1.3.0 - 2024-04-07
4+
5+
- 更改为 ESM 包
6+
37
## 1.2.0 - 2024-04-07
48

59
- 重新添加 `prettier-plugin-packagejson`

packages/prettier-config-ali/index.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
const config = {
22
// 详见 https://prettier.io/docs/en/options
33
printWidth: 100,
44
tabWidth: 2,
@@ -14,7 +14,9 @@ module.exports = {
1414
endOfLine: 'lf',
1515
// 从 Prettier 3.x 开始,插件必须配置才能生效
1616
plugins: [
17-
// 排序 package.json 中的属性,ESM 项目报错,暂时禁用
18-
'prettier-plugin-packagejson',
17+
// 排序 package.json 中的属性
18+
import.meta.resolve('prettier-plugin-packagejson'),
1919
],
2020
};
21+
22+
export default config;

packages/prettier-config-ali/package.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,35 @@
22
"name": "prettier-config-ali",
33
"version": "1.2.0",
44
"description": "Prettier shareable configuration for Alibaba F2E Guidelines",
5-
"main": "index.js",
65
"keywords": [
76
"prettier",
87
"prettier-config",
98
"f2elint",
109
"Alibaba F2E Guidelines"
1110
],
12-
"scripts": {
13-
"build": "tsc"
11+
"homepage": "https://github.com/alibaba/f2e-spec",
12+
"bugs": {
13+
"url": "https://github.com/alibaba/f2e-spec/issues"
1414
},
1515
"repository": {
1616
"type": "git",
1717
"url": "https://github.com/alibaba/f2e-spec"
1818
},
19-
"bugs": {
20-
"url": "https://github.com/alibaba/f2e-spec/issues"
21-
},
22-
"homepage": "https://github.com/alibaba/f2e-spec",
19+
"license": "MIT",
2320
"author": {
2421
"name": "Guo Yunhe",
2522
"email": "[email protected]",
2623
"url": "https://guoyunhe.me/"
2724
},
28-
"license": "MIT",
29-
"devDependencies": {
30-
"prettier": "^2.2.1"
25+
"type": "module",
26+
"main": "index.js",
27+
"scripts": {
28+
"build": "tsc"
3129
},
3230
"dependencies": {
3331
"prettier-plugin-packagejson": "^2.4.14"
32+
},
33+
"devDependencies": {
34+
"prettier": "^2.2.1"
3435
}
3536
}

0 commit comments

Comments
 (0)