CodeWithAsheville / court-notifications

GNU General Public License v3.0
9 stars 9 forks source link

[08/03/2022]: Bad practice / Unused variables #162

Closed GKosheev closed 1 year ago

GKosheev commented 1 year ago

There are multiple places that contain a bad practice of variable declarations or/and unused variables.

Consider the following example (server.js):

/*
 Bad practice, since all "var" variables declared below are not being re-declared any further
 Also, "var" creates a global variable, making it available throughout the whole file using "this" keyword
*/
var i18next = require('i18next');
var FsBackend = require('i18next-fs-backend');
var middleware = require('i18next-http-middleware');

const { knex } = require('./util/db'); // unused variable

const MessagingResponse = require('twilio').twiml.MessagingResponse; // unused variable 

Files that have such problems:

The suggestion is to change var declaration to const (or let if the declared variable is being reassigned any further) and get rid of all unused variables.

GKosheev commented 1 year ago

I'd also add "good first issue" and "backend" labels to that issue, but I haven't found a way to do that.

ejaxon commented 1 year ago

Labels added.

Dun-sin commented 1 year ago

Hi, can I work on this? Maybe not all the files but some at least

GKosheev commented 1 year ago

Hey @Dun-sin! Sure, you can start working on it, but It'd be better to check all the files since there are not that many problems. If you struggle, I'll help.