-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
- ESLint Version: 6.4.0
- Node Version: 8.16.1
- npm Version: 6.4.1
What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint
What did you expect to happen?
Detect invalid this in functions with names with leading uppercase
What actually happened? Please include the actual, raw output from ESLint.
The rule no-invalid-this counts functions with leading uppercase in name as constructor.
There is no option to turn this heuristic of.
Reason
When writing React Components as a pure function one likes to keep the leading uppercase in the name. This will lead no-invalid-this to ignore uses of this in the pure function, which is a common error when refactoring call components to pure functions.
This is a request to add a switch to turn off the (documented) heuristic decision, that function is a constructor if
- the name of the function starts with uppercase, or
- the function is assigned to a variable which starts with an uppercase letter.