Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

- [@naverpay/eslint-config](./packages/eslint-config/README.md): ESLint config 를 제공하는 패키지입니다.
- [@naverpay/eslint-plugin](./packages/eslint-plugin/README.md): ESLint plugin 을 제공하는 패키지입니다.
- [@naverpay/oxlint-config](./packages/oxlint-config/README.md): oxlint config 를 제공하는 패키지입니다.
- [@naverpay/prettier-config](./packages/prettier-config/README.md): Prettier config 를 제공하는 패키지입니다.
- [@naverpay/stylelint-config](./packages/stylelint-config/README.md): Stylelint config 를 제공하는 패키지 입니다.
- [@naverpay/editorconfig](./packages/editorconfig/README.md): IDE 일관된 코딩 스타일로 작성할 수 있도록 `.editorconfig` 를 제공하는 패키지입니다.
Expand Down
95 changes: 95 additions & 0 deletions packages/oxlint-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# @naverpay/oxlint-config

네이버페이 스타일 가이드에 맞게 oxlint 설정을 제공합니다.

> oxlint는 ESLint 호환 린터로, Rust로 작성되어 빠른 속도를 제공합니다.

## 설치 방법

```bash
npm install @naverpay/oxlint-config oxlint -D
```

## 사용 방법

> **Note:** oxlint의 `extends`는 설정 파일 위치 기준으로 경로를 해석합니다. ([공식 문서](https://oxc.rs/docs/guide/usage/linter/config-file-reference))

프로젝트 루트에 `.oxlintrc.json` 파일을 생성하고 아래와 같이 설정합니다.

### Node.js 프로젝트

```json
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"extends": ["./node_modules/@naverpay/oxlint-config/node/.oxlintrc.json"]
}
```

필요에 따라 `ignorePatterns`를 추가합니다.

```json
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"extends": ["./node_modules/@naverpay/oxlint-config/node/.oxlintrc.json"],
"ignorePatterns": ["dist", "node_modules"]
}
```

## CLI

package.json에 스크립트를 추가하여 lint 검사를 할 수 있습니다.

```json
{
"scripts": {
"lint": "oxlint"
}
}
```

`--report-unused-disable-directives` 옵션을 추가하면 불필요한 `eslint-disable` 주석을 감지합니다. 필요에 따라 사용합니다.

```json
{
"scripts": {
"lint": "oxlint --report-unused-disable-directives"
}
}
```

> [lefthook](https://github.com/evilmartians/lefthook)을 사용해서 commit 또는 push 전에 lint 검사를 자동화할 것을 권장합니다.

## Integrating with IDE

### VSCode

1. [oxc Extension](https://marketplace.visualstudio.com/items?itemName=oxc.oxc-vscode)을 설치합니다.
2. IDE에서 Command Palette(CMD/CTRL + Shift + P)를 열고 `settings.json`을 입력하여 설정파일을 오픈합니다.
3. 아래 설정을 추가합니다.

```json
{
"oxc.enable": true
}
```

#### oxfmt와 함께 사용 시

```json
{
"oxc.enable": true,
"oxc.fmt.experimental": true,
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
}
}
```

### WebStorm

[oxc-intellij-plugin](https://plugins.jetbrains.com/plugin/27061-oxc)을 설치하여 사용할 수 있습니다.
55 changes: 55 additions & 0 deletions packages/oxlint-config/node/.oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"env": {
"node": true,
"commonjs": true,
"es2023": true
},
"rules": {
"eqeqeq": ["error", "smart"],
"no-console": "error",
"no-param-reassign": "error",
"no-unused-vars": ["error", {"ignoreRestSiblings": true, "argsIgnorePattern": "^_", "varsIgnorePattern": "^_"}],
"no-undef": "error",

"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/ban-tslint-comment": "error",
"@typescript-eslint/consistent-generic-constructors": "error",
"@typescript-eslint/consistent-indexed-object-style": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/no-confusing-non-null-assertion": "error",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error"
},
"overrides": [
{
"files": ["**/*.{ts,tsx}"],
"rules": {
"no-unused-vars": "off",
"no-unused-expressions": "off",
"no-undef": "off",

"@typescript-eslint/no-unused-vars": [
"error",
{
"ignoreRestSiblings": true,
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-unused-expressions": [
"error",
{
"allowShortCircuit": true,
"allowTernary": true,
"allowTaggedTemplates": true
}
]
}
}
]
}
30 changes: 30 additions & 0 deletions packages/oxlint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@naverpay/oxlint-config",
"version": "0.0.1",
"description": "oxlint configuration for NaverPay projects",
"keywords": [
"oxlint",
"oxc",
"config",
"linter",
"naverpay"
],
"homepage": "https://github.com/NaverPayDev/code-style",
"repository": {
"type": "git",
"url": "https://github.com/NaverPayDev/code-style.git",
"directory": "packages/oxlint-config"
},
"license": "MIT",
"author": "@NaverPayDev/frontend",
"type": "module",
"files": [
"node"
],
"devDependencies": {
"oxlint": "^1.31.0"
},
"peerDependencies": {
"oxlint": ">=1.0.0"
}
}
91 changes: 91 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading