Rule: no-invalid-this

Disallows using the this keyword outside of classes.

Rationale

See the rule’s author’s rationale here.

Config

One argument may be optionally provided:

  • check-function-in-method disallows using the this keyword in functions within class methods.
Examples
"no-invalid-this": true
"no-invalid-this": [true, "check-function-in-method"]
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "check-function-in-method"
    ]
  },
  "minLength": 0,
  "maxLength": 1
}