sindresorhus/eslint-plugin-unicorn

Feature Request: expose `ignoredCallee` to `no-array-callback-reference` rule

Chiusa

#972 aperta il 30 dic 2020

 (10 commenti) (1 reazione) (0 assegnatari)JavaScript (468 fork)user submission
enhancementhelp wanted

Metriche repository

Star
 (5022 stelle)
Metriche merge PR
 (Merge medio 4h 30m) (26 PR mergiate in 30 g)

Descrizione

This rule is awesome, but with some older code in AngularJS, we find ourselves having to inline disable unicorn/no-array-callback-reference regularly where our code uses things like Angular.forEach. There are of course much more modern alternatives to this nowadays, but configuration is always helpful.

Rather than maintain this list privately, I think it would make sense to expose in the rule configuration so users can configure it for their own needs. Something like:

"unicorn/no-array-callback-reference": ["error", {
	"ignoredCallee": [
		"Promise",
		"React.children",
		"Children",
		"lodash",
		"underscore",
		"_",
		"Async",
		"async",
		"Angular"
	]
}]

Guida contributor