no-invalid-this
Disallow
this
keywords outside of classes or class-like objects.
Attributes
- Included in configs
- ✅ Recommended
- 🔒 Strict
- Fixable
- 🔧 Automated Fixer
- 💡 Suggestion Fixer
- 💭 Requires type information
Rule Details
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 = {
// 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.
Taken with ❤️ from ESLint core