Skip to content

[Security]: Eliminate all lint issues in web stack #338

@crivetimihai

Description

@crivetimihai

🔧 Chore Summary

Fix remaining 16 lint issues in web stack after auto-formatting - 14 JavaScript errors and 2 HTML validation errors that require manual code changes.


🧱 Area Affected

Choose the general area(s) that this chore affects:

  • Pre-commit hooks / linters
  • Other: Code refactoring for ESLint compliance & HTML validation

⚙️ Context / Rationale

After running auto-formatting, we've reduced lint issues from 312 to 16. The remaining issues require manual intervention:

HTML (2 errors):

  • Missing closing </div> tag causing structure mismatch
  • Missing DOCTYPE declaration in partial template

JavaScript (14 errors):

  • Variable naming convention violations (camelCase)
  • Unused code that should be removed or utilized
  • Undefined global variable references

These fixes will achieve zero-lint status and improve code quality.


📦 Related Make Targets

Reference any relevant Makefile targets that are involved, if applicable. Ex:

  • make lint-web - runs HTML/CSS/JS linters
  • make install-web-linters - installs npm-based linters

📋 Acceptance Criteria

Define what "done" looks like for this task.

  • HTML Fixes (2)
    • Add missing </div> closing tag in admin.html after line 39
    • Add DOCTYPE to version_info_partial.html OR configure HTMLHint to skip partials
  • JavaScript Variable Naming (8)
    • Rename is_inactive_checkedisInactiveChecked (lines: 183, 199, 328, 339, 606, 613)
    • Rename base_urlbaseUrl (lines: 1298, 1319)
  • JavaScript Unused Code (4)
    • Remove unused function protectInputPrefix (line 778)
    • Remove unused variable end (line 806)
    • Remove unused function testGateway (line 1256)
    • Remove unused variable toolTestResultEditor (line 2129) OR use it properly
  • JavaScript Undefined Variables (2)
    • Add /* global CodeMirror */ at top of file OR check for window.CodeMirror (lines: 1260, 1271)
  • All linters pass with 0 errors
  • Admin UI functionality verified after changes

🧩 Additional Notes

Quick fixes:

  1. For CodeMirror undefined errors, add at the top of admin.js:

    /* global CodeMirror */

    OR change references to window.CodeMirror

  2. For HTML partial doctype issue, either:

    • Add to .htmlhintrc: "doctype-first": false for partials
    • OR wrap partial content check: {% if not is_partial %}<!DOCTYPE html>{% endif %}
  3. Variable renaming can be done with find/replace:

    • is_inactive_checkedisInactiveChecked
    • base_urlbaseUrl
  4. For unused code, verify it's truly unused before removal:

    • protectInputPrefix - appears to be dead code
    • testGateway - might be referenced in HTML onclick attributes
    • toolTestResultEditor - check if it should be stored in AppState

Testing checklist:

  • Test inactive item toggles work correctly
  • Test gateway testing functionality
  • Verify CodeMirror editors still initialize
  • Check all modals open/close properly

Metadata

Metadata

Assignees

Labels

choreLinting, formatting, dependency hygiene, or project maintenance chorescicdIssue with CI/CD process (GitHub Actions, scaffolding)devopsDevOps activities (containers, automation, deployment, makefiles, etc)securityImproves securitytriageIssues / Features awaiting triage

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions