[gjs: 35/43] CI: Add space-in-parens and space-unary-ops to eslint rules



commit a7e935582e6fd0687f705403b7d070707b7e61e5
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Aug 4 11:25:29 2019 -0700

    CI: Add space-in-parens and space-unary-ops to eslint rules
    
    We already followed these rules except in some of the tweener code.

 .eslintrc.yml                | 2 ++
 modules/tweener/equations.js | 8 ++++----
 modules/tweener/tweener.js   | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/.eslintrc.yml b/.eslintrc.yml
index 8a248248..e81e7014 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -135,9 +135,11 @@ rules:
       # for `function ()` and `async () =>`, preserve space around keywords
       anonymous: always
       asyncArrow: always
+  space-in-parens: error
   space-infix-ops:
     - error
     - int32Hint: false
+  space-unary-ops: error
 globals:
   ARGV: readonly
   Debugger: readonly
diff --git a/modules/tweener/equations.js b/modules/tweener/equations.js
index dc009863..fdcbc745 100644
--- a/modules/tweener/equations.js
+++ b/modules/tweener/equations.js
@@ -479,7 +479,7 @@ function easeInElastic(t, b, c, d, pParams) {
     } else {
         s = p / (2 * Math.PI) * Math.asin(c / a);
     }
-    return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin( (t * d - s) * (2 * Math.PI) / p )) + b;
+    return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
 }
 
 /**
@@ -507,7 +507,7 @@ function easeOutElastic(t, b, c, d, pParams) {
     } else {
         s = p / (2 * Math.PI) * Math.asin(c / a);
     }
-    return a * Math.pow(2, -10 * t) * Math.sin( (t * d - s) * (2 * Math.PI) / p ) + c + b;
+    return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
 }
 
 /**
@@ -536,8 +536,8 @@ function easeInOutElastic(t, b, c, d, pParams) {
         s = p / (2 * Math.PI) * Math.asin(c / a);
     }
     if (t < 1)
-        return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin( (t * d - s) * (2 * Math.PI) / p )) + b;
-    return a * Math.pow(2, -10 * (t -= 1)) * Math.sin( (t * d - s) * (2 * Math.PI) / p ) * .5 + c + b;
+        return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
+    return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
 }
 
 /**
diff --git a/modules/tweener/tweener.js b/modules/tweener/tweener.js
index 1ce79207..540d4853 100644
--- a/modules/tweener/tweener.js
+++ b/modules/tweener/tweener.js
@@ -623,7 +623,7 @@ function _getNumberOfProperties(object) {
     // the following line is disabled becasue eslint was picking up the following error: the variable name 
is defined but never used, however since it is required to search the object it is used and we'll allow the 
line to be ignored to get rid of the error message
     /* eslint-disable-next-line */
     for (let name in object) {
-        totalProperties ++;
+        totalProperties++;
     }
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]