ESLint 정적 검사
요약 — 정적 검사(static check)
eslint(scripts/gates/eslint.mjs)는 앱 소스와 도구·테스트 코드를 ESLint 로 검사한다. 오류와 경고는 한 건이면 실패하고(hard), 억제 주석(suppression)은 기술 부채 베이스라인(ledger)scripts/gates/ledger/eslint.json에 적힌 것만 허용된다.
명령
bash
npm run lint # ESLint 결과를 사람이 읽는 형태로 출력
npm run check:lint # = node --import tsx scripts/gates/run.mjs eslint (QA3 `gates` 테스트 세트에 포함)
node --import tsx scripts/gates/run.mjs eslint --lint "<glob>" # 일부 파일만검사 범위와 규칙
설정은 ESLint flat config eslint.config.mjs 하나다.
| 설정 이름 | 대상 | 규칙 |
|---|---|---|
barbelic/react-typescript | src/react/**/*.{ts,tsx} | react-hooks/rules-of-hooks·react-hooks/exhaustive-deps error. 전역 ResizeObserver 금지(요소 크기 관찰은 ui/shared/measure/observeSize.ts 의 observeSize) |
barbelic/tooling-unused | scripts/**·tests/** 의 mjs·js·cjs·ts·tsx | @typescript-eslint/no-unused-vars error |
barbelic/no-void-identifier | 위 둘 전부 | void 이름; 문장으로 쓰지 않는 값을 살려 두는 것 금지 |
barbelic/app-declaration-order | src/react/app/** | @typescript-eslint/no-use-before-define(변수·클래스) |
barbelic/size-observer-owners | observeSize.ts·ui/desktop/** | ResizeObserver 금지를 끈다 |
두 설정 모두 쓰지 않는 억제 주석과 인라인 설정을 error 로 보고한다(reportUnusedDisableDirectives·reportUnusedInlineConfigs).
억제 주석
- 허용되는 모양은 한 줄 범위의
eslint-disable-line또는eslint-disable-next-line에 규칙 이름과-- 이유가 붙은 것뿐이다. 파일 전체eslint-disable, 규칙 이름이 없거나 이유가 없는 주석은 기술 부채 베이스라인과 무관하게 실패한다(suppression-form, hard). - 모양이 맞는 억제 주석은 기술 부채 베이스라인과 대조한다. 기술 부채 베이스라인 키는
suppression|파일|억제 주석 원문이다. 기술 부채 베이스라인에 없는 억제 주석은넘음, 기술 부채 베이스라인에 있는데 사라진 것은낡음으로 실패한다. - 기술 부채 베이스라인 형식·갱신 규칙은 정적 검사 계약의 기술 부채 베이스라인 한 형식이다. 사라진 억제 주석은
npm run qa3 -- run --lane work --suite gates -- eslint --update로 기술 부채 베이스라인에서 내리고, 새 억제 주석은--update --raise "사유" --owner "#N" --release vX.Y.Z로만 기술 부채 베이스라인에 들어간다.
설정 형식은 ESLint flat config, hook 규칙의 의미는 React Hooks lint 문서를 따른다.