google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.25k stars 292 forks source link

Add an eslint rule to disallow arrow functions for everything except callbacks #7146

Open eugene-manuilov opened 1 year ago

eugene-manuilov commented 1 year ago

Feature Description

Currently, in the codebase we have a mix of styles when we define functions. Some use arrow functions for everything (regular functions, components, hooks, etc), others use the standard function keyword approach. While this is technically not a problem, using arrow functions in the cases when it is not really needed makes the codebase look inconsistent and some times harder to read (especially when we have tons of arguments destructed in the function signature). We need to add an eslint rule that will disallow arrow functions for top level functions and update the codebase accordingly.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation Brief

Test Coverage

QA Brief

Changelog entry

aaemnnosttv commented 1 year ago

This is related to https://github.com/google/site-kit-wp/issues/3513 although that issue is more specific to components.