print(content: string, header = this.defaultHeader) { ... }
Biome looked at this method and said: you never use this, so make it static or move it out of the class. Do that, and this.defaultHeader stops working.
The report came from luisfi-dev as issue #13084; the patch landed as biomejs/biome#13098.
Quick context
Biome is a formatter and linter for JavaScript, TypeScript and friends, written in Rust. Its useThisInClassMethods rule (the same idea as ESLint's class-methods-use-this) flags methods that never touch this, because those don't need an instance and could be static.
A default parameter value is evaluated on each call that leaves that argument out, with the same this as the body. That makes this.defaultHeader in the signature a genuine use of the instance.
The blind spot
It was like a security camera pointed at the room but not the doorway. For methods and setters, the rule searched the body for this and never looked at the parameter list. Following its advice here would have turned working code into broken code, which is the worst thing a style hint can do.
The fix looks at both:
uses_lexical_this(member.parameters().ok()?.syntax())
|| uses_lexical_this(member.body().ok()?.syntax()),
Class fields holding a function, like arrowField = (value = this.defaultHeader) => value, got the same treatment.
Checking parameters and body separately kept the old rules about nesting. An arrow function in a default shares the method's this, so callback = () => this.defaultHeader counts. A regular function has its own this, so callback = function () { return this.value; } doesn't. And a TypeScript this: SomeType parameter is only a type, not a use.
The bot caught what I missed
CodeRabbit, the review bot Biome uses, left a note marked minor: parameter decorators. In
method(@decorate(this.key) value: unknown) { return value; }
that @decorate(...) is evaluated while the class is being set up. Calling method later never touches it. My change walked the whole parameter list, so this method would now count as using this, even though it doesn't.
It was right. I added decorators to the list of places the search skips, next to nested classes and static blocks, plus two test files for it: decorator only (still reported) and decorator plus a real default (fine).
Biome's rule tests are snapshot tests: each sample file is linted and the output is compared with a saved .snap file. I added five sample files, covering defaults that should and shouldn't count, the TypeScript this parameter, and the two decorator cases. On main, the two files of code that should pass get flagged. With the PR, all 18 cases come out right.
Separately, dyc3, a maintainer, pointed me to the PR template I hadn't filled in. Once that was sorted, dyc3 approved and merged the PR on 11 November 2026.
The lesson
For a rule about this, I now ask when each piece of code runs, not only where this shows up. Defaults run at call time. Decorators run at class creation. Same line of source, two different moments, and only one of them belongs to the method.
What's a lint rule that confidently told you something wrong about your code?
The full story, with all the code, is on my blog: https://ashokramsi.hashnode.dev/biome-this-in-parameter-defaults
Top comments (0)