-
-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding ESLint to the project and solving the ESLint Errors #297
Conversation
…intersect.js file
…-data-polyfill.js file
Thanks for opening this. However, can you please switch this to a draft until the actual linting errors are fixed? Adding eslint doesn't make sense if we just litter the code with |
I am still working on it. |
Yes, no problem ! |
Hey @lovasoa |
It looks like the pr introduces functional changes. We don't want to leave commented-out code. |
So, Do you want me to remove the comments right? |
You commented-out code. Either you made sure this code was not used, and you can remove it (and comment here about it) or it was actually used, and it should stay. And we don't want to keep the eslint-disable-next-line... |
Hey, I have remove all the lines which has eslint-disable-next-line and commented codes.
|
server/log.js
Outdated
throw new Error("Invalid statsd connection string, doesn't match " + regex); | ||
} | ||
// eslint-disable-next-line no-unused-vars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check my latest commit
server/check_output_directory.js
Outdated
@@ -14,7 +14,8 @@ async function get_error(directory) { | |||
return "does not exist"; | |||
} | |||
if (!fs.statSync(directory).isDirectory()) { | |||
error = "exists, but is not a directory"; | |||
// error = "exists, but is not a directory"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's avoid leaving commented-out code
server/check_output_directory.js
Outdated
return err_msg; | ||
console.log(err_msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow! This changes the behavior !
Please avoid introducing changes like that before discussing them !
If you do feel some behavior change is required, let's discuss it together first, and add tests for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For above I am getting lint error: Unsafe usage of ReturnStatement.
Explaination:
In JavaScript, using return
in a finally
block can lead to unexpected behavior, and it's generally considered unsafe. The finally
block is designed for code that should be executed regardless of whether an exception is thrown or caught. Placing a return
statement in a finally block can interfere with the intended flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you cannot just remove the return statement. This changes the behavior of the function. In this case, the return was intended. You can refactor it, but not change the behavior. Even less when you are not adding tests.
server/sockets.js
Outdated
if (config.AUTH_SECRET_KEY) { | ||
// Middleware to check for valid jwt | ||
io.use(function (socket, next) { | ||
if (socket.handshake.query && socket.handshake.query.token) { | ||
jsonwebtoken.verify( | ||
socket.handshake.query.token, | ||
config.AUTH_SECRET_KEY, | ||
function (err, decoded) { | ||
if (err) | ||
// function (err, decoded) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's avoid leaving commented-out code
function generateUID(prefix, suffix) { | ||
var uid = Date.now().toString(36); //Create the uids in chronological order | ||
uid += Math.round(Math.random() * 36).toString(36); //Add a random character at the end | ||
if (prefix) uid = prefix + uid; | ||
if (suffix) uid = uid + suffix; | ||
return uid; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check my latest commit I have remove this function as this function is not used anywhere in the file and this function is created in the client-data/js/board.js file
Fixes #293
Description
This pull request addresses the issue related to setting up ESLint in the repository to improve and maintain a consistent code quality across the project. ESLint is a powerful static code analysis tool that helps identify and fix potential issues, enforcing a set of coding standards and best practices. Also, fixes some eslint error.
Changes Made