Files
galaxy/client/docs/unused-variables.md
T
Laila Los bbe5298998 use _ for unused variables to follow convention
move unused variables doc to separate file
2023-05-16 17:07:32 +02:00

636 B

Working with unused variables

Unused variables are marked as errors in eslint, however when destructuring objects to remove certain keys you may be left with a variable you will not use further. Prefix the unused variable with an underscore: _unused. The no-unused-vars config setting in client/.eslintrc contains "varsIgnorePattern": "_.+"} to ignore unused variables if they start with _.

Example:

const myObject = {
    name: "history",
    count: 5,
    values: ["a", "b", "c"],
};

const { values: _discarded, ...otherObject } = myObject;

console.log(otherObject); // Object { name: "history", count: 5 }