binochoi-lib-rules
v0.1.0
Published
Very strict, shared oxlint + Biome lint/format rules for binochoi's libraries.
Readme
binochoi-lib-rules
라이브러리에서 사용할 oxlint 혹은 biome 린터 + 포매터.
라이브러리는 oxlint나 @biomejs/biome을 직접 설치한 뒤 나머지 규칙 설정은 전부 이 패키지 하나를 한 줄로 가져다 씁니다.
// oxlint.config.ts
import { defineConfig } from "oxlint";
import lintRules from "binochoi-lib-rules/oxlint";
export default defineConfig({ extends: [lintRules] });// biome.json
{ "extends": ["binochoi-lib-rules/biome"] }설치
npm install -D binochoi-lib-rules
npm install -D oxlint # oxlint를 쓴다면
npm install -D @biomejs/biome # Biome을 쓴다면oxlint와 @biomejs/biome은 peerDep으로서 요구됩니다.
사용법
oxlint
프로젝트 루트에 oxlint.config.ts를 만들고 위 스니펫처럼 lintRules를 extends에 넣습니다. .oxlintrc.json(JSON) 형식은 extends가 상대 경로만 지원하기 때문에, 패키지를 import로 가져오려면 반드시 oxlint.config.ts 형식을 사용해야 합니다.
Biome
프로젝트 루트에 biome.json을 만들고 위 스니펫처럼 extends에 패키지 이름을 넣습니다.
로컬에서 규칙 오버라이드하기
extends로 가져온 뒤에도 얼마든지 로컬 규칙을 추가/덮어쓸 수 있습니다.
export default defineConfig({
extends: [lintRules],
rules: {
"no-console": "off",
},
});{
"extends": ["binochoi-lib-rules/biome"],
"linter": {
"rules": {
"suspicious": { "noConsole": "off" }
}
}
}VSCode 설정
VSCode에서 저장 시 자동으로 린트/포맷이 적용되도록 하려면 아래 확장을 설치하고 .vscode/settings.json을 설정합니다.
- oxlint: oxc.oxc-vscode
- Biome: biomejs.biome
// .vscode/settings.json
{
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.biome": "explicit",
"source.fixAll.oxc": "explicit"
}
}oxlint와 Biome 중 하나만 쓴다면 해당하지 않는 확장/설정은 빼도 됩니다.
개발
이 저장소 자신도 같은 규칙으로 self-lint합니다. 루트의 oxlint.config.ts/biome.json이 ./oxlint/index.js, ./biome/biome.json을 상대 경로로 참조합니다.
npm run lint # oxlint
npm run check # biome check
npm run format # biome format --write
npm run verify # npm pack → test/fixture에 설치 → bare specifier로 실제 동작 검증라이선스
MIT
