diff --git a/.eslintrc.js b/.eslintrc.js index 808f52d66e55d557fdf57581b8a0b51431102612..d044e9dbe7f0116e07d124bddcd786d1e411e75b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,6 +9,7 @@ module.exports = { overrides: [ { extends: [ + 'plugin:jsdoc/recommended', 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/eslint-recommended', // Uses the recommended rules from @typescript-eslint/eslint-plugin // This enables a lot of type checking @@ -27,6 +28,18 @@ module.exports = { '@typescript-eslint/prefer-as-const': 'error', '@typescript-eslint/await-thenable': 'error', '@typescript-eslint/no-var-requires': 'off', + + // JSDOC extends overrides: disable some of extends rules + // JSdoc is not always needed + 'jsdoc/require-jsdoc': 0, + // Prefer declaring types with typescript + 'jsdoc/require-returns': 0, + 'jsdoc/require-returns-type': 0, + 'jsdoc/require-param': 0, + 'jsdoc/require-param-type': 0, + + // Allow some params to be described and some to be omitted + 'jsdoc/check-param-names': 0, }, }, { diff --git a/package.json b/package.json index 973f9bc6b2c122a59dbc4f7101c96c0679aec301..a1d673733f1b86093026fa643a4c5a2b96952080 100644 --- a/package.json +++ b/package.json @@ -118,6 +118,7 @@ "eslint": "^8.49.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-jest": "^27.2.3", + "eslint-plugin-jsdoc": "^46.8.2", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-react": "7.32.2", "eslint-plugin-react-hooks": "^4.6.0", diff --git a/src/components/Konnector/ConnectionResult/ConnectionResult.tsx b/src/components/Konnector/ConnectionResult/ConnectionResult.tsx index 01fc8d2df28b2c1e173a8408db96788fa7ad654f..d94ae43114627d6ea6231cbd247b0ec658594289 100644 --- a/src/components/Konnector/ConnectionResult/ConnectionResult.tsx +++ b/src/components/Konnector/ConnectionResult/ConnectionResult.tsx @@ -197,10 +197,10 @@ const ConnectionResult = ({ /** * Get Konnector state, possible values: - * * partner maintenance - * * error state - * * outdated - * * last update date + * - partner maintenance + * - error state + * - outdated + * - last update date */ const getConnectionStatus = () => { // First check if there is partner error from backoffice diff --git a/src/migrations/migration.ts b/src/migrations/migration.ts index b5e6819cbe39d908450e026c7a18731556567981..785fdb48e0ac5c2d8b5c7df61b9dea2dd2e12930 100644 --- a/src/migrations/migration.ts +++ b/src/migrations/migration.ts @@ -33,7 +33,6 @@ async function currentSchemaVersion(_client: Client): Promise<number> { /** * Retrieve all documents of a given doctype * @param _client cozyClient - * @param doctype * @returns all documents of given doctype */ async function getDocs( @@ -58,8 +57,6 @@ async function getDocs( /** * Update schema version - * @param _client - * @param targetSchemaVersion */ async function updateSchemaVersion( _client: Client, @@ -75,8 +72,6 @@ async function updateSchemaVersion( /** * Save updated docs - * @param _client - * @param docs * @returns Promise<MigrationResult> */ async function save(_client: Client, docs: any[]): Promise<MigrationResult> { @@ -126,9 +121,6 @@ export const initSchemaDoctype = async ( /** * Run migration - * @param migration - * @param _client - * @returnsPromise<MigrationResult> */ export async function migrate( migration: Migration, diff --git a/src/services/action.service.ts b/src/services/action.service.ts index 67a1c41db15255d161c77fcd656278f5fd4b5d56..cede08d02afbcb07b1c6254268389ffdc3e2e298 100644 --- a/src/services/action.service.ts +++ b/src/services/action.service.ts @@ -25,7 +25,6 @@ export default class ActionService { /** * Get the list of available actions - * @returns {Promise<Ecogesture[]>} */ public async getAvailableActionList(): Promise<Ecogesture[]> { const userChallenges: UserChallenge[] = @@ -55,8 +54,7 @@ export default class ActionService { } /** - * Get default eocgestures - * @returns {Promise<Ecogesture[]>} + * Get default ecogestures */ public async getDefaultActions(): Promise<Ecogesture[]> { const actionIds = ['ECOGESTURE0030', 'ECOGESTURE0014', 'ECOGESTURE0010'] @@ -66,9 +64,7 @@ export default class ActionService { return defaultActions } - /** Complete the list with unfinished default ecogestures - * @returns {Promise<Ecogesture[]>} - */ + /** Complete the list with unfinished default ecogestures */ public async keepListComplete( actionList: Ecogesture[] ): Promise<Ecogesture[]> { @@ -81,12 +77,6 @@ export default class ActionService { return actionList } - /** - * - * @param {Ecogesture[]} filteredList - * @param {Ecogesture[]} actionList - * @returns {Ecogesture[]} - */ private completeWithNoSeason( filteredList: Ecogesture[], actionList: Ecogesture[] @@ -107,8 +97,6 @@ export default class ActionService { } /** * filterBySeason - Filter action list depending on current season - * @param {Ecogesture[]} actionList - * @returns {Ecogesture[]} */ public filterBySeason(actionList: Ecogesture[]): Ecogesture[] { let filteredList: Ecogesture[] = [] @@ -134,8 +122,6 @@ export default class ActionService { /** * getCustomActions - Filter action by fluid and season and sort them by difficulty first and efficiency second - * @param {FluidType[]} connectedFluids - * @returns {Promise<Ecogesture[]>} */ public async getCustomActions( connectedFluids: FluidType[] @@ -169,8 +155,6 @@ export default class ActionService { /** * launchAction - parse ecogesture to UserAction and launch it - * @param {Ecogesture} Ecogesture - * @returns {UserAction} */ public launchAction(ecogesture: Ecogesture): UserAction { const userAction: UserAction = { @@ -184,8 +168,7 @@ export default class ActionService { } /** * awaitNotificationAction - * @param {UserAction} UserAction - * @returns {UserAction} - updated user action + * @returns {UserAction} updated user action */ public awaitNotificationAction(userAction: UserAction): UserAction { const updatedUserAction: UserAction = { @@ -196,8 +179,7 @@ export default class ActionService { } /** * endAction - * @param {UserAction} UserAction - * @returns {UserAction} - updated user action + * @returns {UserAction} updated user action */ public endAction(userAction: UserAction): UserAction { const updatedUserAction: UserAction = { @@ -208,8 +190,6 @@ export default class ActionService { } /** * isActionDone - Set Action state to notification if progress > actionDuration - * @param {UserChallenge} currentChallenge - * @returns {Promise<UserChallenge | null>} */ public async isActionDone( currentChallenge: UserChallenge diff --git a/src/services/challenge.service.ts b/src/services/challenge.service.ts index ff4623e38efa7339c588266be05e4d7d186bc019..da30f2a65913ef09f2048a270e27da824c5105dc 100644 --- a/src/services/challenge.service.ts +++ b/src/services/challenge.service.ts @@ -56,7 +56,6 @@ export default class ChallengeService { * Retrieve list of Userchallenge and unlock the current challenge if the last one is done * If all challenges are locked, then unlock the first one * @param {UserChallenge[]} userChallenges - status of fluids - * @returns {UserChallenge[]} */ public unLockCurrentUserChallenge( userChallenges: UserChallenge[] @@ -77,7 +76,6 @@ export default class ChallengeService { /** * Retrieve UserChallenge from the UserChallengeEntity * @param {UserChallengeEntity} userChallenges - status of fluids - * @returns {UserChallenge} */ public parseUserChallengeEntityToUserChallenge( userChallengeEntity: UserChallengeEntity @@ -117,7 +115,6 @@ export default class ChallengeService { /** * Retrieve UserChallenge from the UserChallengeEntity * @param {UserChallengeEntity} userChallenges - status of fluids - * @returns {UserChallenge} */ public parseChallengeEntityToUserChallenge( challenge: ChallengeEntity, @@ -154,7 +151,6 @@ export default class ChallengeService { /** * * @param {UserExploration | ExplorationEntity} exploration - Exploration to be tested - * @param {FluidStatus[]} fluidStatus * @returns {boolean} isValid */ public async isExplorationConditionVerified( @@ -177,7 +173,6 @@ export default class ChallengeService { /** * * @param {ChallengeEntity} challenge - get all relations entities of a challenge - * @returns {RelationEntitiesObject} */ public async getRelationEntities( challenge: ChallengeEntity @@ -198,12 +193,6 @@ export default class ChallengeService { /** * Get a UserChallenge from its Entity and verify the exploration if there is a condition and if it's verified - * @param {UserExploration} exploration - * @param {ChallengeEntity} challenge - * @param {UserDuel} duel - * @param {UserQuiz} quiz - * @param {FluidStatus[]} fluidStatus - * @returns {UserChallenge} */ public async getUpdatedUserChallengeIfExplorationConditionIsValid( exploration: UserExploration, @@ -243,13 +232,6 @@ export default class ChallengeService { /** * The whole exploration process, checks if the exploration fluid condition exists and is valid for each existing * Exploration related to given challenge - * @param {ExplorationEntity[] | undefined} explorationEntities - * @param {Relation[]} explorationEntityRelation - * @param {ChallengeEntity} challenge - * @param {UserDuel} duel - * @param {UserQuiz} quiz - * @param {UserChallenge[]} buildList - * @param {FluidStatus[]} fluidStatus * @returns {UserChallenge[]} - buildList */ public async processExploration( @@ -285,10 +267,6 @@ export default class ChallengeService { } /** * Checks if the exploration condition exists and is valid when updating the buildList - * @param {UserChallenge} userChallenge - * @param {ChallengeEntity[]} challengeEntityList - * @param {FluidStatus[]} fluidStatus - * @returns {UserChallenge} */ public async loopVerificationExplorationCondition( userChallenge: UserChallenge, @@ -336,8 +314,6 @@ export default class ChallengeService { /** * Retrieve UserChallenge list with all challenges - * @param {FluidStatus[]} fluidStatus - * @returns {UserChallenge[]} */ public async buildUserChallengeList( fluidStatus: FluidStatus[] @@ -457,7 +433,6 @@ export default class ChallengeService { /** * Retrieve all ChallengeEntities - * @returns {ChallengeEntity[]} */ public async getAllChallengeEntities(): Promise<ChallengeEntity[]> { const query: QueryDefinition = Q(CHALLENGE_DOCTYPE) @@ -468,7 +443,6 @@ export default class ChallengeService { /** * Delete all ChallengeEntities - * @returns {boolean} * @throws {Error} */ public async deleteAllChallengeEntities(): Promise<boolean> { @@ -492,7 +466,6 @@ export default class ChallengeService { /** * Retrieve all UserChallengeEntities - * @returns {UserChallenge[]} */ public async getAllUserChallengeEntities(): Promise<UserChallenge[]> { const query: QueryDefinition = Q(USERCHALLENGE_DOCTYPE) @@ -547,7 +520,6 @@ export default class ChallengeService { /** * Start UserChallenge and retrieve updated UserChallenge - * @returns {UserChallenge} * @throws {Error} */ public async startUserChallenge( @@ -812,7 +784,6 @@ export default class ChallengeService { * Retrieve the dataload for a UserChallenge with duel ongoing * @param {UserChallenge} userChallenge - userChallenge to update * @param {UserChallengeUpdateFlag} flag - update flag - * @returns {Dataload[]} */ public async getUserChallengeDataload( userChallenge: UserChallenge @@ -844,7 +815,6 @@ export default class ChallengeService { * Define if challenge is done and if is win or lost * @param {UserChallenge} userChallenge - current userChallenge * @param {Dataload[]} dataloads - dataloads of current challenge - * @returns {boolean, boolean} */ public async isChallengeDone( userChallenge: UserChallenge, diff --git a/src/services/consumption.service.ts b/src/services/consumption.service.ts index 70565175f3ce1a979417d41b05fd7a932314c873..b6565ff740072fd5396b760f8c84122651a26223 100644 --- a/src/services/consumption.service.ts +++ b/src/services/consumption.service.ts @@ -367,13 +367,9 @@ export default class ConsumptionDataManager { /** * Retrieves an array of fluid types that have incomplete data for a given month. - * + * * Data is incomplete if at least one daily data is missing for the month. - * - * @param {FluidType[]} fluidTypes * @param {DateTime} month - The month for which to check the data completeness. - * @returns {Promise<FluidType[]>} - */ public async getFluidsWithIncompleteData( fluidTypes: FluidType[], @@ -586,7 +582,6 @@ export default class ConsumptionDataManager { /** * getLastHourData - * @param {Client} client * @param {number} month number * @returns {Promise<DataloadEntity[]>} usageEvent added */ @@ -609,8 +604,6 @@ export default class ConsumptionDataManager { /** * Get the first entry of a given data doctype (enedis, grdf, egl) - * @param doctype - * @returns */ public async getFirsDataDateFromDoctype( doctype: Doctype diff --git a/src/services/converter.service.ts b/src/services/converter.service.ts index 2b3d0b018e615e07068f020a41e161931c506743..d283508b42a1d209dc5e51885365c43f10975d97 100644 --- a/src/services/converter.service.ts +++ b/src/services/converter.service.ts @@ -34,7 +34,6 @@ export default class ConverterService { * @param {FluidConfig} fluidConfig - Fluid configuration * @param {number} load - Load value * @param {number} [price] - Price if exist - * @returns {number} */ private applyPrice( fluidConfig: FluidConfig, diff --git a/src/services/dateChart.service.ts b/src/services/dateChart.service.ts index efd5334464e2cad9eece21351337a38196d4bd93..1a5ac296b4322b29a324126e36d9f6a043a68256 100644 --- a/src/services/dateChart.service.ts +++ b/src/services/dateChart.service.ts @@ -6,9 +6,6 @@ import ConfigService from './fluidConfig.service' export default class DateChartService { /** * Define a time period for a given slide defined by its index - * @param referenceDate - * @param timeStep - * @param index */ public defineTimePeriod( referenceDate: DateTime, @@ -93,7 +90,6 @@ export default class DateChartService { * @param {DateTime} referenceDate - reference date * @param {TimeStep} timeStep - time step * @param {number} index - index - * @returns {DateTime} */ public defineFirstStepDate( referenceDate: DateTime, @@ -109,7 +105,6 @@ export default class DateChartService { * @param {DateTime} referenceDate - reference date * @param {TimeStep} timeStep - time step * @param {number} index - index - * @returns {DateTime} */ public defineLastStepDate( referenceDate: DateTime, @@ -292,8 +287,6 @@ export default class DateChartService { /** * Checks if the last data date is outdated and returns the number of missing days - * @param {DateTime | null} lastDataDate - * @param {FluidType} fluidType * @returns {number| null} - The number of missing days */ public isDataOutdated( diff --git a/src/services/duel.service.ts b/src/services/duel.service.ts index 204e9e708618d96591d8df649e987b0b5e24016c..743763430d2c0b1865be4ea69e2585f02a942d0f 100644 --- a/src/services/duel.service.ts +++ b/src/services/duel.service.ts @@ -30,7 +30,6 @@ export default class DuelService { /** * Retrieve period with data based on lastDataDate of the fluids * @param {FluidStatus[]} fluidStatus - status of fluids - * @param {Duel} userDuel * @returns {TimePeriod} - true when deleted with success */ private async getValidPeriod( @@ -67,10 +66,6 @@ export default class DuelService { } /** * Check all period until find one with no empty value or return false - * @param period - * @param fluidType - * @param duration - * @returns {Promise<false | TimePeriod>} */ private async isPeriodComplete( period: TimePeriod, @@ -116,7 +111,6 @@ export default class DuelService { } /** * Retrieve all duel entities from db - * @returns {DuelEntity[]} */ public async getAllDuelEntities(): Promise<DuelEntity[]> { const query: QueryDefinition = Q(DUEL_DOCTYPE) @@ -127,9 +121,7 @@ export default class DuelService { /** * Retrieve duel entities from db given the id - * * @param {string} duelId - ID of the searched duel - * @returns {DuelEntity} */ public async getDuelEntityById(duelId: string): Promise<DuelEntity> { const query: QueryDefinition = Q(DUEL_DOCTYPE) @@ -164,7 +156,6 @@ export default class DuelService { /** * Return duel with updated state to UserDuelState.UNLOCKED * @param {UserDuel} userDuel - userDuel to unlock - * @returns {UserDuel} */ public async unlockUserDuel(userDuel: UserDuel): Promise<UserDuel> { const updatedUserDuel: UserDuel = { @@ -187,9 +178,8 @@ export default class DuelService { } /** - * Return duel with updated thrshold and fluidTypes + * Return duel with updated threshold and fluidTypes * @param {UserDuel} userDuel - userDuel to update - * @returns {UserDuel} */ public async updateUserDuelThreshold( userDuel: UserDuel, @@ -241,7 +231,6 @@ export default class DuelService { /** * Return duel with updated state to UserDuelState.ONGOING and startDate * @param {UserDuel} userDuel - userDuel to update - * @returns {UserDuel} */ public async startUserDuel(userDuel: UserDuel): Promise<UserDuel> { const updatedUserDuel: UserDuel = { @@ -257,7 +246,6 @@ export default class DuelService { /** * Return duel with updated state to UserDuelState.DONE * @param {UserDuel} userDuel - userDuel to update - * @returns {UserDuel} */ public async endUserDuel(userDuel: UserDuel): Promise<UserDuel> { const updatedUserDuel: UserDuel = { @@ -270,7 +258,6 @@ export default class DuelService { /** * Return duel with updated state to UserDuelState.UNLOCKED * @param {UserDuel} userDuel - userDuel to reset - * @returns {UserDuel} */ public async resetUserDuel(userDuel: UserDuel): Promise<UserDuel> { return { @@ -285,7 +272,6 @@ export default class DuelService { /** * Return duel created from duel entity * @param {DuelEntity} duel - userDuel to update - * @returns {Duel} */ public parseDuelEntityToDuel(duel: DuelEntity): UserDuel { const userDuel: UserDuel = { @@ -306,7 +292,6 @@ export default class DuelService { * Return duel created from duel entity * @param {DuelEntity[]} duelEntityList - userDuel to update * @param {string} searchId - userDuel to update - * @returns {UserDuel} */ public getDuelfromDuelEntities( duelEntityList: DuelEntity[], diff --git a/src/services/ecogesture.service.ts b/src/services/ecogesture.service.ts index 402795d9e225584c0a9e1c9669e207093b939bdd..87e99c1b228cf3fbba7bfcd19c3b2c477b0988c4 100644 --- a/src/services/ecogesture.service.ts +++ b/src/services/ecogesture.service.ts @@ -156,7 +156,6 @@ export default class EcogestureService { /** * @param {string} ids - ecogestures ids - * @returns {Promise<Ecogesture[]>} */ public async getEcogesturesByIds(ids: string[]): Promise<Ecogesture[]> { const query: QueryDefinition = Q(ECOGESTURE_DOCTYPE).getByIds(ids) @@ -208,9 +207,6 @@ export default class EcogestureService { /** * Removes ecogestures from the list that doesn't fit with user's usages - * @param {Ecogesture[]} ecogestureList - * @param {ProfileEcogesture} profileEcogesture - * @returns {Ecogesture[]} */ public filterByUsage( ecogestureList: Ecogesture[], @@ -251,9 +247,6 @@ export default class EcogestureService { /** * Removes ecogesture from the list that depends on equipment the user hasn't - * @param {Ecogesture[]} ecogestureList - * @param {ProfileEcogesture} profileEcogesture - * @returns {Ecogesture[]} */ public filterByEquipment( ecogestureList: Ecogesture[], @@ -274,8 +267,6 @@ export default class EcogestureService { /** * Return a filtered list according to ecogesture profile, the list is sorted by low difficulty and high efficiency - * @param {ProfileEcogesture} profileEcogesture - * @returns {Ecogesture[]} */ public async getEcogestureListByProfile( profileEcogesture: ProfileEcogesture diff --git a/src/services/enedisMonthlyAnalysisData.service.ts b/src/services/enedisMonthlyAnalysisData.service.ts index 7d893b96e15a3ace3d37548dc43bebb91b23977f..203af627e71c0c70e4b202cf5ccc3e09f1ac96ba 100644 --- a/src/services/enedisMonthlyAnalysisData.service.ts +++ b/src/services/enedisMonthlyAnalysisData.service.ts @@ -24,7 +24,6 @@ export default class EnedisMonthlyAnalysisDataService { /** * Retrieve all exploration entities from db - * @returns {EnedisMonthlyAnalysisData[]} */ public async getAllEnedisMonthlyAnalysisData(): Promise< EnedisMonthlyAnalysisData[] @@ -40,8 +39,6 @@ export default class EnedisMonthlyAnalysisDataService { /** * getLastEnedisMonthlyAnalysis - * @param {Client} client - * @returns {Promise<EnedisMonthlyAnalysisData[]>} */ public async getLastEnedisMonthlyAnalysis(): Promise< EnedisMonthlyAnalysisData[] @@ -57,8 +54,6 @@ export default class EnedisMonthlyAnalysisDataService { /** * Aggregates Enedis Analysis data in order to create Dataload injectable in graph component - * @param {EnedisMonthlyAnalysisData} data - * @returns {AggregatedEnedisMonthlyDataloads} */ public aggregateValuesToDataLoad = ( data: EnedisMonthlyAnalysisData @@ -105,9 +100,6 @@ export default class EnedisMonthlyAnalysisDataService { /** * Get an enedis monthly analysis for given month and year - * @param {number} year - * @param {number} month - * @returns {Promise<EnedisMonthlyAnalysisData[]>} */ public async getEnedisMonthlyAnalysisByDate( year: number, @@ -125,8 +117,6 @@ export default class EnedisMonthlyAnalysisDataService { /** * Creates a new EnedisMonthlyAnalysis - * @param {EnedisMonthlyAnalysisData} newEnedisMonthlyAnalysisData - * @returns {Promise<EnedisMonthlyAnalysisData | null>} */ public async createEnedisMonthlyAnalysisData( newEnedisMonthlyAnalysisData: EnedisMonthlyAnalysisData @@ -152,9 +142,6 @@ export default class EnedisMonthlyAnalysisDataService { /** * Get Max power for a given month and year - * @param {number} year - * @param {number} month - * @returns {Promise<MaxPowerEntity[]>} */ public async getMaxPowerByDate( year: number, diff --git a/src/services/exploration.service.ts b/src/services/exploration.service.ts index 8e104793803c97318da145d6b3e29e6771c05880..605b9f54cb09d1db617559d8650d09b55321274d 100644 --- a/src/services/exploration.service.ts +++ b/src/services/exploration.service.ts @@ -19,7 +19,6 @@ export default class ExplorationService { /** * Retrieve all exploration entities from db - * @returns {ExplorationEntity[]} */ public async getAllExplorationEntities(): Promise<ExplorationEntity[]> { const query: QueryDefinition = Q(EXPLORATION_DOCTYPE) @@ -30,9 +29,7 @@ export default class ExplorationService { /** * Retrieve exploration entities from db given the id - * * @param {string} explorationId - ID of the searched exploration - * @returns {ExplorationEntity} */ public async getExplorationEntityById( explorationId: string @@ -65,7 +62,6 @@ export default class ExplorationService { * Return exploration created from exploration entity * @param {ExplorationEntity[]} explorationEntityList - userExploration to update * @param {string} searchId - userExploration to update - * @returns {UserExploration} */ public getUserExplorationfromExplorationEntities( explorationEntityList: ExplorationEntity[], @@ -102,8 +98,6 @@ export default class ExplorationService { /** * Return UserExploration created from ExplorationEntity - * @param {ExplorationEntity} - * @returns {UserExploration} */ public parseExplorationEntityToUserExploration( exploration: ExplorationEntity @@ -121,7 +115,6 @@ export default class ExplorationService { /** * Return exploration with updated state to UserExplorationState.ONGOING * @param {UserExploration} userExploration - userExploration to update - * @returns {UserExploration} */ public async startUserExploration( userExploration: UserExploration @@ -136,7 +129,6 @@ export default class ExplorationService { /** * Return exploration with updated state to UserExplorationState.NOTIFICATION * @param {UserExploration} userExploration - userExploration to update - * @returns {UserExploration} */ public async awaitNotificationUserExploration( userExploration: UserExploration @@ -151,7 +143,6 @@ export default class ExplorationService { /** * Return exploration with updated state to UserExplorationState.DONE * @param {UserExploration} userExploration - userExploration to update - * @returns {UserExploration} */ public endUserExploration(userExploration: UserExploration): UserExploration { const updatedUserExploration: UserExploration = { @@ -165,9 +156,6 @@ export default class ExplorationService { /** * Return updated exploration * @param {UserExploration} userExploration - userExploration to update - * @returns {UserExploration} - * @returns {questionIndex} - * @returns {questionResult} */ public async updateUserExploration( userExploration: UserExploration @@ -185,7 +173,6 @@ export default class ExplorationService { * Return updated UserChallenge with updated UserExploration * @param {UserChallenge} currentChallenge - currentUserChallenge ongoing * @param {string} explorationID - Id of the exploration - * @returns {UserChallenge} */ public async checkExploration( currentChallenge: UserChallenge, diff --git a/src/services/fluid.service.ts b/src/services/fluid.service.ts index e6f3443de9111eab060f7806c8452b14ea4998d2..a25af857cd7ba141a30710ad61771d68587551f3 100644 --- a/src/services/fluid.service.ts +++ b/src/services/fluid.service.ts @@ -177,8 +177,6 @@ export default class FluidService { /** * Return fluids with data older than 5 days - * @param {FluidStatus[]} fluidStatus - * @returns {FluidType[]} */ static getOldFluidData = async ( fluidStatus: FluidStatus[] diff --git a/src/services/fluidsPrices.service.ts b/src/services/fluidsPrices.service.ts index 64ad119f7108b47e4d6822ba72b395b25051729f..75974f95b68e2b3aa18e4df3eee9c3ab0074e7d4 100644 --- a/src/services/fluidsPrices.service.ts +++ b/src/services/fluidsPrices.service.ts @@ -19,7 +19,6 @@ export default class FluidPricesService { /** * Get all prices available in database - * @returns {FluidPrice[]} */ public async getAllPrices(): Promise<FluidPrice[]> { const query: QueryDefinition = Q(FLUIDSPRICES_DOCTYPE).limitBy(900) @@ -31,9 +30,6 @@ export default class FluidPricesService { /** * Get a price according to a fluidType and a data. This method return the nearest and valid price for the given date. - * @param {FluidType} fluidType - * @param {DateTime} date - * @returns {FluidPrice} */ public async getPrices( fluidType: FluidType, @@ -57,7 +53,6 @@ export default class FluidPricesService { /** * Get current prices for all fluidTypes. - * @returns {FluidPrice[]} */ public async getAllLastPrices(): Promise<FluidPrice[]> { const query: QueryDefinition = Q(FLUIDSPRICES_DOCTYPE) @@ -120,8 +115,7 @@ export default class FluidPricesService { /** * Check if a fluidprice exists in db - * @param {FluidPrice} fluidPrice - * @returns {FluidPrice | null} price or null + * @returns {Promise<FluidPrice | null>} price or null */ public async checkIfPriceExists( fluidPrice: FluidPrice @@ -139,8 +133,7 @@ export default class FluidPricesService { /** * Creates a new fluidPrice - * @param {FluidPrice} fluidPrice - * @returns {FluidPrice | null} price or null + * @returns {Promise<FluidPrice | null>} price or null */ public async createPrice(newPrice: FluidPrice): Promise<FluidPrice | null> { try { @@ -160,9 +153,6 @@ export default class FluidPricesService { /** * Updates a price in db - * @param {FluidPrice} doc - * @param {Partial<FluidPrice>} attributes - * @returns {FluidPrice | null} */ public async updatePrice( doc: FluidPrice, diff --git a/src/services/konnectorStatus.service.ts b/src/services/konnectorStatus.service.ts index 46395d3e18e7b06996f23d36a44d646ffafc0762..2ccb17bdb1eec46e2c356267921b213ec39bba45 100644 --- a/src/services/konnectorStatus.service.ts +++ b/src/services/konnectorStatus.service.ts @@ -12,8 +12,7 @@ export default class KonnectorStatusService { /** * Return a FluidType array containing each konnector fluid with a account - * @param void - * @return {Promise<FluidType[]>} configured FluidTypes array + * @returns {Promise<FluidType[]>} configured FluidTypes array */ async getKonnectorAccountStatus(): Promise<FluidType[]> { const fluidConfig = new ConfigService().getFluidConfig() diff --git a/src/services/profile.service.ts b/src/services/profile.service.ts index 64bf5dc792d3d18564472b50773c10ee527240d3..48a31b7224ff4bfef964f420d4623323dfb17eb5 100644 --- a/src/services/profile.service.ts +++ b/src/services/profile.service.ts @@ -21,8 +21,6 @@ export default class ProfileService { /** * Retrieve Profile from the ProfileEntity - * @param {ProfileEntity} profileEntity - * @returns {Profile} */ private parseProfileEntityToProfile(profileEntity: ProfileEntity): Profile { const profile: Profile = { diff --git a/src/services/profileEcogesture.service.ts b/src/services/profileEcogesture.service.ts index d5a714a47c569da4572a0de206626f01831b8ef2..e9cfce1e125ebd6e3162c3a626adccd7054dfb00 100644 --- a/src/services/profileEcogesture.service.ts +++ b/src/services/profileEcogesture.service.ts @@ -10,7 +10,6 @@ export default class ProfileEcogestureService { } /** * Retrieve the ProfileEcogesture from db - * @returns {ProfileEcogesture} */ public async getProfileEcogesture(): Promise<ProfileEcogesture | null> { const query: QueryDefinition = Q(PROFILEECOGESTURE_DOCTYPE) @@ -25,7 +24,6 @@ export default class ProfileEcogestureService { /** * Saves ProfileEcogesture in database - * @returns {ProfileEcogesture} */ public async updateProfileEcogesture( attributes: Partial<ProfileEcogesture> diff --git a/src/services/profileEcogestureForm.service.ts b/src/services/profileEcogestureForm.service.ts index 824e6eeef0b3b043ac23956756cd55c2a7342947..e3d994fb3c7246af560e0ccfd6c951ec69ad3ebb 100644 --- a/src/services/profileEcogestureForm.service.ts +++ b/src/services/profileEcogestureForm.service.ts @@ -20,7 +20,6 @@ export default class ProfileEcogestureFormService { /** * getNextFormStep - * @param {EcogestureStepForm} step * @returns {EcogestureStepForm} next step */ public getNextFormStep(step: EcogestureStepForm): EcogestureStepForm { @@ -43,7 +42,6 @@ export default class ProfileEcogestureFormService { /** * getPreviousFormStep - * @param {EcogestureStepForm} step * @returns {EcogestureStepForm} previous step */ public getPreviousFormStep(step: EcogestureStepForm): EcogestureStepForm { @@ -64,8 +62,6 @@ export default class ProfileEcogestureFormService { /** * getAnswerForStep - * @param {EcogestureStepForm} step - * @returns {EcogestureFormAnswer} */ static getAnswerForStep(step: EcogestureStepForm): ProfileEcogestureAnswer { switch (step) { diff --git a/src/services/profileType.service.ts b/src/services/profileType.service.ts index a5a2900fc38d729b9f8d03391df76f099ad79412..b543a681a79b5f0e6bcddb3b349f3f5783ec175f 100644 --- a/src/services/profileType.service.ts +++ b/src/services/profileType.service.ts @@ -66,7 +66,6 @@ export default class ProfileTypeService { /** * calculateWarmingCorrectedConsumption - * @param {number} estimatedConsumption * @returns {number} - Corrected consumption */ public calculateWarmingCorrectedConsumption( @@ -183,10 +182,8 @@ export default class ProfileTypeService { /** * calculateWarmingMonthConsumption - @param {number} correctedConsumption - @param {number} number @returns {number} monthConsumption - */ + */ public async calculateWarmingMonthConsumption( correctedConsumption: number, month: number @@ -199,8 +196,6 @@ export default class ProfileTypeService { } /** * getMonthHeating - * @param {ProfileType} profileType - * @param {number} month * @returns {number} Month heating consumption in kw/h */ public async getMonthHeating(month: number): Promise<number> { @@ -216,9 +211,6 @@ export default class ProfileTypeService { /** * Calculate water raw needs by month - * - * @param {ProfileType} profileType - * @param {number} month * @returns {number} rawConsumption */ public calculateMonthWaterRawNeeds( @@ -240,9 +232,6 @@ export default class ProfileTypeService { } /** * Calculate spread water needs by month - * - * @param {ProfileType} profileType - * @param {number} month * @returns {number} spreadConsumption */ public calculateSpreadNeeds(profileType: ProfileType, month: number): number { @@ -261,9 +250,6 @@ export default class ProfileTypeService { } /** * Calculate total ecs consumption by month - * - * @param {number} spreadConsumption - * @param {ProfileType} profileType * @returns {number} monthEcsConsumption */ public calculateTotalConsumption( @@ -294,9 +280,6 @@ export default class ProfileTypeService { } /** * Get ECS consumption by month - * - * @param {ProfileType} profileType - * @param {number} month * @returns {number} monthEcsConsumption */ public getMonthEcs(month: number) { @@ -313,8 +296,6 @@ export default class ProfileTypeService { } /** * Get cooking consumption by month - * @param {ProfileType} profileType - * @param {number} month * @returns {number} monthCookingConsumption */ public getMonthCookingConsumption(month: number): number { @@ -332,8 +313,6 @@ export default class ProfileTypeService { } /** * Get specific electricity consumption by month - * @param {ProfileType} profileType - * @param {number} month * @returns {number} monthElectricSpecificConsumption */ public getMonthElectricSpecificConsumption(month: number): number { @@ -352,8 +331,6 @@ export default class ProfileTypeService { } /** * Get cold water consumption by month - * @param {ProfileType} profileType - * @param {number} month * @returns {number} monthColdWaterConsumption */ public getMonthColdWaterConsumption(month: number): number { @@ -373,9 +350,7 @@ export default class ProfileTypeService { } /** * getDetailsMonthlyForecast - * @param {FluidType} fluidType - * @param {number} month - * @returns {number} DetailsMonthlyForecast + * @returns DetailsMonthlyForecast */ public async getDetailsMonthlyForecast( fluidType: FluidType, @@ -425,12 +400,6 @@ export default class ProfileTypeService { return detailsMonthlyForecast } - /** - * getFluidForecast - * @param {FluidType} fluidType - * @param {number} month - @returns {FluidForecast} fluidForecast - */ public async getFluidForecast( fluidType: FluidType, month: number @@ -459,8 +428,7 @@ export default class ProfileTypeService { /** * getMonthlyForecast - * @param {number} month - * @returns {MonthlyForecast} MonthlyForecast + * @returns {Promise<MonthlyForecast>} MonthlyForecast */ public async getMonthlyForecast(month: number): Promise<MonthlyForecast> { const elecForecast: FluidForecast = await this.getFluidForecast( @@ -486,9 +454,7 @@ export default class ProfileTypeService { /** * Try to fetch dju from remote doctype, if no data or error, return default data - * @param {Client} client - * @param {number} month - * @returns {number} monthDju + * @returns {Promise<number>} monthDju */ public fetchDJU = async (month: number): Promise<number> => { const startDate: string = DateTime.local() @@ -540,7 +506,6 @@ export default class ProfileTypeService { /** * checkConsistency - * @param {ProfileType} profileType * @returns {ProfileType} consistent profile type */ static checkConsistency(profileType: ProfileType): ProfileType { diff --git a/src/services/profileTypeEntity.service.ts b/src/services/profileTypeEntity.service.ts index bb68839a13cdca9313f5d79a101531ce07037132..b5dee47b334e2b945e50643ed23794144eaff0e7 100644 --- a/src/services/profileTypeEntity.service.ts +++ b/src/services/profileTypeEntity.service.ts @@ -19,8 +19,6 @@ export default class ProfileTypeEntityService { * Retrieves ProfileType from the PROFILETYPE_DOCTYPE * When called with date parameter, fetches closest profileType to the date * When called without parameters, fetches last profileType in doctype - * @param {DateTime} date - * @returns {ProfileType} */ public async getProfileType(date?: DateTime): Promise<ProfileType | null> { const query: QueryDefinition = Q(PROFILETYPE_DOCTYPE) @@ -83,8 +81,6 @@ export default class ProfileTypeEntityService { * Retrieves all ProfileTypes from the PROFILETYPE_DOCTYPE * When called with period parameter, returns all profileTypes found for this period or null * When called without parameters, returns all profileTypes or null if none exist - * @param {TimePeriod} timePeriod - * @returns {ProfileType} */ public async getAllProfileTypes( timePeriod?: TimePeriod @@ -132,7 +128,6 @@ export default class ProfileTypeEntityService { /** * Saves profileType in database - * @returns {ProfileType} */ public async saveProfileType( attributes: Partial<ProfileType> @@ -154,7 +149,6 @@ export default class ProfileTypeEntityService { /** * Deletes Array of ProfileTypes - * @returns {boolean} */ public async deleteProfileTypes( profileTypes: ProfileType[] @@ -175,8 +169,6 @@ export default class ProfileTypeEntityService { /** * Retrieves ProfileType from the ProfileTypeEntity - * @param {ProfileType} profileTypeEntity - * @returns {ProfileType} */ private parseProfileTypeEntityToProfileType( profileTypeEntity: ProfileType diff --git a/src/services/profileTypeForm.service.ts b/src/services/profileTypeForm.service.ts index b9d990f3b2cb759a234eb3d4d4fe2097953db501..afa3020e9377e65f78759beaa58993c089bb139b 100644 --- a/src/services/profileTypeForm.service.ts +++ b/src/services/profileTypeForm.service.ts @@ -25,7 +25,6 @@ export default class ProfileTypeFormService { /** * getNextFormStep - * @param {ProfileTypeStepForm} step * @returns {ProfileTypeStepForm} next step */ public getNextFormStep( @@ -88,7 +87,6 @@ export default class ProfileTypeFormService { /** * getPreviousFormStep - * @param {ProfileTypeStepForm} step * @returns {ProfileTypeStepForm} previous step */ public getPreviousFormStep(step: ProfileTypeStepForm): ProfileTypeStepForm { @@ -144,8 +142,7 @@ export default class ProfileTypeFormService { /** * getAnswerForStep - * @param {ProfileTypeStepForm} step - * @returns {ProfileTypeAnswer} + * @returns {ProfileTypeAnswer} - answer type */ static getAnswerForStep(step: ProfileTypeStepForm): ProfileTypeAnswer { switch (step) { diff --git a/src/services/quiz.service.ts b/src/services/quiz.service.ts index 34a71fc059ef3f09c9b212213b6513cb517520e0..bb0a4f72cfaff373803692dda8b16590095984e1 100644 --- a/src/services/quiz.service.ts +++ b/src/services/quiz.service.ts @@ -34,7 +34,6 @@ export default class QuizService { /** * Retrieve all quiz entities from db - * @returns {QuizEntity[]} */ public async getAllQuizEntities(): Promise<QuizEntity[]> { const query: QueryDefinition = Q(QUIZ_DOCTYPE) @@ -46,9 +45,7 @@ export default class QuizService { /** * Retrieve quiz entities from db given the id - * * @param {string} quizId - ID of the searched quiz - * @returns {QuizEntity} */ public async getQuizEntityById(quizId: string): Promise<QuizEntity> { const query: QueryDefinition = Q(QUIZ_DOCTYPE) @@ -77,7 +74,6 @@ export default class QuizService { * Return quiz created from quiz entity * @param {QuizEntity[]} quizEntityList - userQuiz to update * @param {string} searchId - userQuiz to update - * @returns {UserQuiz} */ public getUserQuizfromQuizEntities( quizEntityList: QuizEntity[], @@ -113,8 +109,6 @@ export default class QuizService { /** * Return UserQuestion created from QuestionEntity - * @param {QuestionEntity} - * @returns {UserQuestion} */ public parseQuestionEntityToQuestion(question: QuestionEntity): UserQuestion { const userQuestion: UserQuestion = { @@ -126,8 +120,6 @@ export default class QuizService { /** * Return UserCustomQuestion created from CustomQuestionEntity - * @param {CustomQuestionEntity} - * @returns {UserCustomQuestion} */ public parseCustomQuestionEntityToCustomQuestion( customQuestion: CustomQuestionEntity @@ -141,8 +133,6 @@ export default class QuizService { /** * Return UserQuiz created from QuizEntity - * @param {QuizEntity} - * @returns {UserQuiz} */ public parseQuizEntityToUserQuiz(quiz: QuizEntity): UserQuiz { const userQuestions: UserQuestion[] = [] @@ -173,7 +163,6 @@ export default class QuizService { /** * Return quiz with updated state to UserQuizState.ONGOING and randomize question and answers * @param {UserQuiz} userQuiz - userQuiz to update - * @returns {UserQuiz} */ public async startUserQuiz(userQuiz: UserQuiz): Promise<UserQuiz> { const questions = userQuiz.questions.map(question => ({ @@ -193,7 +182,6 @@ export default class QuizService { /** * Return quiz with updated state to UserQuizState.UNLOCKED and updated questions with false result * @param {UserQuiz} userQuiz - userQuiz to update - * @returns {UserQuiz} */ public async resetUserQuiz(userQuiz: UserQuiz): Promise<UserQuiz> { const updatedQuestions: UserQuestion[] = userQuiz.questions.map( @@ -218,7 +206,6 @@ export default class QuizService { /** * Return quiz with updated state to UserQuizState.DONE * @param {UserQuiz} userQuiz - userQuiz to update - * @returns {UserQuiz} */ public async endUserQuiz(userQuiz: UserQuiz): Promise<UserQuiz> { const updatedUserQuiz: UserQuiz = { @@ -231,9 +218,6 @@ export default class QuizService { /** * Return quiz with result and updated question or customQuestion if no index is passed * @param {UserQuiz} userQuiz - userQuiz to update - * @returns {UserQuiz} - * @returns {questionIndex} - * @returns {questionResult} */ public async updateUserQuiz( userQuiz: UserQuiz, @@ -274,9 +258,6 @@ export default class QuizService { /** * Build a custom question with the customQuestionEntity - * @param customQuestionEntity - * @param fluidType - * @returns {QuestionEntity} */ public async getCustomQuestion( customQuestionEntity: CustomQuestionEntity, @@ -362,9 +343,6 @@ export default class QuizService { /** * Get the interval needed for the further calculs - * @param interval - * @param period - * @returns {TimePeriod} */ private getTimePeriodFromInterval( interval: TimeStep, @@ -413,10 +391,6 @@ export default class QuizService { * Finds max load on given past time period * when no max load is found looks x month/year back for a max value * if nothing is found fall back on most recent data - * @param timeStep - * @param interval - * @param fluidType - * @returns {Promise<IntervalAnswer>} */ private async getMaxLoadOnLastInterval( timeStep: TimeStep, @@ -501,11 +475,6 @@ export default class QuizService { /** * Calcul the average value on a given period - * @param timeStep - * @param interval - * @param fluidType - * @param weekday - * @returns {Promise<number>} */ private async getAverageOnGivenPeriod( timeStep: TimeStep, @@ -550,9 +519,6 @@ export default class QuizService { /** * Generate wrong date answer following the right one - * @param rightDate - * @param interval - * @returns {Answer[]} */ private getAnswersForInterval( rightDate: DateTime, @@ -641,9 +607,6 @@ export default class QuizService { /** * Generate wrong value answer following the right one - * @param maxLoad - * @param unit - * @returns {Answer[]} */ private getAnswersForNumberValue(maxLoad: number, unit: string): Answer[] { const coefList: number[] = [0.6, 0.7, 0.8, 0.12, 0.13] diff --git a/src/services/terms.service.ts b/src/services/terms.service.ts index c9c3061a95372e312e8dffa58493fd61164a002c..15ea3c667e2ca4e0c467fb9d4862eff7cb2ae2b6 100644 --- a/src/services/terms.service.ts +++ b/src/services/terms.service.ts @@ -16,7 +16,6 @@ export default class TermsService { } /** * Gets the last term doctype - * @returns {Term} */ public async getLastTerm(): Promise<Term> { const query: QueryDefinition = Q(TERMS_DOCTYPE) @@ -30,10 +29,7 @@ export default class TermsService { return terms } - /** - * Checks if the last term has been accepted by user - * @returns {boolean} - */ + /** Checks if the last term has been accepted by user */ public async isLastTermValidated(): Promise<boolean> { const query: QueryDefinition = Q(TERMS_DOCTYPE) .where({}) @@ -46,10 +42,7 @@ export default class TermsService { if (terms?.accepted) return true else return false } - /** - * Compares the version number in the last term with the current app CGU version in the manifest - * @returns {boolean} - */ + /** Compares the version number in the last term with the current app CGU version in the manifest */ public async isConsentVersionUpToDate(): Promise<boolean> { const lastTerm = await this.getLastTerm() if (lastTerm && lastTerm.version === config.termsVersion) return true @@ -73,8 +66,6 @@ export default class TermsService { /** * Creates a new term - * @param newTerm - * @returns */ public async createTerm(): Promise<Term | null> { try { diff --git a/src/services/usageEvent.service.ts b/src/services/usageEvent.service.ts index 7b396168c1b864e783a9913997ebdd0f596a4ac4..f81eaa4f5e9ff43426114fdfd7136d52765aa250 100644 --- a/src/services/usageEvent.service.ts +++ b/src/services/usageEvent.service.ts @@ -22,9 +22,6 @@ const logStack = logger.namespace('usageEventService') export default class UsageEventService { /** - * addEvent - * @param {Client} client - * @param {AddEventParams} params * @returns {Promise<UsageEvent>} usageEvent added */ static async addEvent( @@ -49,9 +46,6 @@ export default class UsageEventService { } /** - * addEvent - * @param {Client} client - * @param {AddEventParams} params * @returns {Promise<UsageEvent>} usageEvent added */ static async addEventIfDoesntExist( @@ -66,12 +60,6 @@ export default class UsageEventService { return null } - /** - * - * @param {Client} client - * @param {string} konnectorSlug - * @returns - */ static async updateConnectionAttemptEvent( client: Client, konnectorSlug: string @@ -111,9 +99,6 @@ export default class UsageEventService { } /** - * updateUsageEventsAggregated - * @param {Client} client - * @param {string[]} ids * @returns {Promise<boolean>} return true if all events are updated */ static async updateUsageEventsAggregated( @@ -140,9 +125,6 @@ export default class UsageEventService { } /** - * getEvents - * @param {Client} client - * @param {MongoSelector} filterParams * @returns {Promise<UsageEvent[]>} usageEvent added */ static async getEvents( @@ -165,8 +147,6 @@ export default class UsageEventService { /** * Retrieve UsageEvent from the UsageEventEntity - * @param {UsageEventEntity} usageEventEntity - * @returns {UsageEvent} */ static parseUsageEventEntityToUsageEvent( usageEventEntity: UsageEventEntity diff --git a/src/targets/services/aggregatorUsageEvents.ts b/src/targets/services/aggregatorUsageEvents.ts index 6bf0bda5d7d83543edd461f59db26f3770996e8c..d3933425f086cca1229c6caa4b913d9868a072b5 100644 --- a/src/targets/services/aggregatorUsageEvents.ts +++ b/src/targets/services/aggregatorUsageEvents.ts @@ -375,7 +375,6 @@ const calculateConnectedKonnectorPerDay = async (client: Client) => { /** * Build indicator group string with handling of : ECS, heating for gas and electricity. - * * @param client Client * @param fluidType FluidType * @returns Promise<string> @@ -483,8 +482,7 @@ const getConsumptionValue = async ( /** * Send an indicator on the consumption variation in % for each fluid type. - * @param client - * @group [{ slug }, { seniority (in month) }, { profile (ECS, chauffage, etc...) }], + * @description [{ slug }, { seniority (in month) }, { profile (ECS, chauffage, etc...) }], */ const calculateConsumptionVariation = async (client: Client) => { logStack('info', `calculateConsumptionVariation`) @@ -540,7 +538,7 @@ const calculateConsumptionVariation = async (client: Client) => { }, } - // if user wasnt connected during current month, dont send indicator + // if user wasn't connected during current month, dont send indicator const events: UsageEvent[] = await UsageEventService.getEvents(client, { eventDate: { $lt: DateTime.local() diff --git a/src/targets/services/enedisHalfHourMonthlyAnalysis.ts b/src/targets/services/enedisHalfHourMonthlyAnalysis.ts index 638660c6192c462cc47ca99e7c65e0867c85b46d..28c355598e3583ffda5b4d9a4952763d6be3365f 100644 --- a/src/targets/services/enedisHalfHourMonthlyAnalysis.ts +++ b/src/targets/services/enedisHalfHourMonthlyAnalysis.ts @@ -22,30 +22,20 @@ interface EnedisMonthlyProps { /** * Gets the minimum consumption value in a month - * @param weekEndValuesArray - * @param weekValuesArray - * @returns number */ const getMinMonthlyLoad = ( weekEndValuesArray: number[][], weekValuesArray: number[][], - numberofDaysInMonth: number + numberOfDaysInMonth: number ): number => { const totalArray = union(...weekEndValuesArray, ...weekValuesArray) const filteredTotal = totalArray.filter(val => val !== -1 && val !== 0) const talonCons = Math.min(...filteredTotal) - const minCons = talonCons * 48 * numberofDaysInMonth + const minCons = talonCons * 48 * numberOfDaysInMonth logStack('info', `Minimum value is ${minCons} `) return minCons } -/** - * - * @param monthlyArray - * @param dataChart - * @param isWeekend - * @returns - */ const populateArrayWithTotalData = ( monthlyArray: number[][], dataChart: Datachart, @@ -75,13 +65,7 @@ const populateArrayWithTotalData = ( }) } } -/** - * Gets max Power value for a given month - * @param month - * @param year - * @param client - * @returns - */ +/** Gets max Power value for a given month */ const getMonthMaxPower = async ( month: number, year: number, @@ -100,10 +84,6 @@ const getMonthMaxPower = async ( } /** * Get the average arrays of half-hour value on a given month - * @param client - * @param month - * @param year - * @returns {Promise<MonthlyAveragesLoads>} */ const getEnedisMonthAnalysisData = async ( client: Client, @@ -185,8 +165,6 @@ const getEnedisMonthAnalysisData = async ( /** * Synchronize enedis monthly analysis with database depending on if the service has already ran * and if the enedis minute tracking has been activated - * @param {Client} client - * @returns */ const syncEnedisMonthlyAnalysisDataDoctype = async ({ client, diff --git a/src/targets/services/fluidsPrices.ts b/src/targets/services/fluidsPrices.ts index 8bdfe52b45192366a8e2ce30593efcf693e1ae46..b409061ac560da135c2ef078877bbbc06ad636ae 100644 --- a/src/targets/services/fluidsPrices.ts +++ b/src/targets/services/fluidsPrices.ts @@ -39,8 +39,6 @@ const getRemotePricesByFluid = async ( /** * Synchro the remote prices with database and returns a date where we have to relaunch aggregation if a price has been edited in backoffice - * @param {Client} client - * @param {FluidType} fluidType * @returns {string | null} the oldest startDate */ const synchroPricesToUpdate = async ( diff --git a/src/targets/services/monthlyReportNotification.ts b/src/targets/services/monthlyReportNotification.ts index 352409998792203d32915267c3f07eea9d8dbd86..56739fa60d69891cec9f5b2d69360ea8a5d196c7 100644 --- a/src/targets/services/monthlyReportNotification.ts +++ b/src/targets/services/monthlyReportNotification.ts @@ -23,7 +23,6 @@ interface MonthlyReportNotificationProps { /** * Get consumption value for all fluid if exist - * @param client * @param fluidType - FluidType */ const getConsumptionValue = async ( @@ -55,8 +54,6 @@ const getConsumptionValue = async ( /** * Build consumption text to attach in email. According to client consumption, display electricity and/or gaz and/or water - * @param client - * @returns string */ const buildComparisonText = async ( client: Client, diff --git a/src/types/cozy-client.d.ts b/src/types/cozy-client.d.ts index c6784da3d6c2f5140852b3acb7907fd0e4f44926..8a7d20f28601fcd335b7b332c50fbed2fe9c0795 100644 --- a/src/types/cozy-client.d.ts +++ b/src/types/cozy-client.d.ts @@ -1,3 +1,4 @@ +/* eslint-disable jsdoc/no-undefined-types */ import { RealtimePlugin, TRealtimePlugin } from 'cozy-realtime' import * as CozyStackClient from 'cozy-stack-client' import { TDoctype } from 'doctypes' @@ -6,6 +7,7 @@ import { Relation } from 'models' declare module 'cozy-client' { /** * @typedef {object} HydratedDocument + * @property {unknown} client client */ export const CozyProvider: React.FC<{ client: Client; store?: any }> @@ -109,7 +111,6 @@ declare module 'cozy-client' { * `pluginName` that will be use as the key in the `plugins` object. * * Two plugins with the same `pluginName` cannot co-exist. - * * @example * ``` * class AlertPlugin { @@ -154,12 +155,10 @@ declare module 'cozy-client' { * * - "beforeLogin" at the beginning, before links have been set up * - "login" when the client is fully logged in and links have been set up - * * @param {object} options - Options * @param {string} options.token - If passed, the token is set on the client * @param {string} options.uri - If passed, the uri is set on the client * @returns {Promise} - Resolves when all links have been setup and client is fully logged in - * */ login(options: ClientLogin): Promise<unknown> @@ -170,7 +169,6 @@ declare module 'cozy-client' { * * - "beforeLogout" at the beginning, before links have been reset * - "login" when the client is fully logged out and links have been reset - * * @returns {Promise} - Resolves when all links have been reset and client is fully logged out */ logout(): Promise<unknown> @@ -178,7 +176,6 @@ declare module 'cozy-client' { /** * Forwards to a stack client instance and returns * a [DocumentCollection]{@link https://docs.cozy.io/en/cozy-client/api/cozy-stack-client/#DocumentCollection} instance. - * * @param {string} doctype - The collection doctype. * @returns {CozyStackClient.DocumentCollection} - Collection corresponding to the doctype */ @@ -186,7 +183,6 @@ declare module 'cozy-client' { /** * Fetches an endpoint in an authorized way. - * * @param {string} method The HTTP method. * @param {string} path The URI. * @param {object} body The payload. @@ -213,9 +209,8 @@ declare module 'cozy-client' { * Saves multiple documents in one batch * - Can only be called with documents from the same doctype * - Does not support automatic creation of references - * * @param {CozyClientDocument[]} docs - * @param {Object} mutationOptions + * @param {object} mutationOptions * @returns {Promise<void>} */ saveAll(docs: D[], mutationOptions?: any): Promise<QueryResult<T, I>> @@ -227,12 +222,11 @@ declare module 'cozy-client' { * const baseDoc = { _type: 'io.cozy.todo', label: 'Go hiking' } * // relations can be arrays or single objects * const relationships = { - * attachments: [{ _id: 12345, _type: 'io.cozy.files' }, { _id: 6789, _type: 'io.cozy.files' }], - * bills: { _id: 9999, _type: 'io.cozy.bills' } + * attachments: [{ _id: 12345, _type: 'io.cozy.files' }, { _id: 6789, _type: 'io.cozy.files' }], + * bills: { _id: 9999, _type: 'io.cozy.bills' } * } * client.getDocumentSavePlan(baseDoc, relationships) * ``` - * * @param {object} document The base document to create * @param {object} relationships The list of relationships to add, as a dictionnary. Keys should be relationship names and values the documents to link. * @returns {Mutation[]} One or more mutation to execute @@ -242,7 +236,6 @@ declare module 'cozy-client' { /** * Destroys a document. {before,after}:destroy hooks will be fired. - * * @param {Document} document - Document to be deleted * @returns {Document} The document that has been deleted */ @@ -259,7 +252,6 @@ declare module 'cozy-client' { * Results from the query will be saved internally and can be retrieved via * `getQueryFromState` or directly using `<Query />`. `<Query />` automatically * executes its query when mounted if no fetch policy has been indicated. - * * @param {QueryDefinition} queryDefinition - Definition that will be executed * @param {string} options - Options * @param {string} options.as - Names the query so it can be reused (by multiple components for example) @@ -275,8 +267,7 @@ declare module 'cozy-client' { * Will fetch all documents for a `queryDefinition`, automatically fetching more * documents if the total of documents is superior to the pagination limit. Can * result in a lot of network requests. - * - * @param {QueryDefinition} queryDefinition - Definition to be executed + * @param queryDefinition - Definition to be executed * @param {object} options - Options to the query * @returns {Array} All documents matching the query */ @@ -302,7 +293,6 @@ declare module 'cozy-client' { * Returns documents with their relationships resolved according to their schema. * If related documents are not in the store, they will not be fetched automatically. * Instead, the relationships will have null documents. - * * @param {string} doctype - Doctype of the documents being hydrated * @param {Array<Document>} documents - Documents to be hydrated * @returns {Array<HydratedDocument>} @@ -317,9 +307,8 @@ declare module 'cozy-client' { * * The original document is kept in the target attribute of * the relationship - * * @param {Document} document for which relationships must be resolved - * @param {Schema} schemaArg for the document doctype + * @param {TDoctype} schemaArg for the document doctype * @returns {HydratedDocument} */ hydrateDocument<D>(document: D, schemaArg?: TDoctype): HydratedDocument @@ -339,7 +328,6 @@ declare module 'cozy-client' { export class HasMany { /** * Sets a relationship item with the relationship name and id - * * @param {object} doc - Document to be updated * @param {string} relName - Name of the relationship * @param {string} relItemId - Id of the relationship item @@ -354,7 +342,6 @@ declare module 'cozy-client' { /** * Gets a relationship item with the relationship name and id - * * @param {object} doc - Document to be updated * @param {string} relName - Name of the relationship * @param {string} relItemId - Id of the relationship item @@ -363,7 +350,6 @@ declare module 'cozy-client' { /** * Updates a relationship item with the relationship name and id - * * @param {object} doc - Document to be updated * @param {string} relName - Name of the relationship * @param {string} relItemId - Id of the relationship item diff --git a/src/utils/duration.ts b/src/utils/duration.ts index adaadaf1428e2cc609331a2178704054a2ea76c2..00b5555a55e7cec20d863c94810f89ac1abca1a8 100644 --- a/src/utils/duration.ts +++ b/src/utils/duration.ts @@ -4,7 +4,7 @@ import logApp from './logger' * Logs the time spend and add "in xx ms" * @param {string} scope string Migration | Initialization | ... * @param startTime number raw duration in ms - * @output [Scope] Finished in XXX ms + * @description [Scope] Finished in XXX ms * @example * logDuration("[Migration] Finished", 764745674); // [Migration] Finished in 685 ms */ diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 7dfa903ed2156513f572c5f30da49107d37ae5ce..748166f31c588baca762f5c70ff252ac1900555e 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -35,7 +35,8 @@ export function getKonnectorSlug(fluidType: FluidType) { throw new Error('unknown fluidtype') } } -/** Return lowercase fluidtype +/** + * Return lowercase fluidtype * @example FluidType.ELECTRICITY => 'electricity' */ export function getFluidName(fluidType: FluidType) { @@ -120,7 +121,7 @@ export function getRelationshipHasMany<D>(doc: D, relName: string): Relation[] { /** * Get many relations in doc * @param {object} doc - DocumentEntity - * @param {Array<[relName: string]: Array<Relation>>} relNameList - Array of name of the relations + * @param relNameList - Array of name of the relations */ export function getRelationships<D>( doc: D, @@ -133,8 +134,6 @@ export function getRelationships<D>( /** * Import a svg file with format : id.svg - * @param id - * @param pathType */ export const importIconById = async ( id: string, @@ -175,7 +174,7 @@ export const getMonthFullName = (month: number) => { /** * Return month string according to month index - * @Note Equivalent to date.monthLong + * @variation Equivalent to date.monthLong * @param date - DateTime * @returns month in french */ @@ -297,7 +296,6 @@ export const getTodayDate = () => /** * Formats an array of strings into a list with commas and an "et" (and) before the last element. - * * @param {string[]} array - The array of strings to be formatted. * @returns {string} The formatted list string. * @@ -306,7 +304,6 @@ export const getTodayDate = () => * If the array has two elements, they are joined with " et " (and). * If the array has more than two elements, all but the last element are joined with commas, * and " et " (and) is placed before the last element. - * * @example * // Returns "pomme, banane et cerise" * formatListWithAnd(['pomme', 'banane', 'cerise']); diff --git a/yarn.lock b/yarn.lock index fa4b819ca721cf26e2e22ef281ed6ae0fcca4d40..2616ea33eb3c11f95fa1c0d1bab60128a005969b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1674,6 +1674,15 @@ resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46" integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA== +"@es-joy/jsdoccomment@~0.40.1": + version "0.40.1" + resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.40.1.tgz#13acd77fb372ed1c83b7355edd865a3b370c9ec4" + integrity sha512-YORCdZSusAlBrFpZ77pJjc5r1bQs5caPWtAu+WWmiSo+8XaUzseapVrfAtiRFbQWnrBxxLLEwF6f6ZG/UgCQCg== + dependencies: + comment-parser "1.4.0" + esquery "^1.5.0" + jsdoc-type-pratt-parser "~4.0.0" + "@eslint-community/eslint-utils@^4.2.0": version "4.3.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.3.0.tgz#a556790523a351b4e47e9d385f47265eaaf9780a" @@ -3665,6 +3674,11 @@ aproba@^1.1.1: resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== +are-docs-informative@^0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/are-docs-informative/-/are-docs-informative-0.0.2.tgz#387f0e93f5d45280373d387a59d34c96db321963" + integrity sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig== + argparse@^1.0.10, argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -4552,6 +4566,11 @@ buffer@^5.5.0: base64-js "^1.3.1" ieee754 "^1.1.13" +builtin-modules@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6" + integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw== + builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" @@ -5262,6 +5281,11 @@ commander@^9.3.0: resolved "https://registry.yarnpkg.com/commander/-/commander-9.3.0.tgz#f619114a5a2d2054e0d9ff1b31d5ccf89255e26b" integrity sha512-hv95iU5uXPbK83mjrJKuZyFM/LBAoCV/XhVGkS5Je6tl7sxr6A0ITMw5WoRV46/UaJ46Nllm3Xt7IaJhXTIkzw== +comment-parser@1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-1.4.0.tgz#0f8c560f59698193854f12884c20c0e39a26d32c" + integrity sha512-QLyTNiZ2KDOibvFPlZ6ZngVsZ/0gYnE6uTXi5aoDg8ed3AkJAz4sEje3Y8a29hQ1s6A99MZXe47fLAXQ1rTqaw== + common-tags@^1.4.0: version "1.8.2" resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6" @@ -7558,6 +7582,21 @@ eslint-plugin-jest@^27.2.3: dependencies: "@typescript-eslint/utils" "^5.10.0" +eslint-plugin-jsdoc@^46.8.2: + version "46.8.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-46.8.2.tgz#3e6b1c93e91e38fe01874d45da121b56393c54a5" + integrity sha512-5TSnD018f3tUJNne4s4gDWQflbsgOycIKEUBoCLn6XtBMgNHxQFmV8vVxUtiPxAQq8lrX85OaSG/2gnctxw9uQ== + dependencies: + "@es-joy/jsdoccomment" "~0.40.1" + are-docs-informative "^0.0.2" + comment-parser "1.4.0" + debug "^4.3.4" + escape-string-regexp "^4.0.0" + esquery "^1.5.0" + is-builtin-module "^3.2.1" + semver "^7.5.4" + spdx-expression-parse "^3.0.1" + eslint-plugin-prettier@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.2.tgz#432e5a667666ab84ce72f945c72f77d996a5c9ba" @@ -7958,7 +7997,7 @@ esquery@^1.0.1, esquery@^1.4.0: dependencies: estraverse "^5.1.0" -esquery@^1.4.2: +esquery@^1.4.2, esquery@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== @@ -9814,6 +9853,13 @@ is-buffer@^1.1.4, is-buffer@^1.1.5, is-buffer@~1.1.6: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== +is-builtin-module@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.1.tgz#f03271717d8654cfcaf07ab0463faa3571581169" + integrity sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A== + dependencies: + builtin-modules "^3.3.0" + is-callable@^1.1.3, is-callable@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" @@ -10760,6 +10806,11 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== +jsdoc-type-pratt-parser@~4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz#136f0571a99c184d84ec84662c45c29ceff71114" + integrity sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ== + jsdom@^16.2.1, jsdom@^16.4.0: version "16.7.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.7.0.tgz#918ae71965424b197c819f8183a754e18977b710" @@ -15162,6 +15213,13 @@ semver@^7.1.1, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semve dependencies: lru-cache "^6.0.0" +semver@^7.5.4: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + send@0.18.0: version "0.18.0" resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" @@ -15528,7 +15586,7 @@ spdx-exceptions@^2.1.0: resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== -spdx-expression-parse@^3.0.0: +spdx-expression-parse@^3.0.0, spdx-expression-parse@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==