Skip to content

Commit

Permalink
[guide] Add eslint rules to function declaration and function constru…
Browse files Browse the repository at this point in the history
…ctor topics
  • Loading branch information
felipethome committed Aug 3, 2016
1 parent f94f6e2 commit f0b3196
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ Other Style Guides
## Functions
<a name="functions--declarations"></a><a name="7.1"></a>
- [7.1](#functions--declarations) Use function declarations instead of function expressions. jscs: [`requireFunctionDeclarations`](http://jscs.info/rule/requireFunctionDeclarations)
- [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)
> 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.
Expand Down Expand Up @@ -730,7 +730,7 @@ Other Style Guides
```
<a name="functions--constructor"></a><a name="7.10"></a>
- [7.10](#functions--constructor) Never use the Function constructor to create a new function.
- [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)
> Why? Creating a function in this way evaluates a string similarly to eval(), which opens vulnerabilities.
Expand Down

0 comments on commit f0b3196

Please sign in to comment.