Recommend [RequireComponent] when using GetComponent on self
Problem statement
Using GetComponent doesn't give any indication of what your script actually needs in the Unity Editor. That's one of the reasons I prefer serialized fields, but GetComponent still has its uses.
Proposed solution
If this.GetComponent is used anywhere in a MonoBehaviour script, offer a code "fix" to add a [RequireComponent] attribute to that class.
I wouldn't want a blue underline for it though since the script could simply null check the component and ignore it if not present. Maybe the analyser could detect that it isn't being null checked?
Very Interesting idea. It might be hard to prove that the component is actually required or not, but that's something we could offer as a suggestion which is not very intrusive.
Automatically adding "help wanted" tag for stale issues identified as good community contribution opportunities