Skip to content

Modernize the JS code#23

Merged
amureki merged 2 commits intoamureki:mainfrom
codingjoe:esupgrade
Jan 5, 2026
Merged

Modernize the JS code#23
amureki merged 2 commits intoamureki:mainfrom
codingjoe:esupgrade

Conversation

@codingjoe
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings January 5, 2026 19:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the JavaScript codebase by removing legacy patterns and adopting modern ES syntax. The changes update build scripts, DevTools panel code, and content scripts to use contemporary JavaScript features.

  • Removes IIFE (Immediately Invoked Function Expressions) wrappers and 'use strict' directives in favor of ES modules
  • Converts panel.js to an ES module with type="module" in the HTML
  • Modernizes syntax with arrow functions and optional chaining operators
  • Updates console logging from console.log() to console.info()

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
chrome-extension/scripts/generate-icons.mjs Updates console output to use console.info() instead of console.log()
chrome-extension/scripts/build.mjs Updates console output to use console.info() instead of console.log()
chrome-extension/panel.js Removes IIFE wrapper, exposes functions and variables at module scope
chrome-extension/panel.html Adds type="module" attribute to panel.js script tag for ES module support
chrome-extension/devtools.js Converts callback function to arrow function syntax
chrome-extension/content.js Removes IIFE wrapper, uses optional chaining, removes chrome API availability guard
.pre-commit-config.yaml Adds esupgrade pre-commit hook for automatic JavaScript modernization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +3
const STORAGE_KEY = 'django-devbar-show-bar';
let currentShowState = true;
let styleElement = null;
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The safety check for chrome and chrome.storage availability has been removed. While this code runs as a content script where the Chrome API should be available, removing the guard makes the code less defensive. If this script is ever injected in an unexpected context or if the storage permission is revoked, this will throw an error instead of silently failing.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a part of an extension, I don't think it matters that much here.

Copy link
Copy Markdown
Owner

@amureki amureki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh, love it!

Thanks for the awesome tool, Johannes! 🙌 🏅

@amureki amureki merged commit 69fcce0 into amureki:main Jan 5, 2026
25 checks passed
amureki added a commit that referenced this pull request Jan 5, 2026
* origin/main:
  Modernize the JS code (#23)
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.

3 participants