Skip to content
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

Syntax and Logic Issues #3

Open
shuaiby18 opened this issue Aug 16, 2023 · 0 comments
Open

Syntax and Logic Issues #3

shuaiby18 opened this issue Aug 16, 2023 · 0 comments

Comments

@shuaiby18
Copy link

shuaiby18 commented Aug 16, 2023

Good afternoon!

I utilized ESLint on this project to see if I can determine any potential bugs by focusing on the js-funcs directory and the js-libs directory. I decided to exclude the three.js and three.min.js files as these are external libraries.

These are the 4 bugs that I have found in the project:

Bug 1:
Location: bird-geometry.js at 39:11
Type: error 'v' is already defined no-redeclare
Solution: To simply remove redeclaration of variable v inside the for loop

Bug 2:
Location: FirstPersonControls.js at 274:3
Type: Unnecessary semicolon no-extra-semi
Solution: Simply remove the extra semi-colon found in that line of code to ensure javascript syntax

Bug 3:
Location: KeyboardState.js at 114:3
Type: Unnecessary semicolon no-extra-semi
Solution: Simply remove the extra semi-colon found in that line of code to ensure javascript syntax

Bug 4:
Location: OrbitControls.js at 333:2
Type: Mixed spaces and tabs no-mixed-spaces-and-tabs
Solution: Simply go in and fix the error manually be making sure line breaks are proper, or you can just right click and format document for automatic fix

Also for testing purposes, I found it difficult to execute ESLint on the buffer and shader directories. The reason was because while these are .js files, they contain GLSL code inside them and make the file not legible for testing with ESLint. A suggestion is to simply extract the GLSL code inside these javascript files and place them in a .glsl file, while placing a link to these files in the original .js file.

For example for vertexshader-birds.js:

  1. Create a new file called vertexshader-birds.glsl
  2. Copy all the code inside vertexshader-birds.js and place it inside vertexshader-birds.glsl
  3. Place the following code inside vertexshaer-birds.js (it has to be the only code in that file)

const fs = require('fs');
const pathway = require('path');
const shaderPath = pathway.join(__dirname, 'vertexshader-birds.glsl');
const shaderSource = fs.readFileSync(shaderPath, 'utf8');

This seemed to solve the issue for me for testing purposes and made it much more efficient to use with ESLint. Please let me know if I can help out with any other issues. Also, I really appreciate the effort that went into this project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant