Skip to content

Oxlint 설정 파일

이 설정은 ESLint v8 설정 스키마(eslintrc.json)에 맞춰 있습니다.

사용법: oxlint -c oxlintrc.json

.oxlintrc.json

json
{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "plugins": ["import", "typescript", "unicorn"],
  "env": {
    "browser": true
  },
  "globals": {
    "foo": "readonly"
  },
  "settings": {
    "react": {
      "version": "18.2.0"
    },
    "custom": {
      "option": true
    }
  },
  "rules": {
    "eqeqeq": "warn",
    "import/no-cycle": "error",
    "react/self-closing-comp": [
      "error",
      {
        "html": false
      }
    ]
  },
  "overrides": [
    {
      "files": ["*.test.ts", "*.spec.ts"],
      "rules": {
        "@typescript-eslint/no-explicit-any": "off"
      }
    }
  ]
}

oxlint.config.ts

ts
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["import", "typescript", "unicorn"],
  env: {
    browser: true,
  },
  globals: {
    foo: "readonly",
  },
  settings: {
    react: {
      version: "18.2.0",
    },
    custom: { option: true },
  },
  rules: {
    eqeqeq: "warn",
    "import/no-cycle": "error",
    "react/self-closing-comp": ["error", { html: false }],
  },
  overrides: [
    {
      files: ["*.test.ts", "*.spec.ts"],
      rules: {
        "@typescript-eslint/no-explicit-any": "off",
      },
    },
  ],
});

$schema

타입: string

에디터 도구용 스키마 URI입니다.

categories

타입: object

규칙 카테고리 전체를 한 번에 설정합니다.

이 방식으로 켜거나 끈 규칙은 rules 필드의 개별 규칙 설정에 덮어써집니다.

json
{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "categories": {
    "correctness": "warn"
  },
  "rules": {
    "eslint/no-unused-vars": "error"
  }
}

categories.correctness

categories.nursery

categories.pedantic

categories.perf

categories.restriction

categories.style

categories.suspicious

env

타입: Record<string, boolean>

전역 변수를 미리 정의합니다.

환경(env)은 미리 정의되는 전역을 지정합니다. 사용 가능한 환경:

  • amd - require() and define() globals.
  • applescript - AppleScript globals.
  • astro - Astro globals.
  • atomtest - Atom test globals.
  • audioworklet - AudioWorklet globals.
  • browser - browser globals.
  • builtin - Latest ECMAScript globals, equivalent to es2026.
  • commonjs - CommonJS globals and scoping.
  • embertest - Ember test globals.
  • es2015 - ECMAScript 2015 globals.
  • es2016 - ECMAScript 2016 globals.
  • es2017 - ECMAScript 2017 globals.
  • es2018 - ECMAScript 2018 globals.
  • es2019 - ECMAScript 2019 globals.
  • es2020 - ECMAScript 2020 globals.
  • es2021 - ECMAScript 2021 globals.
  • es2022 - ECMAScript 2022 globals.
  • es2023 - ECMAScript 2023 globals.
  • es2024 - ECMAScript 2024 globals.
  • es2025 - ECMAScript 2025 globals.
  • es2026 - ECMAScript 2026 globals.
  • es6 - ECMAScript 6 globals except modules.
  • greasemonkey - GreaseMonkey globals.
  • jasmine - Jasmine globals.
  • jest - Jest globals.
  • jquery - jQuery globals.
  • meteor - Meteor globals.
  • mocha - Mocha globals.
  • mongo - MongoDB globals.
  • nashorn - Java 8 Nashorn globals.
  • node - Node.js globals and scoping.
  • phantomjs - PhantomJS globals.
  • prototypejs - Prototype.js globals.
  • protractor - Protractor globals.
  • qunit - QUnit globals.
  • serviceworker - Service Worker globals.
  • shared-node-browser - Node.js and Browser common globals.
  • shelljs - ShellJS globals.
  • svelte - Svelte globals.
  • vitest - Vitest globals.
  • vue - Vue globals.
  • webextensions - WebExtensions globals.
  • worker - Web Workers globals.

extends

타입: string[]

이 설정 파일이 확장(상속)하는 설정 파일 경로입니다. 경로는 extends 속성이 있는 설정 파일 위치를 기준으로 해석됩니다. 설정은 첫 파일부터 마지막 파일 순으로 병합되며, 마지막 파일이 이전 설정을 덮어씁니다.

globals

타입: Record<string, string>

전역 변수를 추가하거나 제거합니다.

각 전역 변수에 대해 덮어쓰기를 허용하려면 값을 "writable"로, 금지하려면 "readonly"로 설정합니다.

값을 "off"로 두면 전역을 비활성화할 수 있습니다. 예를 들어 ES2015 전역은 대부분 있지만 Promise만 없는 환경에서는 다음과 같이 설정할 수 있습니다.

json
{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "env": {
    "es6": true
  },
  "globals": {
    "Promise": "off"
  }
}

"readonly"를 나타내려면 "readable" 또는 false를, "writable"를 나타내려면 "writeable" 또는 true를 쓸 수도 있습니다.

ignorePatterns

타입: string[]

기본값: []

린트에서 무시할 글로브입니다. 설정 파일 경로 기준으로 해석됩니다.

jsPlugins

타입: array

JS 플러그인. Oxlint에서 ESLint 플러그인을 쓸 수 있게 합니다.

자세한 내용은 JS 플러그인 문서를 참고하세요.

참고: JS 플러그인은 알파이며 시맨틱 버전 범위에 포함되지 않습니다.

예:

로컬 플러그인 경로 기본 사용법.

json
{
  "jsPlugins": ["./custom-plugin.js"],
  "rules": {
    "custom/rule-name": "warn"
  }
}

TypeScript 플러그인과 로컬 경로 기본 사용법.

TypeScript 플러그인 파일은 다음 환경에서 지원됩니다.

  • Deno와 Bun: TypeScript 파일을 네이티브로 지원합니다.
  • Node.js >=22.18.0 및 Node.js ^20.19.0: 기본으로 켜진 내장 타입 제거(type-stripping)로 TypeScript 파일을 네이티브로 지원합니다.

이보다 오래된 Node.js에서는 TypeScript 플러그인이 지원되지 않습니다. JavaScript 플러그인을 쓰거나 Node를 업그레이드하세요.

json
{
  "jsPlugins": ["./custom-plugin.ts"],
  "rules": {
    "custom/rule-name": "warn"
  }
}

이름이 같은 내장 Rust 플러그인과 JS 플러그인을 함께 쓰려면 JS 플러그인에 별칭을 줍니다.

json
{
  "plugins": ["import"],
  "jsPlugins": [{ "name": "import-js", "specifier": "eslint-plugin-import" }],
  "rules": {
    "import/no-cycle": "error",
    "import-js/no-unresolved": "warn"
  }
}

jsPlugins[n]

타입: object | string

jsPlugins[n].name

타입: string

플러그인의 사용자 정의 이름/별칭입니다.

참고: 다음 플러그인 이름은 oxlint에서 Rust로 네이티브 구현되어 있어 JS 플러그인 이름으로 쓸 수 없습니다.

  • react (includes react-hooks)
  • unicorn
  • typescript (includes @typescript-eslint)
  • oxc
  • import (includes import-x)
  • jsdoc
  • jest
  • vitest
  • jsx-a11y
  • nextjs
  • react-perf
  • promise
  • node
  • vue
  • eslint

이 플러그인의 JavaScript 버전이 필요하면 충돌을 피하도록 사용자 정의 별칭을 지정하세요.

jsPlugins[n].specifier

타입: string

플러그인 경로 또는 패키지 이름입니다.

options

타입: object

린터 옵션입니다.

options.denyWarnings

타입: boolean

경고도 0이 아닌 종료 코드를 내게 합니다.

CLI에서 --deny-warnings를 주는 것과 같습니다.

options.maxWarnings

타입: integer

경고 개수 임계값입니다. 이 값을 넘으면 오류 상태로 종료합니다.

CLI에서 --max-warnings를 주는 것과 같습니다.

options.reportUnusedDisableDirectives

타입: "allow" | "off" | "warn" | "error" | "deny" | integer

사용되지 않는 비활성 지시문을 보고합니다(예: // oxlint-disable-line, // eslint-disable-line).

CLI의 --report-unused-disable-directives-severity와 같습니다. CLI와 둘 다 설정되어 있으면 CLI가 우선합니다. 루트 설정 파일에서만 지원됩니다.

options.respectEslintDisableDirectives

타입: boolean

네이티브 oxlint-* 지시문 외에 eslint-disable*, eslint-enable* 지시문도 존중할지 여부입니다.

기본값은 true입니다. 루트 설정 파일에서만 지원됩니다.

options.typeAware

타입: boolean

타입 정보가 필요한 규칙을 켭니다.

CLI에서 --type-aware를 주는 것과 같습니다.

oxlint-tsgolint 패키지가 설치되어 있어야 합니다.

options.typeCheck

타입: boolean

실험적 타입 검사를 켭니다(TypeScript 컴파일러 진단 포함).

CLI에서 --type-check를 주는 것과 같습니다.

oxlint-tsgolint 패키지가 설치되어 있어야 합니다.

overrides

타입: array

overrides[n]

타입: object

overrides[n].env

타입: object

환경은 전역 변수 묶음을 켜거나 끕니다.

overrides[n].files

타입: string[]

글로브 패턴 집합입니다.

overrides[n].globals

타입: object

특정 전역 변수를 켜거나 끕니다.

overrides[n].jsPlugins

타입: array

이 override용 JS 플러그인. Oxlint에서 ESLint 플러그인을 쓸 수 있게 합니다.

자세한 내용은 JS 플러그인 문서를 참고하세요.

참고: JS 플러그인은 알파이며 시맨틱 버전 범위에 포함되지 않습니다.

overrides[n].jsPlugins[n]

타입: object | string

overrides[n].jsPlugins[n].name

타입: string

플러그인의 사용자 정의 이름/별칭입니다.

참고: 다음 플러그인 이름은 oxlint에서 Rust로 네이티브 구현되어 있어 JS 플러그인 이름으로 쓸 수 없습니다.

  • react (includes react-hooks)
  • unicorn
  • typescript (includes @typescript-eslint)
  • oxc
  • import (includes import-x)
  • jsdoc
  • jest
  • vitest
  • jsx-a11y
  • nextjs
  • react-perf
  • promise
  • node
  • vue
  • eslint

이 플러그인의 JavaScript 버전이 필요하면 충돌을 피하도록 사용자 정의 별칭을 지정하세요.

overrides[n].jsPlugins[n].specifier

타입: string

플러그인 경로 또는 패키지 이름입니다.

overrides[n].plugins

타입: array

기본값: null

이 override에서 켤 플러그인을 바꿉니다(선택). 생략하면 기본 설정의 플러그인을 사용합니다.

overrides[n].plugins[n]

타입: "eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue"

overrides[n].rules

타입: object

See Oxlint 규칙

plugins

타입: array

기본값: null

Oxlint에 켤 내장 플러그인입니다. 사용 가능한 플러그인 목록은 웹사이트에서 볼 수 있습니다.

참고: plugins 필드를 설정하면 기본 플러그인 집합을 덮어씁니다. plugins 배열에는 사용할 플러그인을 모두 넣어야 합니다.

plugins[n]

타입: "eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue"

rules

타입: object

See Oxlint 규칙

settings

타입: object

린터 플러그인 동작을 설정합니다.

모노레포에서 Next.js를 쓰는 경우의 예:

json
{
  "settings": {
    "next": {
      "rootDir": "apps/dashboard/"
    },
    "react": {
      "linkComponents": [
        {
          "name": "Link",
          "linkAttribute": "to"
        }
      ]
    },
    "jsx-a11y": {
      "components": {
        "Link": "a",
        "Button": "button"
      }
    }
  }
}

settings.jest

타입: object

Jest 플러그인 규칙을 설정합니다.

전체 설명은 eslint-plugin-jest 설정을 참고하세요.

settings.jest.version

타입: integer | string

기본값: null

Jest 버전 — 숫자(29) 또는 시맨틱 버전 문자열("29.1.0", "v29.1.0")을 받으며, 주버전만 저장합니다.

WARNING

이 설정을 쓰면 no-deprecated-functions 규칙에 설정한 값을 덮어씁니다.

settings.jsdoc

타입: object

settings.jsdoc.augmentsExtendsReplacesDocs

타입: boolean

기본값: false

require-(yields|returns|description|example|param|throws) 규칙 전용입니다.

settings.jsdoc.exemptDestructuredRootsFromChecks

타입: boolean

기본값: false

require-param-type, require-param-description 규칙 전용입니다.

settings.jsdoc.ignoreInternal

타입: boolean

기본값: false

대부분 규칙에 적용되지만 empty-tags 규칙에는 적용되지 않습니다.

settings.jsdoc.ignorePrivate

타입: boolean

기본값: false

대부분 규칙에 적용되지만 check-access, empty-tags 규칙에는 적용되지 않습니다.

settings.jsdoc.ignoreReplacesDocs

타입: boolean

기본값: true

require-(yields|returns|description|example|param|throws) 규칙 전용입니다.

settings.jsdoc.implementsReplacesDocs

타입: boolean

기본값: false

require-(yields|returns|description|example|param|throws) 규칙 전용입니다.

settings.jsdoc.overrideReplacesDocs

타입: boolean

기본값: true

require-(yields|returns|description|example|param|throws) 규칙 전용입니다.

settings.jsdoc.tagNamePreference

타입: object

기본값: {}

타입: object

JSX A11y 플러그인 규칙을 설정합니다.

전체 설명은 eslint-plugin-jsx-a11y 설정을 참고하세요.

settings.jsx-a11y.attributes

타입: Record<string, array>

기본값: {}

속성 이름을 DOM에 대응하는 형태로 매핑합니다. React가 아닌 프레임워크에서 다른 속성 이름을 쓸 때 유용합니다.

예:

json
{
  "settings": {
    "jsx-a11y": {
      "attributes": {
        "for": ["htmlFor", "for"]
      }
    }
  }
}

settings.jsx-a11y.components

타입: Record<string, string>

기본값: {}

사용자 정의 컴포넌트를 DOM 요소처럼 검사하려면 컴포넌트 이름에서 DOM 요소 이름으로의 매핑을 제공합니다.

예:

json
{
  "settings": {
    "jsx-a11y": {
      "components": {
        "Link": "a",
        "IconButton": "button"
      }
    }
  }
}

settings.jsx-a11y.polymorphicPropName

타입: string

폴리모픽 컴포넌트를 만들 때 코드가 사용하는 prop 이름을 정하는 선택 설정입니다. 의미 맥락이 필요한 규칙에서 요소 타입을 판별할 때 씁니다.

예를 들어 polymorphicPropNameas로 두면 다음 요소는

jsx
<Box as="h3">Hello</Box>

h3로 간주합니다. 설정하지 않으면 Box로 간주합니다.

settings.next

타입: object

Next.js 플러그인 규칙을 설정합니다.

settings.next.rootDir

타입: array | string

settings.next.rootDir[n]

타입: string

settings.react

타입: object

React 플러그인 규칙을 설정합니다.

eslint-plugin-react에서 따왔습니다.

settings.react.componentWrapperFunctions

타입: string[]

기본값: []

React 컴포넌트를 감싸며 HOC로 취급해야 하는 함수들입니다.

예:

jsonc
{
  "settings": {
    "react": {
      "componentWrapperFunctions": ["observer", "withRouter"],
    },
  },
}

settings.react.formComponents

타입: array

기본값: []

<form> 대신 쓰는 폼 컴포넌트입니다(예: <Formik>).

예:

jsonc
{
  "settings": {
    "react": {
      "formComponents": [
        "CustomForm",
        // OtherForm is considered a form component and has an endpoint attribute
        { "name": "OtherForm", "formAttribute": "endpoint" },
        // allows specifying multiple properties if necessary
        { "name": "Form", "formAttribute": ["registerEndpoint", "loginEndpoint"] },
      ],
    },
  },
}
settings.react.formComponents[n]

타입: object | string

settings.react.formComponents[n].attribute

타입: string

settings.react.formComponents[n].name

타입: string

settings.react.linkComponents

타입: array

기본값: []

<a> 대신 쓰는 링크 컴포넌트입니다(예: <Link>).

예:

jsonc
{
  "settings": {
    "react": {
      "linkComponents": [
        "HyperLink",
        // Use `linkAttribute` for components that use a different prop name
        // than `href`.
        { "name": "MyLink", "linkAttribute": "to" },
        // allows specifying multiple properties if necessary
        { "name": "Link", "linkAttribute": ["to", "href"] },
      ],
    },
  },
}
settings.react.linkComponents[n]

타입: object | string

settings.react.linkComponents[n].attribute

타입: string

settings.react.linkComponents[n].name

타입: string

settings.react.version

타입: string

기본값: null

버전별 규칙에 쓸 React 버전입니다.

시맨틱 버전을 받습니다(예: "18.2.0", "17.0").

예:

jsonc
{
  "settings": {
    "react": {
      "version": "18.2.0",
    },
  },
}

settings.vitest

타입: object

Vitest 플러그인 규칙을 설정합니다.

전체 설명은 eslint-plugin-vitest 설정을 참고하세요.

settings.vitest.typecheck

타입: boolean

기본값: false

Vitest 규칙의 타입체크 모드 사용 여부입니다. 켜면 TypeScript 타입 검사 시나리오에 맞추기 위해 describe 블록에 대한 일부 검사를 건너뜁니다.