guardian / guardian/dotcom-rendering

Consider linting against callback references

Open
#11,518 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
274
Forks
34
Avg merge
2d 22h
Merged PRs (30d)
121

Description

Passing callback as reference to methods like `Array#map` or `Array.filter` [can be dangerous when the reference function changes its signature in an type-compatible way](https://jakearchibald.com/2021/function-callback-risks/). There [exists an ESLint rule that can ensure we avoid this pattern](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-callback-reference.md) in our code.

[As discussed with](https://github.com/guardian/dotcom-rendering/pull/11515/files#r1624452209) @tjmw

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.