Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions defaultmodules/clock/clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Module.register("clock", {
}

sunWrapperInnerHTML += `<span><i class="fas fa-arrow-up" aria-hidden="true"></i> ${formatTime(this.config, sunTimes.sunrise)}</span>`
+ `<span><i class="fas fa-arrow-down" aria-hidden="true"></i> ${formatTime(this.config, sunTimes.sunset)}</span>`;
+ `<span><i class="fas fa-arrow-down" aria-hidden="true"></i> ${formatTime(this.config, sunTimes.sunset)}</span>`;

sunWrapper.innerHTML = sunWrapperInnerHTML;
digitalWrapper.appendChild(sunWrapper);
Expand Down Expand Up @@ -218,8 +218,8 @@ Module.register("clock", {

moonWrapper.innerHTML
= `<span class="${isVisible ? "bright" : ""}">${image} ${showFraction ? illuminatedFractionString : ""}</span>`
+ `<span><i class="fas fa-arrow-up" aria-hidden="true"></i> ${moonRise ? formatTime(this.config, moonRise) : "..."}</span>`
+ `<span><i class="fas fa-arrow-down" aria-hidden="true"></i> ${moonSet ? formatTime(this.config, moonSet) : "..."}</span>`;
+ `<span><i class="fas fa-arrow-up" aria-hidden="true"></i> ${moonRise ? formatTime(this.config, moonRise) : "..."}</span>`
+ `<span><i class="fas fa-arrow-down" aria-hidden="true"></i> ${moonSet ? formatTime(this.config, moonSet) : "..."}</span>`;
digitalWrapper.appendChild(moonWrapper);
}

Expand Down
2 changes: 1 addition & 1 deletion defaultmodules/weather/provider-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function cardinalToDegrees (direction) {
*/
function validateCoordinates (config, maxDecimals = 4) {
if (config.lat == null || config.lon == null
|| !Number.isFinite(config.lat) || !Number.isFinite(config.lon)) {
|| !Number.isFinite(config.lat) || !Number.isFinite(config.lon)) {
throw new Error("Latitude and longitude are required");
}

Expand Down
10 changes: 5 additions & 5 deletions defaultmodules/weather/providers/smhi.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,13 @@ class SMHIProvider {
#isSamePeriod (date1, date2, groupBy) {
if (groupBy === "hour") {
return date1.getFullYear() === date2.getFullYear()
&& date1.getMonth() === date2.getMonth()
&& date1.getDate() === date2.getDate()
&& date1.getHours() === date2.getHours();
&& date1.getMonth() === date2.getMonth()
&& date1.getDate() === date2.getDate()
&& date1.getHours() === date2.getHours();
} else { // day
return date1.getFullYear() === date2.getFullYear()
&& date1.getMonth() === date2.getMonth()
&& date1.getDate() === date2.getDate();
&& date1.getMonth() === date2.getMonth()
&& date1.getDate() === date2.getDate();
}
}

Expand Down
2 changes: 1 addition & 1 deletion defaultmodules/weather/providers/weatherapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class WeatherAPIProvider {
return null;
}

const match = /^\s*(\d{1,2}):(\d{2})\s*(AM|PM)\s*$/i.exec(timeValue);
const match = (/^\s*(\d{1,2}):(\d{2})\s*(AM|PM)\s*$/i).exec(timeValue);
if (!match) {
return null;
}
Expand Down
5 changes: 3 additions & 2 deletions defaultmodules/weather/providers/weatherflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const HTTPFetcher = require("#http_fetcher");
* Note that the WeatherFlow API does not provide snowfall.
*/
class WeatherFlowProvider {

/**
* @param {object} config - Provider configuration
*/
Expand Down Expand Up @@ -190,8 +191,8 @@ class WeatherFlowProvider {

// Compare year, month, and day to ensure correct matching across month boundaries
if (hourDate.getFullYear() === forecastDate.getFullYear()
&& hourDate.getMonth() === forecastDate.getMonth()
&& hourDate.getDate() === forecastDate.getDate()) {
&& hourDate.getMonth() === forecastDate.getMonth()
&& hourDate.getDate() === forecastDate.getDate()) {
weather.uvIndex = Math.max(weather.uvIndex, hour.uv || 0);
weather.precipitationAmount += hour.precip || 0;
} else if (hourDate > forecastDate) {
Expand Down
12 changes: 7 additions & 5 deletions defaultmodules/weather/providers/yr.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ class YrProvider {
const data = await response.json();
// Transform single-day response into array format expected by #getStellarInfoForDate
if (data && data.properties) {
this.stellarData = [{
date: data.when.interval[0], // ISO date string
sunrise: data.properties.sunrise,
sunset: data.properties.sunset
}];
this.stellarData = [
{
date: data.when.interval[0], // ISO date string
sunrise: data.properties.sunrise,
sunset: data.properties.sunset
}
];
}
this.stellarDataDate = today;
}
Expand Down
39 changes: 21 additions & 18 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { defineConfig, globalIgnores } from "eslint/config";
import {defineConfig, globalIgnores} from "eslint/config";
import globals from "globals";
import { flatConfigs as importX } from "eslint-plugin-import-x";
import {flatConfigs as importX} from "eslint-plugin-import-x";
import js from "@eslint/js";
import jsdocPlugin from "eslint-plugin-jsdoc";
import packageJson from "eslint-plugin-package-json";
import {configs as packageJsonConfigs} from "eslint-plugin-package-json";
import playwright from "eslint-plugin-playwright";
import stylistic from "@stylistic/eslint-plugin";
import vitest from "@vitest/eslint-plugin";
Expand All @@ -24,8 +24,7 @@ export default defineConfig([
moment: "readonly"
}
},
plugins: { js, stylistic },
extends: [importX.recommended, "js/recommended", jsdocPlugin.configs["flat/recommended"], stylistic.configs.customize({ indent: "tab", quotes: "double", semi: true, commaDangle: "never" })],
extends: [importX.recommended, js.configs.recommended, jsdocPlugin.configs["flat/recommended"], stylistic.configs.all],
rules: {
"@stylistic/array-element-newline": ["error", "consistent"],
"@stylistic/arrow-parens": ["error", "always"],
Expand All @@ -35,14 +34,14 @@ export default defineConfig([
"@stylistic/function-paren-newline": ["error", "consistent"],
"@stylistic/implicit-arrow-linebreak": ["error", "beside"],
"@stylistic/indent": ["error", "tab"],
"@stylistic/max-statements-per-line": ["error", { max: 2 }],
"@stylistic/max-statements-per-line": ["error", {max: 2}],
"@stylistic/multiline-comment-style": "off",
"@stylistic/multiline-ternary": ["error", "always-multiline"],
"@stylistic/newline-per-chained-call": ["error", { ignoreChainWithDepth: 4 }],
"@stylistic/newline-per-chained-call": ["error", {ignoreChainWithDepth: 4}],
"@stylistic/no-extra-parens": "off",
"@stylistic/no-tabs": "off",
"@stylistic/object-curly-spacing": ["error", "always"],
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
"@stylistic/object-property-newline": ["error", {allowAllPropertiesOnSameLine: true}],
"@stylistic/operator-linebreak": ["error", "before"],
"@stylistic/padded-blocks": "off",
"@stylistic/quote-props": ["error", "as-needed"],
Expand All @@ -51,7 +50,7 @@ export default defineConfig([
"@stylistic/space-before-function-paren": ["error", "always"],
"@stylistic/spaced-comment": "off",
"dot-notation": "error",
eqeqeq: ["error", "always", { null: "ignore" }],
eqeqeq: ["error", "always", {null: "ignore"}],
"id-length": "off",
"import-x/extensions": "error",
"import-x/newline-after-import": "error",
Expand Down Expand Up @@ -86,12 +85,11 @@ export default defineConfig([
"js/logger.js",
"tests/**/*.js"
],
rules: { "no-console": "error" }
rules: {"no-console": "error"}
},
{
files: ["**/package.json"],
plugins: { packageJson },
extends: ["packageJson/recommended"]
extends: [packageJsonConfigs.recommended]
},
{
files: ["**/*.mjs"],
Expand All @@ -102,15 +100,14 @@ export default defineConfig([
},
sourceType: "module"
},
plugins: { js, stylistic },
extends: [importX.recommended, "js/all", stylistic.configs.customize({ indent: "tab", quotes: "double", semi: true, commaDangle: "never" })],
extends: [importX.recommended, js.configs.all, stylistic.configs.all],
rules: {
"@stylistic/array-element-newline": "off",
"@stylistic/indent": ["error", "tab"],
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
"@stylistic/object-property-newline": ["error", {allowAllPropertiesOnSameLine: true}],
"@stylistic/padded-blocks": ["error", "never"],
"@stylistic/quote-props": ["error", "as-needed"],
"import-x/no-unresolved": ["error", { ignore: ["eslint/config"] }],
"import-x/no-unresolved": ["error", {ignore: ["eslint/config"]}],
"max-lines-per-function": ["error", 100],
"no-magic-numbers": "off",
"one-var": ["error", "never"],
Expand All @@ -124,7 +121,6 @@ export default defineConfig([
...vitest.environments.env.globals
}
},
plugins: { vitest },
extends: [vitest.configs.recommended],
rules: {
"vitest/consistent-test-it": "error",
Expand All @@ -142,7 +138,7 @@ export default defineConfig([
]
}
],
"vitest/max-nested-describe": ["error", { max: 3 }],
"vitest/max-nested-describe": ["error", {max: 3}],
"vitest/prefer-to-be": "error",
"vitest/prefer-to-have-length": "error",
"max-lines-per-function": "off"
Expand All @@ -167,6 +163,13 @@ export default defineConfig([
files: ["tests/e2e/**/*.js"],
extends: [playwright.configs["flat/recommended"]],
rules: {

/*
* Tests use Vitest-style plain beforeAll()/afterAll() calls, not Playwright's
* test.beforeAll() style. The rule incorrectly treats all plain hook calls
* as the same unnamed type, flagging the second hook as a duplicate.
*/
"playwright/no-duplicate-hooks": "off",
"playwright/no-standalone-expect": "off"
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/alias-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// For a future ESM migration, replace this with a public export/import surface.

const path = require("node:path");
const Module = require("module");
const Module = require("node:module");

const root = path.join(__dirname, "..");

Expand Down
Loading