Skip to content

Latest commit

 

History

History
95 lines (70 loc) · 2.35 KB

File metadata and controls

95 lines (70 loc) · 2.35 KB

@naverpay/oxlint-config

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

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

설치 방법

npm install @naverpay/oxlint-config oxlint -D

사용 방법

Note: oxlint의 extends는 설정 파일 위치 기준으로 경로를 해석합니다. (공식 문서)

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

Node.js 프로젝트

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

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

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

CLI

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

{
    "scripts": {
        "lint": "oxlint"
    }
}

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

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

lefthook을 사용해서 commit 또는 push 전에 lint 검사를 자동화할 것을 권장합니다.

Integrating with IDE

VSCode

  1. oxc Extension을 설치합니다.
  2. IDE에서 Command Palette(CMD/CTRL + Shift + P)를 열고 settings.json을 입력하여 설정파일을 오픈합니다.
  3. 아래 설정을 추가합니다.
{
    "oxc.enable": true
}

oxfmt와 함께 사용 시

{
    "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을 설치하여 사용할 수 있습니다.