Lightly applies ESLint to OZTreeModule and removes demonstrably unused imports and straightforward unused variables - #1017
Conversation
|
This is a very worthwhile cleanup, but I'd rather that the unused imports were found by a linting tool, eslint / xo or similar. As well as having a bit more confidence in their work, it'd be something we can plug into the CI pipeline to stop unused imports cropping up in future. OneZoom's code style is somewhat free range, so we'd have to have a very minimal set of rules at least to start with. |
…d-imports Merge lint configuration into unused import removal branch Planning to clean up code next for a clean lint analysis of this module.
Removed import flagged by eslint.
Removed import flagged by eslint.
Added import for capitalizeFirstLetter utility function.
import {capitalizeFirstLetter, max} from '../util/index';
Removed import flagged by eslint as unused.
Removed import flagged by eslint as unused.
Removed import flagged by eslint as unused.
Removed import flagged by eslint as unused.
…r-preserving. Some previously unused variables were retained because they improved the clarity of test setup or context. In those cases, the tests were expanded slightly to verify the associated state, making those variables part of the test assertions. The remaining no-unused-vars findings were intentionally left unchanged because they appear to represent design decisions (for example, complete theme palettes or interface methods) rather than accidental dead code. Whether to remove, suppress, or retain those findings is a project policy decision rather than a mechanical cleanup and is outside the scope of this task. The remaining no-unused-vars findings are not enforced by the existing development workflow. ESLint is not part of the build, test, or CI processes.
ESLint, removed unused variables, removed unused imports.
|
Remaining unused variables found in OZTreeModule: npx eslint OZprivate/rawJS/OZTreeModule src/factory/garbage_collection.js src/factory/polytomy_midnode.js src/themes/IUCN_explicit_colour_blind_friendly.js src/themes/IUCN_explicit_theme.js src/themes/genetic_conservation_theme.js src/themes/natural_theme.js src/themes/popularity_colour_blind_friendly.js src/themes/popularity_theme.js |
|
Thanks! After a quick look through I can't remember any gotchas about the lines in question, I think it's all just excessive copy-paste. Is there a reason you left the final unused variables, or just run out of time? I'll have a bit more of a test then merge later in the week. Will have a look the final cases too in your comment. |
Lightly applies ESLint to OZTreeModule and removes demonstrably unused imports and straightforward unused variables
The changes are intentionally conservative:
Some remaining no-unused-vars findings were intentionally left unchanged because they require project-level judgment (for example, complete theme palettes or interface methods) rather than mechanical cleanup. Whether those should be removed, suppressed, or retained is outside the scope of this PR.
Removing stale imports and straightforward unused variables makes module dependency declarations more accurately reflect the code they use and reduces maintenance noise.
ESLint is not part of build, test, or CI processes.
To run:
npx eslint OZprivate/rawJS/OZTreeModuleThe full test suite passes after these changes.