Oxlint 설정 파일
이 설정은 ESLint v8의 구성 스키마(eslintrc.json)와 일치합니다.
사용법: oxlint -c oxlintrc.json --import-plugin
참고
.json 형식만 지원됩니다. 구성 파일 내에서 주석을 사용할 수 있습니다.
예제
.oxlintrc.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"
}
}
]
}$schema
type: string
에디터 도구 사용을 위한 스키마 URI입니다.
categories
type: object
규칙 전체 카테고리를 한 번에 구성합니다.
이 방식으로 활성화 또는 비활성화된 규칙은 rules 필드 내 개별 규칙에 의해 재정의됩니다.
예제
{
"$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
type: Record<string, boolean>
미리 정의된 전역 변수를 지정합니다.
환경은 어떤 전역 변수가 미리 정의되는지를 지정합니다. 사용 가능한 환경과 각 환경이 제공하는 내용에 대해 ESLint의 환경 목록을 참조하세요.
extends
type: string[]
이 구성 파일이 확장(상속)하는 구성 파일 경로들입니다. 이 파일들은 extends 속성이 포함된 구성 파일의 위치 기준으로 해석됩니다. 구성 파일은 첫 번째부터 마지막까지 병합되며, 마지막 파일이 이전 파일들을 덮어씁니다.
globals
type: Record<string, string>
전역 변수를 추가하거나 제거합니다.
각 전역 변수에 대해, 해당 값이 "writable"로 설정되면 변수를 재정의할 수 있고, "readonly"로 설정되면 재정의를 금지합니다.
전역 변수는 값을 "off"로 설정하여 비활성화할 수 있습니다. 예를 들어, 대부분의 ES2015 전역 변수가 사용 가능하지만 Promise는 사용 불가능한 환경에서는 다음과 같이 구성할 수 있습니다:
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"env": {
"es6": true
},
"globals": {
"Promise": "off"
}
}또한 "readable" 또는 false는 "readonly"를 의미하고, "writeable" 또는 true는 "writable"를 의미할 수 있습니다.
ignorePatterns
type: string[]
기본값: []
형식 검사 중 무시할 글로브 패턴입니다. 이들은 구성 파일 경로로부터 해결됩니다.
jsPlugins
type: array
JS 플러그인, Oxlint에서 ESLint 플러그인 사용을 허용합니다.
자세한 정보는 문서에서 확인하세요.
참고: JS 플러그인은 실험적 기능이며, semver 규칙을 따르지 않습니다.
예제:
로컬 플러그인 경로를 사용하는 기본적인 사용법.
{
"jsPlugins": ["./custom-plugin.js"],
"rules": {
"custom/rule-name": "warn"
}
}같은 이름의 빌트인 Rust 플러그인과 함께 JS 플러그인을 사용하려면, JS 플러그인에 별칭을 부여하세요.
{
"plugins": ["import"],
"jsPlugins": [{ "name": "import-js", "specifier": "eslint-plugin-import" }],
"rules": {
"import/no-cycle": "error",
"import-js/no-unresolved": "warn"
}
}jsPlugins[n]
type: object | string
jsPlugins[n].name
type: string
플러그인에 대한 사용자 정의 이름/별칭입니다.
참고: 다음 플러그인 이름은 oxlint 내부에서 직접 구현되어 있어, 자바스크립트 플러그인에서 사용할 수 없습니다. 예약된 이름입니다:
- react (react-hooks 포함)
- unicorn
- typescript (@typescript-eslint 포함)
- oxc
- import (import-x 포함)
- jsdoc
- jest
- vitest
- jsx-a11y
- nextjs
- react-perf
- promise
- node
- vue
- eslint
이 플러그인들의 자바스크립트 버전을 사용해야 한다면, 충돌을 피하기 위해 사용자 정의 별칭을 제공하세요.
jsPlugins[n].specifier
type: string
플러그인의 경로 또는 패키지 이름
overrides
type: array
overrides[n]
type: object
overrides[n].env
type: object
환경은 전역 변수의 컬렉션을 활성화하거나 비활성화합니다.
overrides[n].files
type: string[]
글로브 패턴 세트입니다.
overrides[n].globals
type: object
특정 전역 변수를 활성화하거나 비활성화합니다.
overrides[n].jsPlugins
type: array
이 오버라이드에 대한 JS 플러그인, Oxlint에서 ESLint 플러그인 사용을 허용합니다.
자세한 정보는 문서에서 확인하세요.
참고: JS 플러그인은 실험적 기능이며, semver 규칙을 따르지 않습니다.
overrides[n].jsPlugins[n]
type: object | string
overrides[n].jsPlugins[n].name
type: string
플러그인에 대한 사용자 정의 이름/별칭입니다.
참고: 다음 플러그인 이름은 oxlint 내부에서 직접 구현되어 있어, 자바스크립트 플러그인에서 사용할 수 없습니다. 예약된 이름입니다:
- react (react-hooks 포함)
- unicorn
- typescript (@typescript-eslint 포함)
- oxc
- import (import-x 포함)
- jsdoc
- jest
- vitest
- jsx-a11y
- nextjs
- react-perf
- promise
- node
- vue
- eslint
이 플러그인들의 자바스크립트 버전을 사용해야 한다면, 충돌을 피하기 위해 사용자 정의 별칭을 제공하세요.
overrides[n].jsPlugins[n].specifier
type: string
플러그인의 경로 또는 패키지 이름
overrides[n].plugins
type: array
기본값: null
선택적으로 이 오버라이드에 대해 활성화된 플러그인을 변경할 수 있습니다. 누락되었을 경우, 기본 구성의 플러그인이 사용됩니다.
overrides[n].plugins[n]
type: "eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue"
overrides[n].rules
type: object
Oxlint 규칙을 참조하세요.
plugins
type: array
기본값: null
Oxlint에서 활성화된 내장 플러그인입니다. 사용 가능한 플러그인 목록은 웹사이트에서 확인할 수 있습니다.
참고: plugins 필드를 설정하면 기본 플러그인 세트가 재정의됩니다. plugins 배열은 사용하고자 하는 모든 플러그인을 반영해야 합니다.
plugins[n]
type: "eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue"
rules
type: object
Oxlint 규칙을 참조하세요.
settings
type: object
형식 검사 플러그인의 동작을 구성합니다.
모노레포에서 Next.js를 사용하는 경우의 예제:
{
"settings": {
"next": {
"rootDir": "apps/dashboard/"
},
"react": {
"linkComponents": [
{
"name": "Link",
"linkAttribute": "to"
}
]
},
"jsx-a11y": {
"components": {
"Link": "a",
"Button": "button"
}
}
}
}settings.jsdoc
type: object
settings.jsdoc.augmentsExtendsReplacesDocs
type: boolean
기본값: false
require-(yields|returns|description|example|param|throws) 규칙 전용
settings.jsdoc.exemptDestructuredRootsFromChecks
type: boolean
기본값: false
require-param-type 및 require-param-description 규칙 전용
settings.jsdoc.ignoreInternal
type: boolean
기본값: false
모든 규칙에 적용되지만 empty-tags 규칙에는 적용되지 않음
settings.jsdoc.ignorePrivate
type: boolean
기본값: false
모든 규칙에 적용되지만 check-access 및 empty-tags 규칙에는 적용되지 않음
settings.jsdoc.ignoreReplacesDocs
type: boolean
기본값: true
require-(yields|returns|description|example|param|throws) 규칙 전용
settings.jsdoc.implementsReplacesDocs
type: boolean
기본값: false
require-(yields|returns|description|example|param|throws) 규칙 전용
settings.jsdoc.overrideReplacesDocs
type: boolean
기본값: true
require-(yields|returns|description|example|param|throws) 규칙 전용
settings.jsdoc.tagNamePreference
type: object
기본값: {}
settings.jsx-a11y
type: object
JSX A11y 플러그인 규칙을 구성합니다.
자세한 참조는 eslint-plugin-jsx-a11y의 설정을 참고하세요.
settings.jsx-a11y.attributes
type: Record<string, array>
기본값: {}
속성 이름과 그에 대응하는 DOM equivalent의 매핑입니다. 이는 다른 속성 이름을 사용하는 리액트 외 프레임워크에 유용합니다.
예제:
{
"settings": {
"jsx-a11y": {
"attributes": {
"for": ["htmlFor", "for"]
}
}
}
}settings.jsx-a11y.components
type: Record<string, string>
기본값: {}
사용자 정의 컴포넌트가 DOM 요소처럼 검사되도록 하려면, 컴포넌트 이름을 DOM 요소 이름으로 매핑할 수 있습니다.
예제:
{
"settings": {
"jsx-a11y": {
"components": {
"Link": "a",
"IconButton": "button"
}
}
}
}settings.jsx-a11y.polymorphicPropName
type: string
다양한 타입의 컴포넌트를 생성하는 데 사용하는 속성을 정의하는 선택적 설정입니다. 이 설정은 의미론적 컨텍스트를 필요로 하는 규칙에서 요소의 타입을 결정하는 데 사용됩니다.
예를 들어, polymorphicPropName을 as로 설정했다면, 다음 요소:
<Box as="h3">Hello</Box>는 h3로 처리됩니다. 설정하지 않으면, 이 컴포넌트는 Box로 처리됩니다.
settings.next
type: object
Next.js 플러그인 규칙을 구성합니다.
settings.next.rootDir
type: array | string
settings.next.rootDir[n]
type: string
settings.react
type: object
React 플러그인 규칙을 구성합니다.
eslint-plugin-react에서 파생되었습니다.
settings.react.componentWrapperFunctions
type: string[]
기본값: []
리액트 컴포넌트를 감싸는 함수이며, 고차 컴포넌트(HOC)로 간주되어야 합니다.
예제:
{
"settings": {
"react": {
"componentWrapperFunctions": ["observer", "withRouter"],
},
},
}settings.react.formComponents
type: array
기본값: []
폼의 대체 요소로 사용되는 컴포넌트, 예를 들어 <Formik>.
예제:
{
"settings": {
"react": {
"formComponents": [
"CustomForm",
// OtherForm은 폼 컴포넌트로 간주되고, 엔드포인트 속성을 가짐
{ "name": "OtherForm", "formAttribute": "endpoint" },
// 필요한 경우 여러 속성을 지정할 수 있음
{ "name": "Form", "formAttribute": ["registerEndpoint", "loginEndpoint"] },
],
},
},
}settings.react.formComponents[n]
type: object | string
settings.react.formComponents[n].attribute
type: string
settings.react.formComponents[n].name
type: string
settings.react.linkComponents
type: array
기본값: []
링크에 대한 대체 요소로 사용되는 컴포넌트, 예를 들어 <Link>.
예제:
{
"settings": {
"react": {
"linkComponents": [
"HyperLink",
// `href`가 아닌 다른 속성 이름을 사용하는 컴포넌트에 `linkAttribute` 사용
{ "name": "MyLink", "linkAttribute": "to" },
// 필요한 경우 여러 속성을 지정할 수 있음
{ "name": "Link", "linkAttribute": ["to", "href"] },
],
},
},
}settings.react.linkComponents[n]
type: object | string
settings.react.linkComponents[n].attribute
type: string
settings.react.linkComponents[n].name
type: string
settings.react.version
type: string
기본값: null
버전 기반 규칙에 사용할 리액트 버전입니다.
semver 버전을 허용합니다 (예: "18.2.0", "17.0").
예제:
{
"settings": {
"react": {
"version": "18.2.0",
},
},
}settings.vitest
type: object
Vitest 플러그인 규칙을 구성합니다.
자세한 참조는 eslint-plugin-vitest's 설정을 참고하세요.
settings.vitest.typecheck
type: boolean
기본값: false
Vitest 규칙에서 타입 검사 모드를 활성화할지 여부입니다. 활성화되면, 일부 규칙이 describe 블록에 대한 특정 검사를 건너뜁니다. 이것은 타입스크립트 타입 검사 시나리오에 맞추기 위함입니다.
