Skip to content
Open
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
12 changes: 6 additions & 6 deletions defaultmodules/alert/notificationFx.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ export class NotificationFx {

// dismiss after [options.ttl]ms
if (this.options.ttl) {
this.dismissttl = setTimeout(() => {
const dismissOnTimeout = () => {
if (this.active) {
this.dismiss();
}
},
this.options.ttl);
};
this.dismissttl = setTimeout(dismissOnTimeout, this.options.ttl);
}

// init events
Expand Down Expand Up @@ -142,15 +142,15 @@ export class NotificationFx {
this.active = false;
clearTimeout(this.dismissttl);
this.ntf.classList.remove("ns-show");
setTimeout(() => {
const finishDismissal = () => {
this.ntf.classList.add("ns-hide");

// Callback
if (close) {
this.options.onClose();
}
},
25);
};
setTimeout(finishDismissal, 25);

// after animation ends remove ntf from the DOM
const onEndAnimationFn = (ev) => {
Expand Down
19 changes: 10 additions & 9 deletions defaultmodules/compliments/compliments.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ Module.register("compliments", {
this.updateDom();
if (this.config.remoteFileRefreshInterval !== 0) {
if ((this.config.remoteFileRefreshInterval >= this.refreshMinimumDelay) || window.mmTestMode === "true") {
setInterval(async () => {
const refreshRemoteCompliments = async () => {
const response = await this.loadComplimentFile();
if (response) {
this.compliments_new = JSON.parse(response);
}
else {
Log.error(`[compliments] ${this.name} remoteFile refresh failed`);
}
},
this.config.remoteFileRefreshInterval);
};
setInterval(refreshRemoteCompliments, this.config.remoteFileRefreshInterval);
} else {
Log.error(`[compliments] ${this.name} remoteFileRefreshInterval less than minimum`);
}
Expand All @@ -72,12 +72,13 @@ Module.register("compliments", {
}
}
// Schedule update timer. sync to the minute start (if needed), so minute based events happen on the minute start
setTimeout(() => {
setInterval(() => {
this.updateDom(this.config.fadeSpeed);
}, this.config.updateInterval);
},
minute_sync_delay);
const updateCompliments = () => {
this.updateDom(this.config.fadeSpeed);
};
const startUpdateInterval = () => {
setInterval(updateCompliments, this.config.updateInterval);
};
setTimeout(startUpdateInterval, minute_sync_delay);
},

// check to see if this entry could be a cron entry which contains spaces
Expand Down
67 changes: 18 additions & 49 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
import {defineConfig, globalIgnores} from "eslint/config";
import { defineConfig, globalIgnores } from "eslint/config";
import css from "@eslint/css";
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 {configs as jsdocConfigs} from "eslint-plugin-jsdoc";
import { configs as jsdocConfigs } from "eslint-plugin-jsdoc";
import markdown from "@eslint/markdown";
import {configs as packageJsonConfigs} 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";

export default defineConfig([
globalIgnores(["config/**", "modules/**/*", "js/positions.js", "tests/configs/config_variables.js", "tests/mocks/**/package.json", "defaultmodules/*/package.json"]),
globalIgnores(["config/**", "coverage/**", "modules/**/*", "js/positions.js", "tests/configs/config_variables.js", "tests/mocks/**/package.json", "defaultmodules/*/package.json"]),
{
files: ["**/*.css"],
language: "css/css",
plugins: {css},
plugins: { css },
extends: ["css/recommended"],
rules: {
"css/no-invalid-properties": ["error", {allowUnknownVariables: true}],
"css/no-invalid-properties": ["error", { allowUnknownVariables: true }],
"css/use-baseline": "off"
}
},
{
files: ["**/*.md"],
plugins: {markdown},
plugins: { markdown },
language: "markdown/gfm",
extends: ["markdown/recommended"],
rules: {
"markdown/no-missing-label-refs": "off"
}
},
{
files: ["**/*.js", "defaultmodules/defaultmodules.mjs", "defaultmodules/calendar/calendarutils.mjs", "js/app.mjs", "js/deprecated.mjs", "js/electron_helper.mjs", "js/http_fetcher.mjs", "js/ip_access_control.mjs", "js/releasenotes.mjs", "js/server.mjs", "js/server_functions.mjs", "js/vendor.mjs", "tests/**/*.mjs"],
files: ["**/*.{js,mjs}"],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we ok with this simplification? will stuff be included that we dont want in there?

languageOptions: {
ecmaVersion: "latest",
globals: {
Expand All @@ -46,22 +46,17 @@ export default defineConfig([
},
extends: [importX.recommended, js.configs.recommended, jsdocConfigs["flat/recommended"], stylistic.configs.all],
rules: {
"@stylistic/array-element-newline": ["error", "consistent"],
"@stylistic/arrow-parens": ["error", "always"],
"@stylistic/brace-style": "off",
"@stylistic/dot-location": ["error", "property"],
"@stylistic/function-call-argument-newline": ["error", "consistent"],
"@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/operator-linebreak": ["error", "before"],
"@stylistic/padded-blocks": "off",
"@stylistic/quote-props": ["error", "as-needed"],
Expand All @@ -70,7 +65,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" }],
"func-style": ["error", "expression"],
"import-x/newline-after-import": "error",
"import-x/order": "error",
Expand Down Expand Up @@ -100,48 +95,22 @@ export default defineConfig([
// Browser ESM entry files must always include the file extension in relative imports.
"import-x/extensions": ["error", "always"],
// These files are generated at server startup and don't exist in a fresh checkout.
"import-x/no-unresolved": ["error", {ignore: ["^\\./positions\\.js$", "^\\.\\./config/basepath\\.js$"]}]
"import-x/no-unresolved": ["error", { ignore: ["^\\./positions\\.js$", "^\\.\\./config/basepath\\.js$"] }]
}
},
{
files: ["**/*.js", "defaultmodules/defaultmodules.mjs", "defaultmodules/calendar/calendarutils.mjs", "js/app.mjs", "js/deprecated.mjs", "js/electron_helper.mjs", "js/http_fetcher.mjs", "js/ip_access_control.mjs", "js/releasenotes.mjs", "js/server.mjs", "js/server_functions.mjs", "js/vendor.mjs", "tests/**/*.mjs"],
files: ["**/*.{js,mjs}"],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

ignores: [
"clientonly/index.js",
"js/logger.js",
"tests/**/*.js",
"tests/**/*.mjs"
"tests/**/*.{js,mjs}"
],
rules: {"no-console": "error"}
rules: { "no-console": "error" }
},
{
files: ["**/package.json"],
extends: [packageJsonConfigs.recommended]
},
{
files: ["**/*.mjs"],
ignores: ["defaultmodules/defaultmodules.mjs", "defaultmodules/calendar/calendarutils.mjs", "js/app.mjs", "js/deprecated.mjs", "js/electron_helper.mjs", "js/http_fetcher.mjs", "js/ip_access_control.mjs", "js/releasenotes.mjs", "js/server.mjs", "js/server_functions.mjs", "js/vendor.mjs", "tests/**/*.mjs"],
languageOptions: {
ecmaVersion: "latest",
globals: {
...globals.browser,
...globals.node
},
sourceType: "module"
},
extends: [importX.recommended, js.configs.all, jsdocConfigs["flat/recommended"], stylistic.configs.all],
rules: {
"@stylistic/array-element-newline": "off",
"@stylistic/function-call-argument-newline": ["error", "consistent"],
"@stylistic/function-paren-newline": ["error", "consistent"],
"@stylistic/indent": ["error", "tab"],
"@stylistic/padded-blocks": "off",
"@stylistic/quote-props": ["error", "as-needed"],
"capitalized-comments": "off",
"no-magic-numbers": "off",
"one-var": "off",
"sort-keys": "off"
}
},
{
files: ["tests/**/*.{js,mjs}"],
languageOptions: {
Expand All @@ -166,7 +135,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 @@ -184,7 +153,7 @@ export default defineConfig([
files: ["tests/mocks/**/node_helper.js", "defaultmodules/*/node_helper.js", "defaultmodules/*/git_helper.js", "defaultmodules/newsfeed/feeditem.js", "defaultmodules/newsfeed/newsfeedfetcher.js", "defaultmodules/calendar/calendarfetcher.js", "defaultmodules/calendar/calendarfetcherutils.js", "defaultmodules/calendar/debug.js"],
rules: {
// MagicMirror aliases are resolved at runtime by js/alias-resolver.js.
"import-x/no-unresolved": ["error", {ignore: ["^node_helper$", "^logger$"]}]
"import-x/no-unresolved": ["error", { ignore: ["^node_helper$", "^logger$"] }]
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion js/module_helper_loader.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {pathToFileURL} from "node:url";
import { pathToFileURL } from "node:url";

/**
* Load and instantiate a CommonJS or ESM module helper.
Expand Down
13 changes: 5 additions & 8 deletions js/releasenotes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,10 @@ const createReleaseNotes = async () => {
}
}

// function to remove duplicates
const sortedArr = (arr) => {
return arr.filter((item,
index) => (arr.indexOf(item) === index && item !== "@dependabot[bot]")).sort((a, b) => {
return a.toLowerCase().localeCompare(b.toLowerCase());
});
};
// Remove duplicate contributors and the bot account, then sort them.
const sortedContributors = (contributors) => [...new Set(contributors)]
.filter((contributor) => contributor !== "@dependabot[bot]")
.sort((first, second) => first.toLowerCase().localeCompare(second.toLowerCase()));

// Get Contributors logins
for (const ref of sha) {
Expand All @@ -163,7 +160,7 @@ const createReleaseNotes = async () => {
// Build Markdown content
let markdown = "## Release Notes\n";

markdown += `Thanks to: ${sortedArr(contrib).join(", ")}\n`;
markdown += `Thanks to: ${sortedContributors(contrib).join(", ")}\n`;
markdown += `> ⚠️ This release needs nodejs version ${nodeVersion}\n`;
markdown += "\n";
markdown += `[Compare to previous Release ${lastTag}](https://github.com/${repoName}/compare/${lastTag}...develop)\n\n`;
Expand Down
Loading
Loading