2const { celebrate, Joi } = require('celebrate');
3const config = require('../config');
4const ProjectController = require('../controllers/project.controller');
5const SubmissionController = require('../controllers/submission.controller'); 6const { isCurrentUser, isAuth, isWorkspaceMember } = require('../middlewares');
7const { role } = require('../config');
8
3const config = require('../config');
4const ProjectController = require('../controllers/project.controller');
5const SubmissionController = require('../controllers/submission.controller');
6const { isCurrentUser, isAuth, isWorkspaceMember } = require('../middlewares'); 7const { role } = require('../config');
8
9const route = Router();
4
5const { Schema } = mongoose;
6
7const Submission = new mongoose.Schema( 8 {
9 data: Object,
10
44
45 // NOT DONE
46 async addCollaborator(req, res) {
47 const { projectID } = req.params;48 // const result = await ProjectService.addCollaborator(projectID, req.body);
49
50 // return res.json(result).status(201);
43 }
44
45 // NOT DONE
46 async addCollaborator(req, res) {47 const { projectID } = req.params;
48 // const result = await ProjectService.addCollaborator(projectID, req.body);
49
Found variables that are declared but not used anywhere.
Unused variables are most often the result of incomplete refactoring. They can lead to confusing code and minor performance hitches.
NOTE: If you have intentionally left a variable unused, we suggest you to prefix the variable name with a _
to prevent them from being flagged by DeepSource.
// Write-only variables are not considered as used.
var y = 10;
y = 5;
// A variable that modifies only itself isn't considered used.
var z = 0;
z = z + 1;
// Unused argument
(function(x) {
return 5;
})();
// Unused recursive functions also raise this issue.
function fact(n) {
if (n < 2) return 1;
return n * fact(n - 1);
}
// When a function definition destructures an array,
// unused entries from the array also cause warnings.
function getY([x, y]) {
return y;
}
var x = 10;
alert(x);
((arg1) => {
return arg1;
})();
let myFunc;
myFunc = (n) => {
// this is legal
if (n < 0) myFunc();
};
// this is also considered legal
console.log(declaredLater);
var declaredLater;
// Only the second argument from the descructured array is used.
function getY([, y]) {
return y;
}