jsx-eslint/eslint-plugin-react

function-component-definition should ignore function with `this`

Open

#2,781 opened on Sep 1, 2020

 (2 comments) (0 reactions) (0 assignees)JavaScript (2,731 forks)batch import
bughelp wanted

Repository metrics

Stars
 (9,293 stars)
PR merge metrics
 (PR metrics pending)

Description

This is a polyfill for IE:

		Element.prototype.closest = function (s) {
			let el = this
			if (!document.documentElement.contains(el)) return null
			do {
				if (el.matches(s)) return el
				el = el.parentElement || el.parentNode
			} while (el !== null && el.nodeType === 1)
			return null
		}

it needs access to this and function-component-definition complains about it.

Contributor guide