From 14787e495c4e482d4479bd2c4c8739fe9d5a2863 Mon Sep 17 00:00:00 2001 From: Anton Date: Sat, 4 May 2024 22:53:34 +0200 Subject: [PATCH] Revert "Enforce and fix typescript lints" This reverts commit 5630b85918182cb7e5aa7186aba44c26f3a18426. --- .eslintignore | 12 ++++++++++++ apps/ctrlpad/main.js | 5 ++--- apps/ctrlpad/main.ts | 5 ++--- apps/drained/app.js | 5 ++--- apps/drained/app.ts | 6 +++--- apps/drained/boot.js | 2 +- apps/drained/boot.ts | 2 +- apps/lint_exemptions.js | 12 ++++++++++++ 8 files changed, 35 insertions(+), 14 deletions(-) diff --git a/.eslintignore b/.eslintignore index 1e3abd9ff..933dfaf69 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,3 +4,15 @@ apps/gipy/pkg/gps.js # Needs to be ignored because it includes broken JS apps/health/chart.min.js + +# TypeScript +apps/btadv/ +apps/clkinfostopw/ +apps/ctrlpad/ +apps/drained/ +apps/folderlaunch/ +apps/popconlaunch/ +apps/rep/ +apps/widChargingStatus/ +apps/widbtstates/ +apps/widhid/ diff --git a/apps/ctrlpad/main.js b/apps/ctrlpad/main.js index 41e62a2d7..f9614168e 100644 --- a/apps/ctrlpad/main.js +++ b/apps/ctrlpad/main.js @@ -126,9 +126,8 @@ { text: "DnD", cb: function (tap) { - var on = false; - if (origBuzz) { - on = true; + var on; + if (on = !!origBuzz) { if (tap) { Bangle.buzz = origBuzz; origBuzz = undefined; diff --git a/apps/ctrlpad/main.ts b/apps/ctrlpad/main.ts index 7d99b88f6..7f758a3b0 100644 --- a/apps/ctrlpad/main.ts +++ b/apps/ctrlpad/main.ts @@ -193,9 +193,8 @@ { text: "DnD", cb: tap => { - let on = false; - if(origBuzz){ - on = true; + let on; + if(on = !!origBuzz){ if(tap){ Bangle.buzz = origBuzz; origBuzz = undefined; diff --git a/apps/drained/app.js b/apps/drained/app.js index 11f14713a..c74affea3 100644 --- a/apps/drained/app.js +++ b/apps/drained/app.js @@ -1,7 +1,6 @@ var app = "drained"; -var globals = global; -if (typeof globals.drainedInterval !== "undefined") - globals.drainedInterval = clearInterval(globals.drainedInterval); +if (typeof drainedInterval !== "undefined") + drainedInterval = clearInterval(drainedInterval); Bangle.setLCDBrightness(0); var powerNoop = function () { return false; }; var forceOff = function (name) { diff --git a/apps/drained/app.ts b/apps/drained/app.ts index 9918361e8..499609f5f 100644 --- a/apps/drained/app.ts +++ b/apps/drained/app.ts @@ -1,9 +1,9 @@ const app = "drained"; // from boot.js -const globals: { drainedInterval: IntervalId | undefined } = global as any; -if(typeof globals.drainedInterval !== "undefined") - globals.drainedInterval = clearInterval(globals.drainedInterval) as undefined; +declare var drainedInterval: IntervalId | undefined; +if(typeof drainedInterval !== "undefined") + drainedInterval = clearInterval(drainedInterval) as undefined; // backlight Bangle.setLCDBrightness(0); diff --git a/apps/drained/boot.js b/apps/drained/boot.js index 3ce74527c..48c1572bd 100644 --- a/apps/drained/boot.js +++ b/apps/drained/boot.js @@ -1,6 +1,6 @@ (function () { var _a = require("Storage").readJSON("drained.setting.json", true) || {}, _b = _a.battery, threshold = _b === void 0 ? 5 : _b, _c = _a.interval, interval = _c === void 0 ? 10 : _c, _d = _a.keepStartup, keepStartup = _d === void 0 ? true : _d; - global.drainedInterval = setInterval(function () { + drainedInterval = setInterval(function () { if (Bangle.isCharging()) return; if (E.getBattery() > threshold) diff --git a/apps/drained/boot.ts b/apps/drained/boot.ts index 2f5b9322e..1fcb0591b 100644 --- a/apps/drained/boot.ts +++ b/apps/drained/boot.ts @@ -2,7 +2,7 @@ const { battery: threshold = 5, interval = 10, keepStartup = true }: DrainedSettings = require("Storage").readJSON(`drained.setting.json`, true) || {}; -(global as any).drainedInterval = setInterval(() => { +drainedInterval = setInterval(() => { if(Bangle.isCharging()) return; if(E.getBattery() > threshold) diff --git a/apps/lint_exemptions.js b/apps/lint_exemptions.js index 18a2919e8..5821db4c4 100644 --- a/apps/lint_exemptions.js +++ b/apps/lint_exemptions.js @@ -1137,6 +1137,18 @@ module.exports = { "no-undef" ] }, + "drained/boot.js": { + "hash": "914ea2c47aa6b9502b9dd354d490b2a8b838d4c6fafaa20e206f1f2396d4db40", + "rules": [ + "no-undef" + ] + }, + "drained/app.js": { + "hash": "2b609ca5bf414b0e400e25512bf396a01f8cb0365b4edd02ea1697b51907d36c", + "rules": [ + "no-undef" + ] + }, "dinoClock/app.js": { "hash": "e97566aa4f586ef654e3fc1ec286376352762ed8e0ea2e685a7b3ae687f51552", "rules": [