Skip to content
← All rules
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.

namingfunctionsbehavior
TypeScript
function deleteUser(id: string) { return db.users.find(id); }
Finding

Disallow names that contradict visible behavior.

Setup

Install the package, register its plugin factory, then enable the rule.

Install the package

pnpm add -D @scruple/api-contracts

Register 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

Released under the MIT License.