API ContractsAPI contracts
api-contracts/no-misleading-function-names
Named implementation functions should fulfill concrete promises made by their names when their behavior is visible in the same file.
01 Examples
TypeScript
function deleteUser(id: string) { return db.users.find(id); }Finding
Disallow names that contradict visible behavior.
02 Enable it
Setup
Install the package, register its plugin factory, then enable the rule.
Install the package
pnpm add -D @scruple/api-contractsRegister the plugin
In scruple.config.ts, register the factory under the api-contracts namespace used by the rule ID.
import { apiContracts } from "@scruple/api-contracts";
plugins: {
"api-contracts": apiContracts(),
},Enable the rule
"api-contracts/no-misleading-function-names": "warn"- Package
@scruple/api-contracts- Default threshold
- 0.9
- Minimum confidence
- 0.7