[gjs: 8/43] CI: Add block-scoped-var to eslint rules
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 8/43] CI: Add block-scoped-var to eslint rules
- Date: Wed, 14 Aug 2019 17:27:44 +0000 (UTC)
commit 17169cfd656fad88764c947ad7059a501c89d6b4
Author: Philip Chimento <philip chimento gmail com>
Date: Sat Aug 3 17:32:36 2019 -0700
CI: Add block-scoped-var to eslint rules
This warns when you define a variable with 'var' inside a block (which
is hoisted to the outside of the block) and then use it outside the
block. This is the correct behaviour of 'var' but may not be what is
intended.
We ignore this rule in tweener.js because it's unmaintained legacy
code and don't want to risk any breaking changes to it.
.eslintrc.yml | 1 +
modules/_bootstrap/debugger.js | 3 ++-
modules/tweener/tweener.js | 2 ++
3 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/.eslintrc.yml b/.eslintrc.yml
index 2d0d4907..cf55198e 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -13,6 +13,7 @@ rules:
- error
- as-needed
arrow-spacing: error
+ block-scoped-var: error
brace-style: error
comma-spacing:
- error
diff --git a/modules/_bootstrap/debugger.js b/modules/_bootstrap/debugger.js
index f59710fd..fa1cf6c1 100644
--- a/modules/_bootstrap/debugger.js
+++ b/modules/_bootstrap/debugger.js
@@ -92,7 +92,8 @@ Object.defineProperty(Debugger.Frame.prototype, 'num', {
enumerable: false,
get: function() {
let i = 0;
- for (var f = topFrame; f && f !== this; f = f.older)
+ let f;
+ for (f = topFrame; f && f !== this; f = f.older)
i++;
return f === null ? undefined : i;
}
diff --git a/modules/tweener/tweener.js b/modules/tweener/tweener.js
index ba1e9c34..ea9014ac 100644
--- a/modules/tweener/tweener.js
+++ b/modules/tweener/tweener.js
@@ -1,4 +1,6 @@
/* -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil; -*- */
+/* eslint-disable block-scoped-var */
+
/* Copyright 2008 litl, LLC. */
/**
* Tweener
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]