File .deepsource.toml
not found in the default branch of the repository root. Please refer to the docs.
1import { useEffect, useState } from "react";
2import Pet from "./Pet"; 3const ANIMALS = ["bird", "cat", "dog", "rabbit", "reptile"];
4
5const SearchParams = () => {
1import React from "react";
2import ReactDOM from "react-dom/client";
3import "./index.css";
4import App from "./App"; 5import reportWebVitals from "./reportWebVitals";
6
7const root = ReactDOM.createRoot(document.getElementById("root"));
1import React from "react"; 2import ReactDOM from "react-dom/client";
3import "./index.css";
4import App from "./App";
1import React from "react";2
3export default function Projects() {
4 return <h1>Projects Pages</h1>;
1import React from "react";
2import Header from "../Header/Header";
3import Footer from "./Footer"; 4
5export default function Home() {
6 return (
Found variables that are declared but not used anywhere.
NOTE: In browser applications, DeepSource recommends the use of ESModules over regular
text/javascript
scripts. Currently, we don't support variables that are not explicitly exported, and are injected into other scripts by being included in an HTML file
Unused variables are most often the result of incomplete refactoring. They can lead to confusing code and minor performance hitches.
NOTE: If you have intentionally left a variable unused, we suggest you to prefix the variable name with a _
to prevent them from being flagged by DeepSource.
// Write-only variables are not considered as used.
let y = 10;
y = 5;
// A variable that modifies only itself isn't considered used.
let z = 0;
z = z + 1;
// Unused argument
(function(x) {
return 5;
})();
// Unused recursive functions also raise this issue.
function fact(n) {
if (n < 2) return 1;
return n * fact(n - 1);
}
// When a function definition destructures an array,
// unused entries from the array also cause warnings.
function getY([x, y]) {
return y;
}
let x = 10;
alert(x);
((arg1) => {
return arg1;
})();
let myFunc;
myFunc = (n) => {
// this is legal
if (n < 0) myFunc();
};
// this is also considered legal
console.log(declaredLater);
var declaredLater;
// Only the second argument from the descructured array is used.
function getY([, y]) {
return y;
}