From da689343fcac8efb60cbb2691f8c47d9478c43b2 Mon Sep 17 00:00:00 2001 From: Paras Sanghavi Date: Tue, 16 Mar 2021 01:50:17 -0700 Subject: [PATCH] chore: Add no-var eslint rule to enforce code style (#35) Fix errors in OrbitControls file --- .eslintrc.json | 1 + src/controls/OrbitControls.ts | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 0016a02d..887350b0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -37,6 +37,7 @@ "import/default": "off", "@typescript-eslint/explicit-module-boundary-types": "off", "no-unused-vars": ["warn"], + "no-var": "error", "react/jsx-uses-react": "error", "react/jsx-uses-vars": "error", "@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }], diff --git a/src/controls/OrbitControls.ts b/src/controls/OrbitControls.ts index c8006e3b..b1ee5eab 100644 --- a/src/controls/OrbitControls.ts +++ b/src/controls/OrbitControls.ts @@ -282,13 +282,13 @@ class OrbitControls extends EventDispatcher { // internals // - var scope = this + const scope = this - var changeEvent = { type: 'change' } + const changeEvent = { type: 'change' } const startEvent = { type: 'start' } const endEvent = { type: 'end' } - var STATE = { + const STATE = { NONE: -1, ROTATE: 0, DOLLY: 1, @@ -299,17 +299,17 @@ class OrbitControls extends EventDispatcher { TOUCH_DOLLY_ROTATE: 6, } - var state = STATE.NONE + let state = STATE.NONE - var EPS = 0.000001 + const EPS = 0.000001 // current position in spherical coordinates - var spherical = new Spherical() - var sphericalDelta = new Spherical() + const spherical = new Spherical() + const sphericalDelta = new Spherical() - var scale = 1 - var panOffset = new Vector3() - var zoomChanged = false + let scale = 1 + const panOffset = new Vector3() + let zoomChanged = false const rotateStart = new Vector2() const rotateEnd = new Vector2()