You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@themaximal1st This is awesome! Let me be the first to say here, thanks for sharing.
I enjoyed reading though the code, one thing I'd highly recommend is adding ESLint. It is super easy to add and will pickup on a ton of best practices, cleaner code and obvious errors. Here are a few examples.
Here is a sample of the eslint output for the api.js file:
\InfinityArcade\src\client\api.js
3:65 error Expected '===' and instead saw '==' eqeqeq
12:3 error Expected 'this' to be used by class async method 'fetch' class-methods-use-this
13:5 warning Unexpected console statement no-console
59:12 error Redundant use of `await` on a return value no-return-await
76:5 error iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations no-restricted-syntax
76:31 error 'yieldStreamResponse' was used before it was defined no-use-before-define
100:20 error Unexpected `await` inside a loop no-await-in-loop
131:55 error 'chat_id' is not defined no-undef
Here is how to add ESLint
Run npm init @eslint/config and pick the options. For this project I'd pick:
To check syntax, find problems, and enforce code style
CommonJS (require/exports)
None of these
No
Node
Use a popular style guide
AirBnB
Javascript
For VSCode syntax highlighting install the ESLint extension.
Add this to the package.json file then you can run npm run lint to check and fix all your files in one go.
@themaximal1st This is awesome! Let me be the first to say here, thanks for sharing.
I enjoyed reading though the code, one thing I'd highly recommend is adding ESLint. It is super easy to add and will pickup on a ton of best practices, cleaner code and obvious errors. Here are a few examples.
Here is a sample of the eslint output for the api.js file:
Here is how to add ESLint
Run
npm init @eslint/config
and pick the options. For this project I'd pick:For VSCode syntax highlighting install the ESLint extension.
Add this to the package.json file then you can run
npm run lint
to check and fix all your files in one go.If you really love some coding style, like camelcase, then you can easily adjust this in the .eslintrc.js file by adding a rule like this:
Finally, if you want VSCode to try and fix issues when the file is saved, add this to the VSCode settings file.
References
The text was updated successfully, but these errors were encountered: