Skip to content

Commit 25c8573

Browse files
refactor: enable ESLint rule require-await and handle detected issues
Remove unnecessary async keywords from functions that don't use await.
1 parent 8ce0cda commit 25c8573

22 files changed

+36
-35
lines changed

defaultmodules/weather/providers/envcanada.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class EnvCanadaProvider {
3131
this.currentHour = null; // Track current hour for URL updates
3232
}
3333

34-
async initialize () {
34+
initialize () {
3535
this.#validateConfig();
3636
this.#initializeFetcher();
3737
}

defaultmodules/weather/providers/openweathermap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class OpenWeatherMapProvider {
2828
this.locationName = null;
2929
}
3030

31-
async initialize () {
31+
initialize () {
3232
// Validate callbacks exist
3333
if (typeof this.onErrorCallback !== "function") {
3434
throw new Error("setCallbacks() must be called before initialize()");

defaultmodules/weather/providers/pirateweather.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PirateweatherProvider {
2424
this.onErrorCallback = onErrorCallback;
2525
}
2626

27-
async initialize () {
27+
initialize () {
2828
if (!this.config.apiKey) {
2929
Log.error("[pirateweather] No API key configured");
3030
if (this.onErrorCallback) {

defaultmodules/weather/providers/smhi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SMHIProvider {
2929
this.onErrorCallback = null;
3030
}
3131

32-
async initialize () {
32+
initialize () {
3333
try {
3434
// SMHI requires max 6 decimal places
3535
validateCoordinates(this.config, 6);

defaultmodules/weather/providers/ukmetofficedatahub.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class UkMetOfficeDataHubProvider {
3535
this.onErrorCallback = onErrorCallback;
3636
}
3737

38-
async initialize () {
38+
initialize () {
3939
if (!this.config.apiKey || this.config.apiKey === "YOUR_API_KEY_HERE") {
4040
Log.error("[ukmetofficedatahub] No API key configured");
4141
if (this.onErrorCallback) {

defaultmodules/weather/providers/weatherapi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class WeatherAPIProvider {
2525
this.onErrorCallback = null;
2626
}
2727

28-
async initialize () {
28+
initialize () {
2929
this.#validateConfig();
3030
this.#initializeFetcher();
3131
}

defaultmodules/weather/providers/weatherbit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class WeatherbitProvider {
2727
this.onErrorCallback = onErrorCallback;
2828
}
2929

30-
async initialize () {
30+
initialize () {
3131
if (!this.config.apiKey || this.config.apiKey === "YOUR_API_KEY_HERE") {
3232
Log.error("[weatherbit] No API key configured");
3333
if (this.onErrorCallback) {

defaultmodules/weather/providers/weatherflow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class WeatherFlowProvider {
3131
/**
3232
* Initialize the provider
3333
*/
34-
async initialize () {
34+
initialize () {
3535
if (!this.config.token || this.config.token === "YOUR_API_TOKEN_HERE") {
3636
Log.error("[weatherflow] No API token configured. Get one at https://tempestwx.com/");
3737
if (this.onErrorCallback) {

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export default defineConfig([
7575
"object-shorthand": ["error", "methods"],
7676
"one-var": "off",
7777
"prefer-template": "error",
78+
"require-await": "error",
7879
"sort-keys": "off"
7980
}
8081
},

js/loader.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ const Loader = (function () {
193193
* @param {string} fileName Path of the file we want to load.
194194
* @returns {Promise} resolved when the file is loaded
195195
*/
196-
const loadFile = async function (fileName) {
196+
const loadFile = function (fileName) {
197197
const extension = fileName.slice((Math.max(0, fileName.lastIndexOf(".")) || Infinity) + 1);
198198
let script, stylesheet;
199199

@@ -267,10 +267,10 @@ const Loader = (function () {
267267
* @param {Module} module The module that calls the loadFile function.
268268
* @returns {Promise} resolved when the file is loaded
269269
*/
270-
async loadFileForModule (fileName, module) {
270+
loadFileForModule (fileName, module) {
271271
if (loadedFiles.indexOf(fileName.toLowerCase()) !== -1) {
272272
Log.log(`File already loaded: ${fileName}`);
273-
return;
273+
return Promise.resolve();
274274
}
275275

276276
if (fileName.indexOf("http://") === 0 || fileName.indexOf("https://") === 0 || fileName.indexOf("/") !== -1) {

0 commit comments

Comments
 (0)