Something went wrong. Try again.
can't touch this jsr.io/@tyler/no-this-plugin
Something went wrong. Try again.
TypeScript 100%
README.md
no-this-plugin #
A Deno plugin to disallow this in your code.
Rule Details #
The rule is named no-this and it will error if you use this in any of the
following ways:
- In a function call
- In an assignment
- In a class constructor
error[no-this-plugin/no-this]: Can't touch `this`
--> /Users/tylerlawson/gitspace/deno-plugin/main.ts:2:3
|
2 | this.thing = 1;
| ^^^^
Found 1 problem
Installation #
deno.json:
{
"lint": {
"plugins": ["jsr:@tyler/no-this-plugin"]
}
}
Invalid Code #
function foo() {
this.thing = 1;
}
function foo() {
this.thing();
}
class Foo {
constructor() {
this.thing = 1;
}
}
class Foo {
thing() {
this.thing = 1;
}
}
Valid Code #
class Thing {
thing = 1;
}
const foo = () => {
const notThis = 1;
};