tools: enable prefer-const eslint rule
authorSakthipriyan Vairamani <thechargingvolcano@gmail.com>
Thu, 8 Oct 2015 17:40:10 +0000 (23:10 +0530)
committerMyles Borins <mborins@us.ibm.com>
Tue, 19 Jan 2016 19:52:11 +0000 (11:52 -0800)
Description from: http://eslint.org/docs/rules/prefer-const.html

If a variable is never modified, using the `const` declaration is
better. `const` declaration tells readers, "this variable is never
modified," reducing cognitive load and improving maintainability.

Refer: https://github.com/nodejs/node/issues/3118
PR-URL: https://github.com/nodejs/node/pull/3152
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
.eslintrc

index cf1f768..1d14b72 100644 (file)
--- a/.eslintrc
+++ b/.eslintrc
@@ -70,6 +70,11 @@ rules:
   # require space after keywords, eg 'for (..)'
   space-after-keywords: 2
 
+  # ECMAScript 6
+  # list: http://eslint.org/docs/rules/#ecmascript-6
+  ## Suggest using 'const' wherever possible
+  prefer-const: 2
+
   # Strict Mode
   # list: https://github.com/eslint/eslint/tree/master/docs/rules#strict-mode
   ## 'use strict' on top