Skip to main content

no-invalid-this

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

Examples

This rule extends the base eslint/no-invalid-this rule. It adds support for TypeScript's this parameters.

How to Use

.eslintrc.cjs
module.exports = {
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"no-invalid-this": "off",
"@typescript-eslint/no-invalid-this": "warn"
}
};

Options

See eslint/no-invalid-this options.

Resources

Taken with ❤️ from ESLint core