oxc/only-used-in-recursion Correctness
무엇을 하나요
Checks for arguments that are only used in recursion with no side-effects.
Inspired by the only_used_in_recursion rule in Clippy.
왜 문제인가요?
Supplying an argument that is only used in recursive calls is likely a mistake.
It increases cognitive complexity and may impact performance.
예시
이 규칙에서 올바르지 않은 코드 예:
ts
function test(onlyUsedInRecursion) {
return test(onlyUsedInRecursion);
}이 규칙에서 올바른 코드 예:
ts
function f(a: number): number {
if (a == 0) {
return 1;
} else {
return f(a - 1);
}
}사용 방법
To enable this rule using the config file or in the CLI, you can use:
json
{
"rules": {
"oxc/only-used-in-recursion": "error"
}
}ts
import { defineConfig } from "oxlint";
export default defineConfig({
rules: {
"oxc/only-used-in-recursion": "error",
},
});bash
oxlint --deny oxc/only-used-in-recursion버전
이 규칙은 v0.1.1에 추가되었습니다.