@cocopalm/oxc-formatter-config 0.0.13 → 0.0.14
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.
- package/README.md +85 -5
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,19 +1,99 @@
|
|
|
1
1
|
# oxc-formatter-config
|
|
2
2
|
|
|
3
|
+
> Prettier with OXC plugin을 사용한 코드 포맷팅 설정
|
|
4
|
+
|
|
3
5
|
## Installation
|
|
4
6
|
|
|
5
7
|
```bash
|
|
6
|
-
pnpm add @cocopalm/oxc-formatter-config
|
|
8
|
+
pnpm add -D prettier @cocopalm/oxc-formatter-config
|
|
7
9
|
```
|
|
8
10
|
|
|
9
11
|
## How to use
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
이 패키지는 Prettier의 OXC 플러그인(`@prettier/plugin-oxc`)을 사용하여 코드를 포맷팅합니다.
|
|
14
|
+
|
|
15
|
+
### .prettierrc.mjs 설정하기
|
|
16
|
+
|
|
17
|
+
프로젝트 루트 디렉토리에 `.prettierrc.mjs` 파일을 생성합니다.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
touch .prettierrc.mjs
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
설정 파일에서 `@cocopalm/oxc-formatter-config`를 불러옵니다.
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
// .prettierrc.mjs
|
|
27
|
+
|
|
28
|
+
'@cocopalm/oxc-formatter-config'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`package.json` 에 포맷팅 스크립트를 추가해주세요.
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
// package.json
|
|
35
|
+
|
|
36
|
+
{
|
|
37
|
+
"scripts": {
|
|
38
|
+
"format": "prettier . --write",
|
|
39
|
+
"format:check": "prettier . --check"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Config Override
|
|
45
|
+
|
|
46
|
+
기본 설정을 오버라이드하고 싶다면 다음과 같이 설정을 확장할 수 있습니다.
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// .prettierrc.mjs
|
|
50
|
+
|
|
51
|
+
import baseConfig from '@cocopalm/oxc-formatter-config'
|
|
52
|
+
|
|
53
|
+
export default {
|
|
54
|
+
...baseConfig,
|
|
55
|
+
printWidth: 100,
|
|
56
|
+
semi: true,
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Examples
|
|
12
61
|
|
|
13
|
-
|
|
62
|
+
1. **기본 설정 사용**
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
// .prettierrc.mjs
|
|
66
|
+
'@cocopalm/oxc-formatter-config'
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. **커스텀 설정 추가**
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
// .prettierrc.mjs
|
|
73
|
+
import baseConfig from '@cocopalm/oxc-formatter-config'
|
|
74
|
+
|
|
75
|
+
export default {
|
|
76
|
+
...baseConfig,
|
|
77
|
+
printWidth: 120,
|
|
78
|
+
singleQuote: false,
|
|
79
|
+
}
|
|
80
|
+
```
|
|
14
81
|
|
|
15
82
|
<br />
|
|
16
83
|
|
|
17
|
-
##
|
|
84
|
+
## Formatter Options
|
|
18
85
|
|
|
19
|
-
|
|
86
|
+
이 패키지에 적용된 기본 포맷팅 옵션은 다음과 같습니다:
|
|
87
|
+
|
|
88
|
+
| 옵션 | 값 | 설명 |
|
|
89
|
+
| --------------- | -------- | -------------------------------------- |
|
|
90
|
+
| printWidth | 80 | 한 줄의 최대 길이 |
|
|
91
|
+
| tabWidth | 2 | 들여쓰기 공백 수 |
|
|
92
|
+
| useTabs | false | 탭 대신 공백 사용 |
|
|
93
|
+
| semi | false | 문장 끝 세미콜론 제거 |
|
|
94
|
+
| singleQuote | true | 작은따옴표 사용 |
|
|
95
|
+
| trailingComma | 'all' | 가능한 모든 곳에 trailing comma 추가 |
|
|
96
|
+
| arrowParens | 'always' | 화살표 함수 매개변수에 항상 괄호 사용 |
|
|
97
|
+
| plugins | [@prettier/plugin-oxc] | OXC 플러그인 사용 |
|
|
98
|
+
|
|
99
|
+
<br />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocopalm/oxc-formatter-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "oxc formatter configuration",
|
|
5
5
|
"author": "puffcocos",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,11 +22,13 @@
|
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@prettier/plugin-oxc": "^0.1.3"
|
|
27
|
+
},
|
|
25
28
|
"devDependencies": {
|
|
26
|
-
"
|
|
27
|
-
"prettier": "^3.6.2"
|
|
29
|
+
"prettier": "^3.7.4"
|
|
28
30
|
},
|
|
29
31
|
"peerDependencies": {
|
|
30
|
-
"prettier": "^3.
|
|
32
|
+
"prettier": "^3.7.4"
|
|
31
33
|
}
|
|
32
34
|
}
|