console
in code that runs on browser JS-0002204 console.log("Document successfully deleted!");
205 updateRecords();
206 }).catch((error) => {
207 console.error("Error removing document: ", error);208 alert(error);
209 });
210}
201
202function deleteRecord(id){
203 colRecords.doc(id).delete().then(() => {
204 console.log("Document successfully deleted!");205 updateRecords();
206 }).catch((error) => {
207 console.error("Error removing document: ", error);
193//ela
194function clearTable(name){
195 let table = getElementById(name);
196 console.log(table.tBodies.length);197
198 if(table.tBodies.length>0)
199 table.tBodies[0].innerHTML = '';
159 clearTable("recordTable");
160 colRecords.get().then((querySnapshot) => {
161 querySnapshot.forEach((doc) => {
162 console.log(doc.id, " => ", doc.data());163 addRecord(
164 doc.id,
165 doc.data().dateAndTime,
151 document.getElementById("updateForm").reset();
152 updateRecords();
153 }).catch((e)=>{
154 console.log(" upload error", e);155 });
156});
157
It is considered a best practice to avoid the use of any console
methods in JavaScript code that will run on the browser.
NOTE: If your repository contains a server side project, you can add "nodejs"
to the environment
property of analyzer meta in .deepsource.toml
.
This will prevent this issue from getting raised.
Documentation for the analyzer meta can be found here.
Alternatively, you can silence this issue for your repository as shown here.
If a specific console
call is meant to stay for other reasons, you can add a skipcq comment to that line.
This will inform other developers about the reason behind the log's presence, and prevent DeepSource from flagging it.
Usually, console
methods are only used for debugging, and can leak internal info to the client.
Removing the console
call will fix this issue.
if (!secure(data)) {
console.log("data is not secure", data) // `data` is visible to the client
}
console.table(tableObj)
if (!secure(data)) {
// alter the DOM to inform the user that `data` is insecure.
}
console.table(tableObj) // skipcq: JS-0002 Easter egg. Users are meant to see this.