JS.TS.NO.INVALID.THIS

Disallow 'this' keywords outside of classes or class-like objects

Rule Details

This rule extends the base eslint/no-invalid-this (https://eslint.org/docs/rules/no-invalid-this) rule. It adds support for TypeScript's this parameters.

How to Use

Copy
{
  // note you must disable the base rule as it can report incorrect errors
  "no-invalid-this": "off",
  "@typescript-eslint/no-invalid-this": ["error"]
}

Options

See eslint/no-invalid-this options (https://eslint.org/docs/rules/no-invalid-this#options).

When Not To Use It

When you are indifferent as to how your variables are initialized.

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/