Skip to content

Commit 5f11fc5

Browse files
Merge pull request #136 from pja9362/feature/oxc_lint
[oxc] oxlint-config 패키지 추가
2 parents 91d81c5 + 5cec9f2 commit 5f11fc5

5 files changed

Lines changed: 272 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
- [@naverpay/eslint-config](./packages/eslint-config/README.md): ESLint config 를 제공하는 패키지입니다.
77
- [@naverpay/eslint-plugin](./packages/eslint-plugin/README.md): ESLint plugin 을 제공하는 패키지입니다.
8+
- [@naverpay/oxlint-config](./packages/oxlint-config/README.md): oxlint config 를 제공하는 패키지입니다.
89
- [@naverpay/prettier-config](./packages/prettier-config/README.md): Prettier config 를 제공하는 패키지입니다.
910
- [@naverpay/stylelint-config](./packages/stylelint-config/README.md): Stylelint config 를 제공하는 패키지 입니다.
1011
- [@naverpay/editorconfig](./packages/editorconfig/README.md): IDE 일관된 코딩 스타일로 작성할 수 있도록 `.editorconfig` 를 제공하는 패키지입니다.

packages/oxlint-config/README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# @naverpay/oxlint-config
2+
3+
네이버페이 스타일 가이드에 맞게 oxlint 설정을 제공합니다.
4+
5+
> oxlint는 ESLint 호환 린터로, Rust로 작성되어 빠른 속도를 제공합니다.
6+
7+
## 설치 방법
8+
9+
```bash
10+
npm install @naverpay/oxlint-config oxlint -D
11+
```
12+
13+
## 사용 방법
14+
15+
> **Note:** oxlint의 `extends`는 설정 파일 위치 기준으로 경로를 해석합니다. ([공식 문서](https://oxc.rs/docs/guide/usage/linter/config-file-reference))
16+
17+
프로젝트 루트에 `.oxlintrc.json` 파일을 생성하고 아래와 같이 설정합니다.
18+
19+
### Node.js 프로젝트
20+
21+
```json
22+
{
23+
"$schema": "./node_modules/oxlint/configuration_schema.json",
24+
"extends": ["./node_modules/@naverpay/oxlint-config/node/.oxlintrc.json"]
25+
}
26+
```
27+
28+
필요에 따라 `ignorePatterns`를 추가합니다.
29+
30+
```json
31+
{
32+
"$schema": "./node_modules/oxlint/configuration_schema.json",
33+
"extends": ["./node_modules/@naverpay/oxlint-config/node/.oxlintrc.json"],
34+
"ignorePatterns": ["dist", "node_modules"]
35+
}
36+
```
37+
38+
## CLI
39+
40+
package.json에 스크립트를 추가하여 lint 검사를 할 수 있습니다.
41+
42+
```json
43+
{
44+
"scripts": {
45+
"lint": "oxlint"
46+
}
47+
}
48+
```
49+
50+
`--report-unused-disable-directives` 옵션을 추가하면 불필요한 `eslint-disable` 주석을 감지합니다. 필요에 따라 사용합니다.
51+
52+
```json
53+
{
54+
"scripts": {
55+
"lint": "oxlint --report-unused-disable-directives"
56+
}
57+
}
58+
```
59+
60+
> [lefthook](https://github.com/evilmartians/lefthook)을 사용해서 commit 또는 push 전에 lint 검사를 자동화할 것을 권장합니다.
61+
62+
## Integrating with IDE
63+
64+
### VSCode
65+
66+
1. [oxc Extension](https://marketplace.visualstudio.com/items?itemName=oxc.oxc-vscode)을 설치합니다.
67+
2. IDE에서 Command Palette(CMD/CTRL + Shift + P)를 열고 `settings.json`을 입력하여 설정파일을 오픈합니다.
68+
3. 아래 설정을 추가합니다.
69+
70+
```json
71+
{
72+
"oxc.enable": true
73+
}
74+
```
75+
76+
#### oxfmt와 함께 사용 시
77+
78+
```json
79+
{
80+
"oxc.enable": true,
81+
"oxc.fmt.experimental": true,
82+
"editor.defaultFormatter": "oxc.oxc-vscode",
83+
"editor.formatOnSave": true,
84+
"[typescript]": {
85+
"editor.defaultFormatter": "oxc.oxc-vscode"
86+
},
87+
"[javascript]": {
88+
"editor.defaultFormatter": "oxc.oxc-vscode"
89+
}
90+
}
91+
```
92+
93+
### WebStorm
94+
95+
[oxc-intellij-plugin](https://plugins.jetbrains.com/plugin/27061-oxc)을 설치하여 사용할 수 있습니다.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"commonjs": true,
5+
"es2023": true
6+
},
7+
"rules": {
8+
"eqeqeq": ["error", "smart"],
9+
"no-console": "error",
10+
"no-param-reassign": "error",
11+
"no-unused-vars": ["error", {"ignoreRestSiblings": true, "argsIgnorePattern": "^_", "varsIgnorePattern": "^_"}],
12+
"no-undef": "error",
13+
14+
"@typescript-eslint/consistent-type-imports": "error",
15+
"@typescript-eslint/adjacent-overload-signatures": "error",
16+
"@typescript-eslint/array-type": "error",
17+
"@typescript-eslint/ban-tslint-comment": "error",
18+
"@typescript-eslint/consistent-generic-constructors": "error",
19+
"@typescript-eslint/consistent-indexed-object-style": "error",
20+
"@typescript-eslint/consistent-type-definitions": "error",
21+
"@typescript-eslint/no-confusing-non-null-assertion": "error",
22+
"@typescript-eslint/no-empty-function": "off",
23+
"@typescript-eslint/no-inferrable-types": "off",
24+
"@typescript-eslint/prefer-for-of": "error",
25+
"@typescript-eslint/prefer-function-type": "error"
26+
},
27+
"overrides": [
28+
{
29+
"files": ["**/*.{ts,tsx}"],
30+
"rules": {
31+
"no-unused-vars": "off",
32+
"no-unused-expressions": "off",
33+
"no-undef": "off",
34+
35+
"@typescript-eslint/no-unused-vars": [
36+
"error",
37+
{
38+
"ignoreRestSiblings": true,
39+
"argsIgnorePattern": "^_",
40+
"varsIgnorePattern": "^_",
41+
"caughtErrorsIgnorePattern": "^_"
42+
}
43+
],
44+
"@typescript-eslint/no-unused-expressions": [
45+
"error",
46+
{
47+
"allowShortCircuit": true,
48+
"allowTernary": true,
49+
"allowTaggedTemplates": true
50+
}
51+
]
52+
}
53+
}
54+
]
55+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "@naverpay/oxlint-config",
3+
"version": "0.0.1",
4+
"description": "oxlint configuration for NaverPay projects",
5+
"keywords": [
6+
"oxlint",
7+
"oxc",
8+
"config",
9+
"linter",
10+
"naverpay"
11+
],
12+
"homepage": "https://github.com/NaverPayDev/code-style",
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/NaverPayDev/code-style.git",
16+
"directory": "packages/oxlint-config"
17+
},
18+
"license": "MIT",
19+
"author": "@NaverPayDev/frontend",
20+
"type": "module",
21+
"files": [
22+
"node"
23+
],
24+
"devDependencies": {
25+
"oxlint": "^1.31.0"
26+
},
27+
"peerDependencies": {
28+
"oxlint": ">=1.0.0"
29+
}
30+
}

pnpm-lock.yaml

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)