Skip to content

Commit 452928e

Browse files
committed
tools: add arrow function rules to eslint
This commit enables the following rules: * arrow-parens - requires parens around arrow function arguments * arrow-spacing - ensures a space on each side of the => * no-arrow-condition - prevents accidental use of => in cases where the user really intends to use <= PR-URL: #4813 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
1 parent 3218dfb commit 452928e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

.eslintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ rules:
8686
# list: http://eslint.org/docs/rules/#ecmascript-6
8787
## Suggest using 'const' wherever possible
8888
prefer-const: 2
89+
## Enforce parens around arrow function arguments
90+
arrow-parens: [2, "always"]
91+
## Require a space on each side of arrow operator
92+
arrow-spacing: [2, {"before": true, "after": true}]
93+
## Prevent using => in a condition where <= is intended
94+
no-arrow-condition: 2
8995

9096
# Strict Mode
9197
# list: https://github.com/eslint/eslint/tree/master/docs/rules#strict-mode

0 commit comments

Comments
 (0)