Conversation
They are obsolete in ESM.
There was a problem hiding this comment.
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.jsto an ES module withtype="module"in the HTML - Modernizes syntax with arrow functions and optional chaining operators
- Updates console logging from
console.log()toconsole.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.
| const STORAGE_KEY = 'django-devbar-show-bar'; | ||
| let currentShowState = true; | ||
| let styleElement = null; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
This is a part of an extension, I don't think it matters that much here.
amureki
left a comment
There was a problem hiding this comment.
Ohhh, love it!
Thanks for the awesome tool, Johannes! 🙌 🏅
* origin/main: Modernize the JS code (#23)
No description provided.