Deprecated API
This is how the comment reads inline, under the flagged line.
Why it matters
Deprecated APIs still work today and print warnings, change behavior or disappear in the next major version.
What to do
Use the current API: Buffer.from, new URL, datetime.now(UTC), asyncio.run, slice.
Examples
const b = new Buffer(str);
const b = Buffer.from(str);
What it catches
It reads a pattern on each line, aware of strings and comments. Languages: TypeScript and JavaScript, Python. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.
Flagged
const b = new Buffer(s);
src/app.py
from datetime import datetime t = datetime.utcnow()
Left alone
const b = Buffer.from(s);
Research
Deprecated APIs from older training data (`new Buffer()`, `url.parse`, `distutils`, `asyncio.get_event_loop()`). They warn, behave differently or are already gone in current runtimes.
Turn it off or change it
In a config file for the CLI, or in the API's rules field:
{
"rules": {
"disable": [
"stale-api"
],
"severity": {
"stale-api": "low"
}
}
}
new Bufferis deprecated. Models trained on old code keep suggesting it.