add .gitattributes and fix prettier/js warnings (#3094)

see title, as discussed in
https://github.com/MichMich/MagicMirror/pull/3093
This commit is contained in:
Karsten Hassel
2023-04-22 09:29:51 +02:00
committed by GitHub
parent b80485b52f
commit a41aa48dd1
37 changed files with 58 additions and 162 deletions

View File

@@ -9,13 +9,11 @@
*
* Copyright 2014, Codrops
* https://tympanus.net/codrops/
*
* @param {object} window The window object
*/
(function (window) {
/**
* Extend one object with another one
*
* @param {object} a The object to extend
* @param {object} b The object which extends the other, overwrites existing keys
* @returns {object} The merged object
@@ -31,7 +29,6 @@
/**
* NotificationFx constructor
*
* @param {object} options The configuration options
* @class
*/
@@ -124,7 +121,6 @@
/**
* Dismiss the notification
*
* @param {boolean} [close] call the onClose callback at the end
*/
NotificationFx.prototype.dismiss = function (close = true) {

View File

@@ -524,7 +524,6 @@ Module.register("calendar", {
/**
* Checks if this config contains the calendar url.
*
* @param {string} url The calendar url
* @returns {boolean} True if the calendar config contains the url, False otherwise
*/
@@ -540,7 +539,6 @@ Module.register("calendar", {
/**
* Creates the sorted list of all events.
*
* @param {boolean} limitNumberOfEntries Whether to filter returned events for display.
* @returns {object[]} Array with events.
*/
@@ -673,7 +671,6 @@ Module.register("calendar", {
/**
* Requests node helper to add calendar url.
*
* @param {string} url The calendar url to add
* @param {object} auth The authentication method and credentials
* @param {object} calendarConfig The config of the specific calendar
@@ -698,7 +695,6 @@ Module.register("calendar", {
/**
* Retrieves the symbols for a specific event.
*
* @param {object} event Event to look for.
* @returns {string[]} The symbols
*/
@@ -739,7 +735,6 @@ Module.register("calendar", {
/**
* Retrieves the symbolClass for a specific calendar url.
*
* @param {string} url The calendar url
* @returns {string} The class to be used for the symbols of the calendar
*/
@@ -749,7 +744,6 @@ Module.register("calendar", {
/**
* Retrieves the titleClass for a specific calendar url.
*
* @param {string} url The calendar url
* @returns {string} The class to be used for the title of the calendar
*/
@@ -759,7 +753,6 @@ Module.register("calendar", {
/**
* Retrieves the timeClass for a specific calendar url.
*
* @param {string} url The calendar url
* @returns {string} The class to be used for the time of the calendar
*/
@@ -769,7 +762,6 @@ Module.register("calendar", {
/**
* Retrieves the calendar name for a specific calendar url.
*
* @param {string} url The calendar url
* @returns {string} The name of the calendar
*/
@@ -779,7 +771,6 @@ Module.register("calendar", {
/**
* Retrieves the color for a specific calendar url.
*
* @param {string} url The calendar url
* @param {boolean} isBg Determines if we fetch the bgColor or not
* @returns {string} The color
@@ -790,7 +781,6 @@ Module.register("calendar", {
/**
* Retrieves the count title for a specific calendar url.
*
* @param {string} url The calendar url
* @returns {string} The title
*/
@@ -800,7 +790,6 @@ Module.register("calendar", {
/**
* Retrieves the maximum entry count for a specific calendar url.
*
* @param {string} url The calendar url
* @returns {number} The maximum entry count
*/
@@ -810,7 +799,6 @@ Module.register("calendar", {
/**
* Retrieves the maximum count of past days which events of should be displayed for a specific calendar url.
*
* @param {string} url The calendar url
* @returns {number} The maximum past days count
*/
@@ -820,7 +808,6 @@ Module.register("calendar", {
/**
* Helper method to retrieve the property for a specific calendar url.
*
* @param {string} url The calendar url
* @param {string} property The property to look for
* @param {string} defaultValue The value if the property is not found

View File

@@ -121,7 +121,6 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
/**
* Sets the on success callback
*
* @param {Function} callback The on success callback.
*/
this.onReceive = function (callback) {
@@ -130,7 +129,6 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
/**
* Sets the on error callback
*
* @param {Function} callback The on error callback.
*/
this.onError = function (callback) {
@@ -139,7 +137,6 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
/**
* Returns the url of this fetcher.
*
* @returns {string} The url of this fetcher.
*/
this.url = function () {
@@ -148,7 +145,6 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
/**
* Returns current available events for this fetcher.
*
* @returns {object[]} The current available events for this fetcher.
*/
this.events = function () {

View File

@@ -17,7 +17,6 @@ const CalendarFetcherUtils = {
/**
* Calculate the time correction, either dst/std or full day in cases where
* utc time is day before plus offset
*
* @param {object} event the event which needs adjustment
* @param {Date} date the date on which this event happens
* @returns {number} the necessary adjustment in hours
@@ -119,7 +118,6 @@ const CalendarFetcherUtils = {
/**
* Filter the events from ical according to the given config
*
* @param {object} data the calendar data from ical
* @param {object} config The configuration object
* @returns {string[]} the filtered events
@@ -511,7 +509,6 @@ const CalendarFetcherUtils = {
/**
* Lookup iana tz from windows
*
* @param {string} msTZName the timezone name to lookup
* @returns {string|null} the iana name or null of none is found
*/
@@ -524,7 +521,6 @@ const CalendarFetcherUtils = {
/**
* Gets the title from the event.
*
* @param {object} event The event object to check.
* @returns {string} The title of the event, or "Event" if no title is found.
*/
@@ -541,7 +537,6 @@ const CalendarFetcherUtils = {
/**
* Checks if an event is a fullday event.
*
* @param {object} event The event object to check.
* @returns {boolean} True if the event is a fullday event, false otherwise
*/
@@ -563,7 +558,6 @@ const CalendarFetcherUtils = {
/**
* Determines if the user defined time filter should apply
*
* @param {Date} now Date object using previously created object for consistency
* @param {Moment} endDate Moment object representing the event end date
* @param {string} filter The time to subtract from the end date to determine if an event should be shown
@@ -584,7 +578,6 @@ const CalendarFetcherUtils = {
/**
* Determines if the user defined title filter should apply
*
* @param {string} title the title of the event
* @param {string} filter the string to look for, can be a regex also
* @param {boolean} useRegex true if a regex should be used, otherwise it just looks for the filter as a string

View File

@@ -7,7 +7,6 @@
const CalendarUtils = {
/**
* Capitalize the first letter of a string
*
* @param {string} string The string to capitalize
* @returns {string} The capitalized string
*/
@@ -19,7 +18,6 @@ const CalendarUtils = {
* This function accepts a number (either 12 or 24) and returns a moment.js LocaleSpecification with the
* corresponding time-format to be used in the calendar display. If no number is given (or otherwise invalid input)
* it will a localeSpecification object with the system locale time format.
*
* @param {number} timeFormat Specifies either 12 or 24-hour time format
* @returns {moment.LocaleSpecification} formatted time
*/
@@ -39,7 +37,6 @@ const CalendarUtils = {
/**
* Shortens a string if it's longer than maxLength and add an ellipsis to the end
*
* @param {string} string Text string to shorten
* @param {number} maxLength The max length of the string
* @param {boolean} wrapEvents Wrap the text after the line has reached maxLength
@@ -94,7 +91,6 @@ const CalendarUtils = {
* Transforms the title of an event for usage.
* Replaces parts of the text as defined in config.titleReplace.
* Shortens title based on config.maxTitleLength and config.wrapEvents
*
* @param {string} title The title to transform.
* @param {object} titleReplace Pairs of strings to be replaced in the title
* @returns {string} The transformed title.

View File

@@ -33,7 +33,6 @@ module.exports = NodeHelper.create({
/**
* Creates a fetcher for a new url if it doesn't exist yet.
* Otherwise it reuses the existing one.
*
* @param {string} url The url of the calendar
* @param {number} fetchInterval How often does the calendar needs to be fetched in ms
* @param {string[]} excludedEvents An array of words / phrases from event titles that will be excluded from being shown.

View File

@@ -52,7 +52,6 @@ Module.register("compliments", {
/**
* Generate a random index for a list of compliments.
*
* @param {string[]} compliments Array with compliments.
* @returns {number} a random index of given array
*/
@@ -78,7 +77,6 @@ Module.register("compliments", {
/**
* Retrieve an array of compliments for the time of the day.
*
* @returns {string[]} array with compliments for the time of the day.
*/
complimentArray: function () {
@@ -115,7 +113,6 @@ Module.register("compliments", {
/**
* Retrieve a file from the local filesystem
*
* @returns {Promise} Resolved when the file is loaded
*/
loadComplimentFile: async function () {
@@ -127,7 +124,6 @@ Module.register("compliments", {
/**
* Retrieve a random compliment.
*
* @returns {string} a compliment
*/
getRandomCompliment: function () {

View File

@@ -179,7 +179,6 @@ Module.register("newsfeed", {
/**
* Generate an ordered list of items for this configured module.
*
* @param {object} feeds An object with feeds returned by the node helper.
*/
generateFeed: function (feeds) {
@@ -272,7 +271,6 @@ Module.register("newsfeed", {
/**
* Check if this module is configured to show this feed.
*
* @param {string} feedUrl Url of the feed to check.
* @returns {boolean} True if it is subscribed, false otherwise
*/
@@ -287,7 +285,6 @@ Module.register("newsfeed", {
/**
* Returns title for the specific feed url.
*
* @param {string} feedUrl Url of the feed
* @returns {string} The title of the feed
*/

View File

@@ -14,7 +14,6 @@ const NodeHelper = require("node_helper");
/**
* Responsible for requesting an update on the set interval and broadcasting the data.
*
* @param {string} url URL of the news feed.
* @param {number} reloadInterval Reload interval in milliseconds.
* @param {string} encoding Encoding of the feed.
@@ -137,7 +136,6 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings
/**
* Update the reload interval, but only if we need to increase the speed.
*
* @param {number} interval Interval for the update in milliseconds.
*/
this.setReloadInterval = function (interval) {

View File

@@ -26,7 +26,6 @@ module.exports = NodeHelper.create({
/**
* Creates a fetcher for a new feed if it doesn't exist yet.
* Otherwise it reuses the existing one.
*
* @param {object} feed The feed object
* @param {object} config The configuration object
*/

View File

@@ -1,6 +1,5 @@
/**
* A function to make HTTP requests via the server to avoid CORS-errors.
*
* @param {string} url the url to fetch from
* @param {string} type what contenttype to expect in the response, can be "json" or "xml"
* @param {boolean} useCorsProxy A flag to indicate
@@ -35,7 +34,6 @@ async function performWebRequest(url, type = "json", useCorsProxy = false, reque
/**
* Gets a URL that will be used when calling the CORS-method on the server.
*
* @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
@@ -66,7 +64,6 @@ const getCorsUrl = function (url, requestHeaders, expectedResponseHeaders) {
/**
* Gets the part of the CORS URL that represents the HTTP headers to send.
*
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
* @returns {string} to be used as request-headers component in CORS URL.
*/
@@ -87,7 +84,6 @@ const getRequestHeaderString = function (requestHeaders) {
/**
* Gets headers and values to attach to the web request.
*
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
* @returns {object} An object specifying name and value of the headers.
*/
@@ -104,7 +100,6 @@ const getHeadersToSend = (requestHeaders) => {
/**
* Gets the part of the CORS URL that represents the expected HTTP headers to receive.
*
* @param {Array.<string>} expectedResponseHeaders the expected HTTP headers to receive
* @returns {string} to be used as the expected HTTP-headers component in CORS URL.
*/
@@ -125,7 +120,6 @@ const getExpectedResponseHeadersString = function (expectedResponseHeaders) {
/**
* Gets the values for the expected headers from the response.
*
* @param {Array.<string>} expectedResponseHeaders the expected HTTP headers to receive
* @param {Response} response the HTTP response
* @returns {string} to be used as the expected HTTP-headers component in CORS URL.
@@ -145,7 +139,6 @@ const getHeadersFromResponse = (expectedResponseHeaders, response) => {
/**
* Format the time according to the config
*
* @param {object} config The config of the module
* @param {object} time time to format
* @returns {string} The formatted time string

View File

@@ -194,7 +194,6 @@ WeatherProvider.register("openmeteo", {
/**
* Overrides method for setting config to check if endpoint is correct for hourly
*
* @param {object} config The configuration object
*/
setConfig(config) {

View File

@@ -90,7 +90,6 @@ WeatherProvider.register("openweathermap", {
/**
* Overrides method for setting config to check if endpoint is correct for hourly
*
* @param {object} config The configuration object
*/
setConfig(config) {

View File

@@ -69,7 +69,6 @@ WeatherProvider.register("smhi", {
/**
* Overrides method for setting config with checks for the precipitationValue being unset or invalid
*
* @param {object} config The configuration object
*/
setConfig(config) {
@@ -82,7 +81,6 @@ WeatherProvider.register("smhi", {
/**
* Of all the times returned find out which one is closest to the current time, should be the first if the data isn't old.
*
* @param {object[]} times Array of time objects
* @returns {object} The weatherdata closest to the current time
*/
@@ -100,7 +98,6 @@ WeatherProvider.register("smhi", {
/**
* Get the forecast url for the configured coordinates
*
* @returns {string} the url for the specified coordinates
*/
getURL() {
@@ -115,7 +112,6 @@ WeatherProvider.register("smhi", {
/**
* Calculates the apparent temperature based on known atmospheric data.
*
* @param {object} weatherData Weatherdata to use for the calculation
* @returns {number} The apparent temperature
*/
@@ -132,7 +128,6 @@ WeatherProvider.register("smhi", {
* Converts the returned data into a WeatherObject with required properties set for both current weather and forecast.
* The returned units is always in metric system.
* Requires coordinates to determine if its daytime or nighttime to know which icon to use and also to set sunrise and sunset.
*
* @param {object} weatherData Weatherdata to convert
* @param {object} coordinates Coordinates of the locations of the weather
* @returns {WeatherObject} The converted weatherdata at the specified location
@@ -178,7 +173,6 @@ WeatherProvider.register("smhi", {
/**
* Takes all the data points and converts it to one WeatherObject per day.
*
* @param {object[]} allWeatherData Array of weatherdata
* @param {object} coordinates Coordinates of the locations of the weather
* @param {string} groupBy The interval to use for grouping the data (day, hour)
@@ -230,7 +224,6 @@ WeatherProvider.register("smhi", {
/**
* Resolve coordinates from the response data (probably preferably to use
* this if it's not matching the config values exactly)
*
* @param {object} data Response data from the weather service
* @returns {{lon, lat}} the lat/long coordinates of the data
*/
@@ -241,7 +234,6 @@ WeatherProvider.register("smhi", {
/**
* The distance between the data points is increasing in the data the more distant the prediction is.
* Find these gaps and fill them with the previous hours data to make the data returned a complete set.
*
* @param {object[]} data Response data from the weather service
* @returns {object[]} Given data with filled gaps
*/
@@ -263,7 +255,6 @@ WeatherProvider.register("smhi", {
/**
* Helper method to get a property from the returned data set.
*
* @param {object} currentWeatherData Weatherdata to get from
* @param {string} name The name of the property
* @returns {*} The value of the property in the weatherdata
@@ -276,7 +267,6 @@ WeatherProvider.register("smhi", {
* Map the icon value from SMHI to an icon that MagicMirror² understands.
* Uses different icons depending on if its daytime or nighttime.
* SMHI's description of what the numeric value means is the comment after the case.
*
* @param {number} input The SMHI icon value
* @param {boolean} isDayTime True if the icon should be for daytime, false for nighttime
* @returns {string} The icon name for the MagicMirror

View File

@@ -189,7 +189,6 @@ WeatherProvider.register("ukmetoffice", {
/**
* Generates an url with api parameters based on the config.
*
* @param {string} forecastType daily or 3hourly forecast
* @returns {string} url
*/

View File

@@ -65,7 +65,6 @@ WeatherProvider.register("weatherbit", {
/**
* Overrides method for setting config to check if endpoint is correct for hourly
*
* @param {object} config The configuration object
*/
setConfig(config) {

View File

@@ -75,7 +75,6 @@ class WeatherObject {
/**
* Determines if the sun sets or rises next. Uses the current time and not
* the date from the weather-forecast.
*
* @param {Moment} date an optional date where you want to get the next
* action for. Useful only in tests, defaults to the current time.
* @returns {string} "sunset" or "sunrise"
@@ -93,7 +92,6 @@ class WeatherObject {
/**
* Checks if the weatherObject is at dayTime.
*
* @returns {boolean} true if it is at dayTime
*/
isDayTime() {
@@ -105,7 +103,6 @@ class WeatherObject {
* Update the sunrise / sunset time depending on the location. This can be
* used if your provider doesn't provide that data by itself. Then SunCalc
* is used here to calculate them according to the location.
*
* @param {number} lat latitude
* @param {number} lon longitude
*/
@@ -121,7 +118,6 @@ class WeatherObject {
*
* Before being handed to other modules, mutable values must be cloned safely.
* Especially 'moment' object is not immutable, so original 'date', 'sunrise', 'sunset' could be corrupted or changed by other modules.
*
* @returns {object} plained object clone of original weatherObject
*/
simpleClone() {

View File

@@ -113,7 +113,6 @@ const WeatherProvider = Class.extend({
/**
* A convenience function to make requests.
*
* @param {string} url the url to fetch from
* @param {string} type what contenttype to expect in the response, can be "json" or "xml"
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
@@ -138,7 +137,6 @@ WeatherProvider.providers = [];
/**
* Static method to register a new weather provider.
*
* @param {string} providerIdentifier The name of the weather provider
* @param {object} providerDetails The details of the weather provider
*/
@@ -148,7 +146,6 @@ WeatherProvider.register = function (providerIdentifier, providerDetails) {
/**
* Static method to initialize a new weather provider.
*
* @param {string} providerIdentifier The name of the weather provider
* @param {object} delegate The weather module
* @returns {object} The new weather provider

View File

@@ -7,7 +7,6 @@
const WeatherUtils = {
/**
* Convert wind (from m/s) to beaufort scale
*
* @param {number} speedInMS the windspeed you want to convert
* @returns {number} the speed in beaufort
*/
@@ -25,7 +24,6 @@ const WeatherUtils = {
/**
* Convert a value in a given unit to a string with a converted
* value and a postfix matching the output unit system.
*
* @param {number} value - The value to convert.
* @param {string} valueUnit - The unit the values has. Default is mm.
* @param {string} outputUnit - The unit system (imperial/metric) the return value should have.
@@ -50,7 +48,6 @@ const WeatherUtils = {
/**
* Convert temp (from degrees C) into imperial or metric unit depending on
* your config
*
* @param {number} tempInC the temperature in celsius you want to convert
* @param {string} unit can be 'imperial' or 'metric'
* @returns {number} the converted temperature
@@ -61,7 +58,6 @@ const WeatherUtils = {
/**
* Convert wind speed into another unit.
*
* @param {number} windInMS the windspeed in meter/sec you want to convert
* @param {string} unit can be 'beaufort', 'kmh', 'knots, 'imperial' (mph)
* or 'metric' (mps)