SupportVol / BackEnd

Initialization in variable declarations against recommended approach JS-0119
Anti-pattern
Minor
5 months ago5 months old
Variable 'response' should be initialized on declaration
 1const getMembershipRequests = async (req, res) => {
 2  const showAll = req.body.all ?? false;
 3  let response; 4  if (showAll) {
 5    response = await req.membershipInstance.read();
 6  } else {
Variable 'response' should be initialized on declaration
 7const readCommunity = async (req, res) => {
 8  const showAll = req.body.all ?? false
 9  const { commInstance } = req
10  let response11  if (showAll) {
12    response = await commInstance.read()
13  } else {
Variable 'response' should be initialized on declaration
 6 */
 7const getNews = async (req, res) => {
 8  const { newsInitialization } = req
 9  let response10  if (req.body.all) {
11    response = await newsInitialization.readAll()
12  } else {
Variable 'allApiKeys' should be initialized on declaration
 1const getApiKeys = async (req, res) => {
 2  let allApiKeys 3  console.log(req.all)
 4  if (req.all) {
 5    allApiKeys = await req.apiInstance.readAll()
Variable 'i' should be initialized on declaration
 77   */
 78  async update (data) {
 79    let collectionRef = this.collection
 80    let i 81    for (i = 0; i < this.nestedPaths.length; i += 2) {
 82      if (this.nestedPaths.length > i + 1) {
 83        collectionRef = collectionRef