mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-03 03:53:17 -04:00
[linter] Re-activate JSDoc linting and fix linting issues
This commit is contained in:
parent
a3d2064bb7
commit
fed4c86c7f
6 changed files with 25 additions and 19 deletions
|
@ -3,6 +3,7 @@ import globals from "globals";
|
|||
import {flatConfigs as importX} from "eslint-plugin-import-x";
|
||||
import jest from "eslint-plugin-jest";
|
||||
import js from "@eslint/js";
|
||||
import jsdoc from "eslint-plugin-jsdoc";
|
||||
import packageJson from "eslint-plugin-package-json";
|
||||
import stylistic from "@stylistic/eslint-plugin";
|
||||
|
||||
|
@ -22,8 +23,8 @@ export default defineConfig([
|
|||
moment: "readonly"
|
||||
}
|
||||
},
|
||||
plugins: {js, stylistic},
|
||||
extends: [importX.recommended, jest.configs["flat/recommended"], "js/recommended", "stylistic/all"],
|
||||
plugins: {js, jsdoc, stylistic},
|
||||
extends: [importX.recommended, jest.configs["flat/recommended"], "js/recommended", jsdoc.configs["flat/recommended"], "stylistic/all"],
|
||||
rules: {
|
||||
"@stylistic/array-element-newline": ["error", "consistent"],
|
||||
"@stylistic/arrow-parens": ["error", "always"],
|
||||
|
|
|
@ -72,6 +72,10 @@ function checkConfigFile () {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} configFileName - The path and filename of the configuration file to validate.
|
||||
*/
|
||||
function validateModulePositions (configFileName) {
|
||||
Log.info("Checking modules structure configuration ...");
|
||||
|
||||
|
|
|
@ -502,10 +502,10 @@ const CalendarFetcherUtils = {
|
|||
},
|
||||
|
||||
/**
|
||||
* fixup thew event fields that have dates to use local time
|
||||
* BEFORE calling rrule.between
|
||||
* @param the event being processed
|
||||
* @returns nothing
|
||||
* Fixes the event fields that have dates to use local time
|
||||
* before calling rrule.between.
|
||||
* @param {object} event - The event being processed.
|
||||
* @returns {void}
|
||||
*/
|
||||
fixEventtoLocal (event) {
|
||||
// if there are excluded dates, their date is incorrect and possibly key as well.
|
||||
|
@ -542,9 +542,9 @@ const CalendarFetcherUtils = {
|
|||
/**
|
||||
* convert a UTC date to local time
|
||||
* BEFORE calling rrule.between
|
||||
* @param date ti conert
|
||||
* tz event is currently in
|
||||
* @returns updated date object
|
||||
* @param {Date} date The date to convert
|
||||
* @param {string} tz The timezone string to convert the date to.
|
||||
* @returns {Date} updated date object
|
||||
*/
|
||||
convertDateToLocalTime (date, tz) {
|
||||
let delta_tz_offset = 0;
|
||||
|
@ -585,8 +585,8 @@ const CalendarFetcherUtils = {
|
|||
/**
|
||||
* get the exdate/recurrence hash key from the date object
|
||||
* BEFORE calling rrule.between
|
||||
* @param the date of the event
|
||||
* @returns string date key YYYY-MM-DD
|
||||
* @param {Date} date The date of the event
|
||||
* @returns {string} date key in the format YYYY-MM-DD
|
||||
*/
|
||||
getDateKeyFromDate (date) {
|
||||
// get our runtime timezone offset
|
||||
|
@ -611,9 +611,8 @@ const CalendarFetcherUtils = {
|
|||
|
||||
/**
|
||||
* get the timezone offset from the timezone string
|
||||
*
|
||||
* @param the timezone string
|
||||
* @returns the numerical offset
|
||||
* @param {string} timeZone The timezone string
|
||||
* @returns {number} The numerical offset in minutes from UTC.
|
||||
*/
|
||||
getTimezoneOffsetFromTimezone (timeZone) {
|
||||
const str = new Date().toLocaleString("en", { timeZone, timeZoneName: "longOffset" });
|
||||
|
@ -624,10 +623,10 @@ const CalendarFetcherUtils = {
|
|||
|
||||
/**
|
||||
* fixup the date start moment after rrule.between returns date array
|
||||
*
|
||||
* @param date object from rrule.between results
|
||||
* @param {Date} date object from rrule.between results
|
||||
* the event object it came from
|
||||
* @returns moment object
|
||||
* @param {object} event - The event object it came from.
|
||||
* @returns {Moment} moment object
|
||||
*/
|
||||
getAdjustedStartMoment (date, event) {
|
||||
|
||||
|
|
|
@ -181,6 +181,7 @@ Module.register("newsfeed", {
|
|||
* Gets a feed property by name
|
||||
* @param {object} feed A feed object.
|
||||
* @param {string} property The name of the property.
|
||||
* @returns {*} The value of the specified property for the feed.
|
||||
*/
|
||||
getFeedProperty (feed, property) {
|
||||
let res = this.config[property];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* @param {boolean} useCorsProxy A flag to indicate
|
||||
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
|
||||
* @param {Array.<string>} expectedResponseHeaders the expected HTTP headers to receive
|
||||
* @param {string} basePath, default /
|
||||
* @param {string} basePath The base path, default is "/"
|
||||
* @returns {Promise} resolved when the fetch is done. The response headers is placed in a headers-property (provided the response does not already contain a headers-property).
|
||||
*/
|
||||
async function performWebRequest (url, type = "json", useCorsProxy = false, requestHeaders = undefined, expectedResponseHeaders = undefined, basePath = "/") {
|
||||
|
@ -38,7 +38,7 @@ async function performWebRequest (url, type = "json", useCorsProxy = false, requ
|
|||
* @param {string} url the url to fetch from
|
||||
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
|
||||
* @param {Array.<string>} expectedResponseHeaders the expected HTTP headers to receive
|
||||
* @param {string} basePath, default /
|
||||
* @param {string} basePath The base path, default is "/"
|
||||
* @returns {string} to be used as URL when calling CORS-method on server.
|
||||
*/
|
||||
const getCorsUrl = function (url, requestHeaders, expectedResponseHeaders, basePath = "/") {
|
||||
|
|
|
@ -5,6 +5,7 @@ describe("Compliments module", () => {
|
|||
/**
|
||||
* move similar tests in function doTest
|
||||
* @param {Array} complimentsArray The array of compliments.
|
||||
* @param {string} state The state of the element (e.g., "visible" or "attached").
|
||||
* @returns {boolean} result
|
||||
*/
|
||||
const doTest = async (complimentsArray, state = "visible") => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue