Skip to content

Commit a3a0cf6

Browse files
cjihrigrvagg
authored andcommitted
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 ecc7976 commit a3a0cf6

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
@@ -90,6 +90,12 @@ rules:
9090
# list: http://eslint.org/docs/rules/#ecmascript-6
9191
## Suggest using 'const' wherever possible
9292
prefer-const: 2
93+
## Enforce parens around arrow function arguments
94+
arrow-parens: [2, "always"]
95+
## Require a space on each side of arrow operator
96+
arrow-spacing: [2, {"before": true, "after": true}]
97+
## Prevent using => in a condition where <= is intended
98+
no-arrow-condition: 2
9399

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

0 commit comments

Comments
 (0)