From 1db6c31214e7686b81ef15aec062ab7692fa31c4 Mon Sep 17 00:00:00 2001 From: pja9362 Date: Tue, 16 Dec 2025 16:27:27 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20oxlint-config=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/oxlint-config/README.md | 90 +++++++++++++++++++++ packages/oxlint-config/node/.oxlintrc.json | 55 +++++++++++++ packages/oxlint-config/package.json | 29 +++++++ pnpm-lock.yaml | 91 ++++++++++++++++++++++ 4 files changed, 265 insertions(+) create mode 100644 packages/oxlint-config/README.md create mode 100644 packages/oxlint-config/node/.oxlintrc.json create mode 100644 packages/oxlint-config/package.json diff --git a/packages/oxlint-config/README.md b/packages/oxlint-config/README.md new file mode 100644 index 0000000..ae88631 --- /dev/null +++ b/packages/oxlint-config/README.md @@ -0,0 +1,90 @@ +# @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, + "oxc.configPath": ".oxlintrc.json", + "[typescript]": { + "editor.defaultFormatter": "oxc.oxc-vscode" + }, + "[javascript]": { + "editor.defaultFormatter": "oxc.oxc-vscode" + } +} +``` + +| 설정 | 설명 | +|------|------| +| `oxc.enable` | oxc 익스텐션 활성화 | +| `oxc.configPath` | oxlint 설정 파일 경로 | + +### WebStorm + +[oxc-intellij-plugin](https://plugins.jetbrains.com/plugin/27061-oxc) (v0.0.21 이상)을 설치하여 사용할 수 있습니다. diff --git a/packages/oxlint-config/node/.oxlintrc.json b/packages/oxlint-config/node/.oxlintrc.json new file mode 100644 index 0000000..0cae8a3 --- /dev/null +++ b/packages/oxlint-config/node/.oxlintrc.json @@ -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 + } + ] + } + } + ] +} diff --git a/packages/oxlint-config/package.json b/packages/oxlint-config/package.json new file mode 100644 index 0000000..a8d5826 --- /dev/null +++ b/packages/oxlint-config/package.json @@ -0,0 +1,29 @@ +{ + "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", + "files": [ + "node" + ], + "devDependencies": { + "oxlint": "^1.31.0" + }, + "peerDependencies": { + "oxlint": ">=1.0.0" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3084ec7..d2e6013 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -170,6 +170,12 @@ importers: specifier: ^0.32.1 version: 0.32.1 + packages/oxlint-config: + devDependencies: + oxlint: + specifier: ^1.31.0 + version: 1.33.0 + packages/prettier-config: devDependencies: prettier: @@ -1469,6 +1475,46 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@oxlint/darwin-arm64@1.33.0': + resolution: {integrity: sha512-PmEQDLHAxiAdyttQ1ZWXd+5VpHLbHf3FTMJL9bg5TZamDnhNiW/v0Pamv3MTAdymnoDI3H8IVLAN/SAseV/adw==} + cpu: [arm64] + os: [darwin] + + '@oxlint/darwin-x64@1.33.0': + resolution: {integrity: sha512-2R9aH3kR0X2M30z5agGikv3tfNTi8/uLhU5/tYktu33VGUXpbf0OLZSlD25UEuwOKAlf3RVtzV5oDyjoq93JuQ==} + cpu: [x64] + os: [darwin] + + '@oxlint/linux-arm64-gnu@1.33.0': + resolution: {integrity: sha512-yb/k8GaMDgnX2LyO6km33kKItZ/n573SlbiHBBFU2HmeU7tzEHL5jHkHQXXcysUkapmqHd7UsDhOZDqPmXaQRg==} + cpu: [arm64] + os: [linux] + + '@oxlint/linux-arm64-musl@1.33.0': + resolution: {integrity: sha512-03pt9IO1C4ZfVOW6SQiOK26mzklAhLM3Kc79OXpX1kgZRlxk+rvFoMhlgCOzn7tEdrEgbePkBoxNnwDnJDFqJQ==} + cpu: [arm64] + os: [linux] + + '@oxlint/linux-x64-gnu@1.33.0': + resolution: {integrity: sha512-Z7ImLWM50FoVXzYvyxUQ+QwBkBfRyK4YdLEGonyAGMp7iT3DksonDaTK9ODnJ1qHyAyAZCvuqXD7AEDsDvzDbA==} + cpu: [x64] + os: [linux] + + '@oxlint/linux-x64-musl@1.33.0': + resolution: {integrity: sha512-idb55Uzu5kkqqpMiVUfI9nP7zOqPZinQKsIRQAIU40wILcf/ijvhNZKIu3ucDMmye0n6IWOaSnxIRL5W2fNoUQ==} + cpu: [x64] + os: [linux] + + '@oxlint/win32-arm64@1.33.0': + resolution: {integrity: sha512-wKKFt7cubfrLelNzdmDsNSmtBrlSUe1fWus587+uSxDZdpFbQ7liU0gsUlCbcHvym0H1Tc2O3K3cnLrgQORLPQ==} + cpu: [arm64] + os: [win32] + + '@oxlint/win32-x64@1.33.0': + resolution: {integrity: sha512-ReyR8rNHjKNnO7dxGny9RCPELRAdhm3y780FNBcA07E1wvxSCkB+Mn5db0Pa5bRmxrsU/MTZ/aaBFa+ERXDdXw==} + cpu: [x64] + os: [win32] + '@pkgjs/parseargs@0.11.0': resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} @@ -3709,6 +3755,16 @@ packages: outdent@0.5.0: resolution: {integrity: sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q==} + oxlint@1.33.0: + resolution: {integrity: sha512-4WCL0K8jiOshwJ8WrVk35VAuVaZHC0iX6asjKsrENOrynkAAGcTLLx0Urf0eXZ1Tq7r+qAe3Z9EyHMFPzVyUkg==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + oxlint-tsgolint: '>=0.9.0' + peerDependenciesMeta: + oxlint-tsgolint: + optional: true + p-filter@2.1.0: resolution: {integrity: sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==} engines: {node: '>=8'} @@ -6462,6 +6518,30 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 + '@oxlint/darwin-arm64@1.33.0': + optional: true + + '@oxlint/darwin-x64@1.33.0': + optional: true + + '@oxlint/linux-arm64-gnu@1.33.0': + optional: true + + '@oxlint/linux-arm64-musl@1.33.0': + optional: true + + '@oxlint/linux-x64-gnu@1.33.0': + optional: true + + '@oxlint/linux-x64-musl@1.33.0': + optional: true + + '@oxlint/win32-arm64@1.33.0': + optional: true + + '@oxlint/win32-x64@1.33.0': + optional: true + '@pkgjs/parseargs@0.11.0': optional: true @@ -9100,6 +9180,17 @@ snapshots: outdent@0.5.0: {} + oxlint@1.33.0: + optionalDependencies: + '@oxlint/darwin-arm64': 1.33.0 + '@oxlint/darwin-x64': 1.33.0 + '@oxlint/linux-arm64-gnu': 1.33.0 + '@oxlint/linux-arm64-musl': 1.33.0 + '@oxlint/linux-x64-gnu': 1.33.0 + '@oxlint/linux-x64-musl': 1.33.0 + '@oxlint/win32-arm64': 1.33.0 + '@oxlint/win32-x64': 1.33.0 + p-filter@2.1.0: dependencies: p-map: 2.1.0 From 5db680acc10131fb5c115ae0cec64f794579da91 Mon Sep 17 00:00:00 2001 From: pja9362 Date: Tue, 16 Dec 2025 16:44:35 +0900 Subject: [PATCH 2/5] =?UTF-8?q?docs:=20=EB=A6=AC=EB=93=9C=EB=AF=B8=20?= =?UTF-8?q?=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/oxlint-config/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/oxlint-config/README.md b/packages/oxlint-config/README.md index ae88631..69e8af8 100644 --- a/packages/oxlint-config/README.md +++ b/packages/oxlint-config/README.md @@ -87,4 +87,4 @@ package.json에 스크립트를 추가하여 lint 검사를 할 수 있습니다 ### WebStorm -[oxc-intellij-plugin](https://plugins.jetbrains.com/plugin/27061-oxc) (v0.0.21 이상)을 설치하여 사용할 수 있습니다. +[oxc-intellij-plugin](https://plugins.jetbrains.com/plugin/27061-oxc)을 설치하여 사용할 수 있습니다. From 4392d5451d020238270e4f2c156d66692c1c183f Mon Sep 17 00:00:00 2001 From: pja9362 Date: Tue, 16 Dec 2025 16:52:31 +0900 Subject: [PATCH 3/5] =?UTF-8?q?docs:=20=EB=A6=AC=EB=93=9C=EB=AF=B8=20?= =?UTF-8?q?=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/oxlint-config/README.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/oxlint-config/README.md b/packages/oxlint-config/README.md index 69e8af8..cb246d2 100644 --- a/packages/oxlint-config/README.md +++ b/packages/oxlint-config/README.md @@ -67,10 +67,20 @@ package.json에 스크립트를 추가하여 lint 검사를 할 수 있습니다 2. IDE에서 Command Palette(CMD/CTRL + Shift + P)를 열고 `settings.json`을 입력하여 설정파일을 오픈합니다. 3. 아래 설정을 추가합니다. +```json +{ + "oxc.enable": true +} +``` + +#### oxfmt와 함께 사용 시 + ```json { "oxc.enable": true, - "oxc.configPath": ".oxlintrc.json", + "oxc.fmt.experimental": true, + "editor.defaultFormatter": "oxc.oxc-vscode", + "editor.formatOnSave": true, "[typescript]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, @@ -80,11 +90,6 @@ package.json에 스크립트를 추가하여 lint 검사를 할 수 있습니다 } ``` -| 설정 | 설명 | -|------|------| -| `oxc.enable` | oxc 익스텐션 활성화 | -| `oxc.configPath` | oxlint 설정 파일 경로 | - ### WebStorm [oxc-intellij-plugin](https://plugins.jetbrains.com/plugin/27061-oxc)을 설치하여 사용할 수 있습니다. From eddee718598da82ab676e93f53d1f7318956bc2f Mon Sep 17 00:00:00 2001 From: pja9362 Date: Thu, 18 Dec 2025 16:09:55 +0900 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=EB=A6=B0=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/oxlint-config/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/oxlint-config/package.json b/packages/oxlint-config/package.json index a8d5826..1b67712 100644 --- a/packages/oxlint-config/package.json +++ b/packages/oxlint-config/package.json @@ -17,6 +17,7 @@ }, "license": "MIT", "author": "@NaverPayDev/frontend", + "type": "module", "files": [ "node" ], From 5cec9f2f4f9784bec636013fb07ce15fc50616ad Mon Sep 17 00:00:00 2001 From: pja9362 Date: Thu, 18 Dec 2025 16:11:38 +0900 Subject: [PATCH 5/5] =?UTF-8?q?docs:=20=EB=A3=A8=ED=8A=B8=20=EB=A6=AC?= =?UTF-8?q?=EB=93=9C=EB=AF=B8=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1431edb..7f7d293 100644 --- a/README.md +++ b/README.md @@ -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` 를 제공하는 패키지입니다.