-
Notifications
You must be signed in to change notification settings - Fork 905
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
Fix many small lints #996
Fix many small lints #996
Conversation
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.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
eslint
examples/javascript/ImageClassification/ImageClassification_Video_Load/sketch.js|36 col 38| 'classifier' is already declared in the upper scope. no-shadow
examples/javascript/ImageClassification/ImageClassification_Video/sketch.js|23 col 5| 'result' is not defined. no-undef
examples/javascript/ImageClassification/ImageClassification_Video/sketch.js|24 col 5| 'probability' is not defined. no-undef
examples/javascript/Pix2Pix/Pix2Pix_promise/sketch.js|16 col 1| Split 'let' declarations into multiple statements. one-var
examples/javascript/Pix2Pix/Pix2Pix_promise/sketch.js|16 col 51| 'pix2pix' is defined but never used. Allowed unused vars must match /^setup$|^draw$|^preload$/. no-unused-vars
examples/javascript/Pix2Pix/Pix2Pix_promise/sketch.js|98 col 43| Unexpected unnamed function. func-names
examples/javascript/PoseNet/PoseNet_part_selection/sketch.js|58 col 11| Use object destructuring. prefer-destructuring
examples/javascript/PoseNet/PoseNet_part_selection/sketch.js|66 col 11| Use object destructuring. prefer-destructuring
examples/javascript/PoseNet/PoseNet_part_selection/sketch.js|74 col 11| Use object destructuring. prefer-destructuring
examples/javascript/UNET/UNET_webcam/sketch.js|69 col 9| 'canvas' is already declared in the upper scope. no-shadow
examples/javascript/UNET/UNET_webcam/sketch.js|70 col 9| 'ctx' is already declared in the upper scope. no-shadow
examples/p5js/FaceApi/FaceApi_Image_Landmarks/sketch.js|47 col 18| 'detections' is already declared in the upper scope. no-shadow
examples/p5js/FaceApi/FaceApi_Image_Landmarks/sketch.js|56 col 24| 'detections' is already declared in the upper scope. no-shadow
examples/p5js/FaceApi/FaceApi_Video_Landmarks_LocalModels/sketch.js|53 col 18| 'detections' is already declared in the upper scope. no-shadow
examples/p5js/FaceApi/FaceApi_Video_Landmarks_LocalModels/sketch.js|68 col 24| 'detections' is already declared in the upper scope. no-shadow
examples/p5js/FaceApi/FaceApi_Video_Landmarks_LocalModels/sketch.js|74 col 11| Use object destructuring. prefer-destructuring
examples/p5js/ImageClassification/ImageClassification_MultipleImages/sketch.js|34 col 38| 'imgPath' is not defined. no-undef
examples/p5js/NeuralNetwork/NeuralNetwork_basics/sketch.js|27 col 25| Unexpected unnamed function. func-names
examples/p5js/NeuralNetwork/NeuralNetwork_basics/sketch.js|34 col 27| Unexpected unnamed function. func-names
examples/p5js/NeuralNetwork/NeuralNetwork_basics/sketch.js|41 col 24| Unexpected unnamed function. func-names
examples/p5js/NeuralNetwork/NeuralNetwork_basics/sketch.js|48 col 29| Unexpected unnamed function. func-names
examples/p5js/NeuralNetwork/NeuralNetwork_basics/sketch.js|49 col 33| Unexpected unnamed function. func-names
examples/p5js/NeuralNetwork/NeuralNetwork_basics/sketch.js|56 col 19| Unexpected unnamed function. func-names
examples/p5js/NeuralNetwork/NeuralNetwork_basics/sketch.js|57 col 32| Unexpected unnamed function. func-names
examples/p5js/NeuralNetwork/NeuralNetwork_Interactive_Regression/sketch.js|87 col 9| 'y' is not defined. no-undef
examples/p5js/NeuralNetwork/NeuroEvolution_FlappyBird/ga.js|40 col 10| 'savedBirds' is not defined. no-undef
examples/p5js/PoseNet/PoseNet_part_selection/sketch.js|49 col 11| Use object destructuring. prefer-destructuring
examples/p5js/PoseNet/PoseNet_part_selection/sketch.js|54 col 11| Use object destructuring. prefer-destructuring
examples/p5js/PoseNet/PoseNet_part_selection/sketch.js|59 col 11| Use object destructuring. prefer-destructuring
scripts/batch-update-p5webeditor.js|222 col 63| 'idx' is defined but never used. no-unused-vars
src/KMeans/index_test.js|6 col 20| 'ml5' is not defined. no-undef
} | ||
|
||
// call app.map.init() once the DOM is loaded | ||
window.addEventListener('DOMContentLoaded', function() { | ||
window.addEventListener("DOMContentLoaded", function() { |
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.
[eslint] reported by reviewdog 🐶
Unexpected unnamed function. func-names
img = new ImageData(result.raw, 64, 64) | ||
const canvasElement = document.createElement("canvas"); | ||
canvasElement.width = 64; | ||
img = new ImageData(result.raw, 64, 64); |
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.
canvasElement.height = 64; | ||
canvasElement_ctx = canvasElement.getContext('2d'); | ||
canvasElement_ctx.putImageData(img, 0, 0); | ||
canvasElementCtx = canvasElement.getContext("2d"); |
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.
canvasElement_ctx = canvasElement.getContext('2d'); | ||
canvasElement_ctx.putImageData(img, 0, 0); | ||
canvasElementCtx = canvasElement.getContext("2d"); | ||
canvasElementCtx.putImageData(img, 0, 0); |
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.
canvasElement_ctx = canvasElement.getContext('2d'); | ||
canvasElement_ctx.putImageData(img, 0, 0); | ||
canvasElementCtx = canvasElement.getContext("2d"); | ||
canvasElementCtx.putImageData(img, 0, 0); |
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.
canvas = document.querySelector('#myCanvas'); | ||
ctx = canvas.getContext('2d'); | ||
canvas = document.querySelector("#myCanvas"); | ||
ctx = canvas.getContext("2d"); |
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.
function appendImages(arr) { | ||
const output = []; | ||
for (i = 0; i < arr.length; i += 1) { | ||
imgPath = arr[i]; | ||
output.push('images/dataset/' + imgPath); | ||
output.push(`images/dataset/${imgPath}`); |
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.
@@ -56,49 +50,44 @@ async function loadImage(imgPath, idx) { | |||
const imgEl = new Image(); | |||
imgEl.src = imgPath; | |||
|
|||
imgEl.onload = async function () { | |||
imgEl.onload = async function() { |
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.
[eslint] reported by reviewdog 🐶
Unexpected unnamed async function. func-names
}; | ||
download(JSON.stringify(predictionsJSON), 'json.txt', 'text/plain'); | ||
} No newline at end of file |
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.
video.play(); | ||
}); | ||
|
||
const loop = classifier => { |
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.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
eslint
scripts/batch-update-p5webeditor.js|222 col 63| 'idx' is defined but never used. no-unused-vars
}; | ||
download(JSON.stringify(predictionsJSON), 'json.txt', 'text/plain'); | ||
} No newline at end of file |
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.
loop(classifier) // Call again to create a loop | ||
} | ||
}) | ||
} No newline at end of file |
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.
|
||
const loop = classifier => { | ||
classifier.classify().then(results => { | ||
result.innerText = results[0].label; |
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.
const loop = classifier => { | ||
classifier.classify().then(results => { | ||
result.innerText = results[0].label; | ||
probability.innerText = results[0].confidence.toFixed(4); |
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.
@@ -13,7 +13,7 @@ For more models see: https://github.com/ml5js/ml5-data-and-training/tree/master/ | |||
// The pre-trained Edges2Pikachu model is trained on 256x256 images | |||
// So the input images can only be 256x256 or 512x512, or multiple of 256 | |||
const SIZE = 256; | |||
let inputImg, canvas, outputContainer, statusMsg, pix2pix, clearBtn, transferBtn, modelReady = false, isTransfering = false; | |||
let inputImg, canvas, outputContainer, statusMsg, pix2pix, clearBtn, transferBtn; |
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.
@@ -83,7 +84,7 @@ function doneTraining() { | |||
console.log(results); | |||
for (let i = 0; i < results.length; i += 1) { | |||
x = xMany[i][0]; | |||
y = results[i][0]["value"]; | |||
y = results[i][0].value; |
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.
@@ -37,7 +37,7 @@ function pickOne() { | |||
let index = 0; | |||
let r = random(1); | |||
while (r > 0) { | |||
r = r - savedBirds[index].fitness; | |||
r -= savedBirds[index].fitness; |
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.
@@ -46,17 +46,17 @@ function draw() { | |||
|
|||
// Create a pink ellipse for the nose | |||
fill(213, 0, 143); | |||
const nose = pose['nose']; | |||
const nose = pose.nose; |
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.
[eslint] reported by reviewdog 🐶
Use object destructuring. prefer-destructuring
ellipse(nose.x, nose.y, 20, 20); | ||
|
||
// Create a yellow ellipse for the right eye | ||
fill(255, 215, 0); | ||
const rightEye = pose['rightEye']; | ||
const rightEye = pose.rightEye; |
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.
[eslint] reported by reviewdog 🐶
Use object destructuring. prefer-destructuring
ellipse(rightEye.x, rightEye.y, 20, 20); | ||
|
||
// Create a yellow ellipse for the right eye | ||
fill(255, 215, 0); | ||
const leftEye = pose['leftEye']; | ||
const leftEye = pose.leftEye; |
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.
[eslint] reported by reviewdog 🐶
Use object destructuring. prefer-destructuring
Merged! Thank you! NOTE: the object detector tests seem to be failing basically every PR. I'll try to figure this out this week. Sorry about this! |
This PR fixes a bunch of smaller/less-involved lint errors, as well as adds a few more lint errors to ignore in the
eslintrc.js
file. There are also lots of autoformatted Prettier changes for the files that I manually touched.After merging the remaining PRs on lint, I think we'll be low enough on lint errors to start handling them on a more case-by-case basis in the files we touch.