💼 This rule is enabled in the following configs: ✅ recommended
, recommended-react
, recommended-typescript
.
🔧 This rule is automatically fixable by the --fix
CLI option.
This rule requires all top-level functions to be named/regular functions, preventing the use of arrow functions at the top level. This rule aims to improve code readability and maintainability by enforcing consistent function declaration styles.
This rule checks for arrow functions at the top level and reports them as errors.
Examples of incorrect code for this rule:
const myFunction = () => {
// Function body
};
Examples of correct code for this rule:
function myFunction() {
// Function body
}
{
"rules": {
"th-rules/top-level-functions": "error"
}
}
This rule has no options.
If you do not want to enforce consistent function declaration styles, you can disable this rule.