Skip to content

Commit f0b3196

Browse files
committed
[guide] Add eslint rules to function declaration and function constructor topics
1 parent f94f6e2 commit f0b3196

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ Other Style Guides
588588
## Functions
589589
590590
<a name="functions--declarations"></a><a name="7.1"></a>
591-
- [7.1](#functions--declarations) Use function declarations instead of function expressions. jscs: [`requireFunctionDeclarations`](http://jscs.info/rule/requireFunctionDeclarations)
591+
- [7.1](#functions--declarations) Use function declarations instead of function expressions. eslint: [`func-style`](http://eslint.org/docs/rules/func-style) jscs: [`requireFunctionDeclarations`](http://jscs.info/rule/requireFunctionDeclarations)
592592
593593
> Why? Function declarations are named, so they're easier to identify in call stacks. Also, the whole body of a function declaration is hoisted, whereas only the reference of a function expression is hoisted. This rule makes it possible to always use [Arrow Functions](#arrow-functions) in place of function expressions.
594594
@@ -730,7 +730,7 @@ Other Style Guides
730730
```
731731
732732
<a name="functions--constructor"></a><a name="7.10"></a>
733-
- [7.10](#functions--constructor) Never use the Function constructor to create a new function.
733+
- [7.10](#functions--constructor) Never use the Function constructor to create a new function. eslint: [`no-new-func`](http://eslint.org/docs/rules/no-new-func)
734734
735735
> Why? Creating a function in this way evaluates a string similarly to eval(), which opens vulnerabilities.
736736

0 commit comments

Comments
 (0)