Compatibility shim
Compatibility shim. Keeps an old path alive (backwards compatibility). Two ways to do one thing is the start of entropy.
This is how the comment reads inline, under the flagged line.
Why it matters
Compatibility layers and legacy aliases mean every reader has to learn both paths, and the old one never gets deleted.
What to do
Do a clean cutover: update every caller, delete the old code and the shim in the same change.
Examples
// kept for backwards compatibility export const getUserLegacy = getUser;
// (alias deleted; callers use getUser)
What it catches
It reads a pattern on each line, aware of strings and comments. Languages: Any file. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.
Flagged
// kept for backwards compatibility
export const loadLegacy = load;
Left alone
// Loads users by id.
Research
Compatibility shims and old/new switches kept beside the replacement. Two paths double the places a bug can live, and the old one is never tested.
Turn it off or change it
In a config file for the CLI, or in the API's rules field:
{
"rules": {
"disable": [
"compat-shim"
],
"severity": {
"compat-shim": "low"
}
}
}