Skip to content

Add minimal ESLint setup for unused imports and duplicate imports - #1

Draft
ScaleNature with Copilot wants to merge 2 commits into
mainfrom
copilot/configure-eslint-unused-imports
Draft

Add minimal ESLint setup for unused imports and duplicate imports#1
ScaleNature with Copilot wants to merge 2 commits into
mainfrom
copilot/configure-eslint-unused-imports

Conversation

Copilot AI commented Aug 1, 2026

Copy link
Copy Markdown

This introduces a narrow ESLint configuration focused on import hygiene in the OZTreeModule codebase. It adds just enough setup to surface unused imports/variables and duplicate imports without bringing in style or general code-quality rules.

  • Minimal ESLint config

    • Adds a root .eslintrc.js
    • Enables only:
      • no-unused-vars
      • no-duplicate-imports
    • Keeps no-unused-vars scoped to the intended signal by ignoring unused function args and caught errors
  • Project compatibility

    • Uses standard ESLint parser options for the existing Babel/Webpack ES module setup
    • Avoids extra plugins or opinionated presets
    • Ignores generated/vendor paths:
      • node_modules/**
      • OZprivate/rawJS/OZTreeModule/dist/**
      • static/**
  • npm / CI integration

    • Adds eslint to devDependencies
    • Adds a dedicated lint script targeting the maintained JS sources and tests:
      • OZprivate/rawJS/OZTreeModule/src
      • OZprivate/rawJS/OZTreeModule/tests

Example of the configured rule surface:

rules: {
  'no-unused-vars': ['error', {
    args: 'none',
    caughtErrors: 'none',
  }],
  'no-duplicate-imports': 'error',
}

Copilot AI changed the title [WIP] Configure ESLint to detect unused imports Add minimal ESLint setup for unused imports and duplicate imports Aug 1, 2026
Copilot AI requested a review from ScaleNature August 1, 2026 13:15
@ScaleNature

Copy link
Copy Markdown
Owner

@copilot
Please add a comment to this pull request for a report of the findings of running this new lint feature. Then summarize the findings in a clean reviewable set of lists that could be used by a human to look at each unused import in each file to verify results are correct and understand the scope of the needed changes. Explain why the changes to package-lock.json are so extensive. Are all those changes necessary for this new tooling?

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Author

@copilot
Please add a comment to this pull request for a report of the findings of running this new lint feature. Then summarize the findings in a clean reviewable set of lists that could be used by ...

Lint report from npm run lint scoped to OZprivate/rawJS/OZTreeModule/src and .../tests:

  • Total findings: 141
  • no-unused-vars: 141
  • no-duplicate-imports: 0
  • Unused imports: 74 across 28 files
  • Unused variables/locals: 67 across 21 files
  • Files with any findings: 46

Unused imports by file:

  • OZprivate/rawJS/OZTreeModule/src/button_manager.js
    • line 2: import tree_state from './tree_state'; → 'tree_state' is defined but never used.
    • line 3: import {color_theme} from './themes/color_theme'; → 'color_theme' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/controller/controller.js
    • line 20: import data_repo from '../factory/data_repo'; → 'data_repo' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/controller/controller_loc.js
    • line 2: import tree_state from '../tree_state'; → 'tree_state' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/controller/controller_search.js
    • line 2: import tree_state from '../tree_state'; → 'tree_state' is defined but never used.
    • line 3: import api_manager from '../api/api_manager'; //for pop species - can eventually be deleted → 'api_manager' is defined but never used.
    • line 4: import {record_url} from '../navigation/record'; → 'record_url' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/factory/data_repo.js
    • line 1: import {call_hook} from '../util/index'; → 'call_hook' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/factory/garbage_collection.js
    • line 2: import tree_state from '../tree_state'; → 'tree_state' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/factory/utils.js
    • line 1: import tree_state from '../tree_state'; → 'tree_state' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/layout/branch_layout_base.js
    • line 4: import PathShape from '../shapes/path_shape'; → 'PathShape' is defined but never used.
    • line 5: import LineToShape from '../shapes/line_to_shape'; → 'LineToShape' is defined but never used.
    • line 6: import MoveToShape from '../shapes/move_to_shape'; → 'MoveToShape' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/layout/leaf_layout_base.js
    • line 13: import MoveToShape from '../shapes/move_to_shape'; → 'MoveToShape' is defined but never used.
    • line 14: import LineToShape from '../shapes/line_to_shape'; → 'LineToShape' is defined but never used.
    • line 16: import {get_abs_x, get_abs_y, get_abs_r} from './utils'; → 'get_abs_x' is defined but never used.
    • line 16: import {get_abs_x, get_abs_y, get_abs_r} from './utils'; → 'get_abs_y' is defined but never used.
    • line 16: import {get_abs_x, get_abs_y, get_abs_r} from './utils'; → 'get_abs_r' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/layout/otop/branch_layout.js
    • line 3: import ArcShape from '../../shapes/arc_shape'; → 'ArcShape' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/layout/otop/leaf_layout.js
    • line 6: import config from '../../../global_config'; → 'config' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/layout/otop/node_layout.js
    • line 2: import config from '../../../global_config'; → 'config' is defined but never used.
    • line 4: import tree_state from '../../../tree_state'; → 'tree_state' is defined but never used.
    • line 6: import ArcShape from '../../shapes/arc_shape'; → 'ArcShape' is defined but never used.
    • line 7: import TextShape from '../../shapes/text_shape'; → 'TextShape' is defined but never used.
    • line 8: import ImageShape from '../../shapes/image_shape'; → 'ImageShape' is defined but never used.
    • line 9: import ArcTextShape from '../../shapes/arc_text_shape'; → 'ArcTextShape' is defined but never used.
    • line 10: import {ageAsText, gpmapper, is_primary_or_secondary_name} from '../../../factory/utils'; → 'ageAsText' is defined but never used.
    • line 10: import {ageAsText, gpmapper, is_primary_or_secondary_name} from '../../../factory/utils'; → 'gpmapper' is defined but never used.
    • line 10: import {ageAsText, gpmapper, is_primary_or_secondary_name} from '../../../factory/utils'; → 'is_primary_or_secondary_name' is defined but never used.
    • line 11: import {add_mr} from '../../move_restriction'; → 'add_mr' is defined but never used.
    • line 12: import {global_button_action} from '../../../button_manager'; → 'global_button_action' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/layout/otop/signpost_layout.js
    • line 3: import tree_settings from '../../../tree_settings'; → 'tree_settings' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/layout/polytomy/branch_layout.js
    • line 2: import BezierShape from '../../shapes/bezier_shape'; → 'BezierShape' is defined but never used.
    • line 3: import {color_theme} from '../../../themes/color_theme'; → 'color_theme' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/layout/polytomy/leaf_layout.js
    • line 5: import ArcTextShape from '../../shapes/arc_text_shape'; → 'ArcTextShape' is defined but never used.
    • line 6: import TextShape from '../../shapes/text_shape'; → 'TextShape' is defined but never used.
    • line 7: import PathShape from '../../shapes/path_shape'; → 'PathShape' is defined but never used.
    • line 8: import ImageShape from '../../shapes/image_shape'; → 'ImageShape' is defined but never used.
    • line 10: import MoveToShape from '../../shapes/move_to_shape'; → 'MoveToShape' is defined but never used.
    • line 11: import LineToShape from '../../shapes/line_to_shape'; → 'LineToShape' is defined but never used.
    • line 13: import {get_abs_x, get_abs_y, get_abs_r} from '../utils'; → 'get_abs_x' is defined but never used.
    • line 13: import {get_abs_x, get_abs_y, get_abs_r} from '../utils'; → 'get_abs_y' is defined but never used.
    • line 13: import {get_abs_x, get_abs_y, get_abs_r} from '../utils'; → 'get_abs_r' is defined but never used.
    • line 14: import {global_button_action} from '../../../button_manager'; → 'global_button_action' is defined but never used.
    • line 15: import {live_area_config} from '../../live_area_config'; → 'live_area_config' is defined but never used.
    • line 17: import {extxt, spec_num_full} from '../../../factory/utils'; → 'extxt' is defined but never used.
    • line 17: import {extxt, spec_num_full} from '../../../factory/utils'; → 'spec_num_full' is defined but never used.
    • line 18: import config from '../../../global_config'; → 'config' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/layout/polytomy/node_layout.js
    • line 4: import tree_state from '../../../tree_state'; → 'tree_state' is defined but never used.
    • line 7: import TextShape from '../../shapes/text_shape'; → 'TextShape' is defined but never used.
    • line 8: import ImageShape from '../../shapes/image_shape'; → 'ImageShape' is defined but never used.
    • line 9: import ArcTextShape from '../../shapes/arc_text_shape'; → 'ArcTextShape' is defined but never used.
    • line 10: import {ageAsText, gpmapper, is_primary_or_secondary_name} from '../../../factory/utils'; → 'ageAsText' is defined but never used.
    • line 10: import {ageAsText, gpmapper, is_primary_or_secondary_name} from '../../../factory/utils'; → 'gpmapper' is defined but never used.
    • line 10: import {ageAsText, gpmapper, is_primary_or_secondary_name} from '../../../factory/utils'; → 'is_primary_or_secondary_name' is defined but never used.
    • line 11: import {add_mr} from '../../move_restriction'; → 'add_mr' is defined but never used.
    • line 12: import {global_button_action} from '../../../button_manager'; → 'global_button_action' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/layout/polytomy2/node_layout.js
    • line 2: import config from '../../../global_config'; → 'config' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/live_area_config.js
    • line 1: import config from '../global_config'; → 'config' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/pre_calc/pre_calc.js
    • line 6: import {add_hook} from '../../util/index'; → 'add_hook' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/projection.js
    • line 1: import {pre_calc as _pre_calc, set_pre_calculator} from './pre_calc/pre_calc'; → 'set_pre_calculator' is defined but never used.
    • line 4: import {calc_horizon as _calc_horizon, update_parent_horizon as _update_parent_horizon, set_horizon_calculator} from './horizon_calc/horizon_calc'; → 'set_horizon_calculator' is defined but never used.
    • line 5: import data_repo from '../factory/data_repo'; → 'data_repo' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/projection/shapes/base_shape.js
    • line 2: import {ObjectPool} from '../../util/index'; → 'ObjectPool' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/tree_settings.js
    • line 34: import Polytomy2NodeLayout from './projection/layout/polytomy2/node_layout'; → 'Polytomy2NodeLayout' is defined but never used.
    • line 35: import Polytomy2LeafLayout from './projection/layout/polytomy2/leaf_layout'; → 'Polytomy2LeafLayout' is defined but never used.
    • line 36: import Polytomy2SignpostLayout from './projection/layout/polytomy2/signpost_layout'; → 'Polytomy2SignpostLayout' is defined but never used.
    • line 37: import Polytomy2BranchLayout from './projection/layout/polytomy2/branch_layout'; → 'Polytomy2BranchLayout' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/src/ui/search_manager.js
    • line 4: import {capitalizeFirstLetter, max} from '../util/index'; // basic tools → 'max' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/tests/test_factory_midnode.js
    • line 4: import { get_ozid } from './util_data_repo' → 'get_ozid' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/tests/test_projection_highlight.js
    • line 6: import { populate_data_repo, get_ozid } from './util_data_repo.js' → 'get_ozid' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/tests/test_tour_Screensaver.js
    • line 5: import { call_hook } from '../src/util'; → 'call_hook' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/tests/test_tree_state.js
    • line 4: import { populate_factory } from './util_factory' → 'populate_factory' is defined but never used.
  • OZprivate/rawJS/OZTreeModule/tests/util_factory.js
    • line 2: import { populate_data_repo, get_ozid } from './util_data_repo' → 'get_ozid' is defined but never used.

Unused variable/local summary (not listing every local here):

  • OZprivate/rawJS/OZTreeModule/src/controller/controller_anim.js — 3 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/factory/garbage_collection.js — 1 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/factory/polytomy_midnode.js — 1 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/position_helper.js — 1 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/projection/layout/branch_layout_base.js — 2 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/projection/layout/leaf_layout_base.js — 1 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/projection/pre_calc/balanced_pre_calc.js — 2 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/projection/pre_calc/spiral_pre_calc.js — 2 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/themes/IUCN_explicit_colour_blind_friendly.js — 1 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/themes/IUCN_explicit_theme.js — 1 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/themes/genetic_conservation_theme.js — 13 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/themes/natural_theme.js — 8 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/themes/popularity_colour_blind_friendly.js — 13 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/themes/popularity_theme.js — 9 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/tour/handler/HtmlAV.js — 2 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/tour/handler/Vimeo.js — 1 finding(s)
  • OZprivate/rawJS/OZTreeModule/src/util/hook.js — 1 finding(s)
  • OZprivate/rawJS/OZTreeModule/tests/test_factory_factory.js — 1 finding(s)
  • OZprivate/rawJS/OZTreeModule/tests/test_navigation_pinpoint.js — 1 finding(s)
  • OZprivate/rawJS/OZTreeModule/tests/test_ui_tours_list.js — 1 finding(s)
  • OZprivate/rawJS/OZTreeModule/tests/test_util_hook.js — 2 finding(s)

Why package-lock.json changed so much:

  • The repo did not previously have ESLint in devDependencies, so adding it pulled in ESLint itself plus its transitive dependency tree.
  • The lockfile package count went from 1238 to 1305 entries (+67 packages).
  • package-lock.json is still lockfileVersion 2 before and after; this was not a lockfile format upgrade.
  • Git shows the diff as a binary replacement in this repo, but the file is plain JSON text. The large-looking change is mostly dependency additions needed to lock ESLint reproducibly.
  • For committed lockfiles, those dependency entries are expected and necessary if we want CI and other developers to install the exact same ESLint toolchain.
  • If we want a smaller review surface, the alternative would be to avoid committing lockfile changes, but that would make the ESLint tool version less reproducible across environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants