Skip to content

Panel code refactor and TS6 compatibility#899

Open
giuscris wants to merge 1 commit into
2.xfrom
refactor/panel-improvements
Open

Panel code refactor and TS6 compatibility#899
giuscris wants to merge 1 commit into
2.xfrom
refactor/panel-improvements

Conversation

@giuscris
Copy link
Copy Markdown
Member

This pull request updates TypeScript and related dependencies to their latest versions and makes several improvements to configuration and type safety in the project. The most significant changes include upgrading TypeScript to version 6, updating all related typescript-eslint and stylelint dependencies, enhancing type safety in the main app configuration, and adding improved editor and workspace settings for consistency.

Dependency Upgrades:

  • Upgraded typescript to version 6.0.3 and updated all related dependencies (typescript-eslint, stylelint, and their plugins/configs) in panel/package.json and panel/pnpm-lock.yaml to ensure compatibility and take advantage of the latest features and fixes. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Type Safety Improvements:

  • Refined the AppConfig interface in panel/src/ts/app.ts by importing and applying explicit types for configuration options, replacing loose any types with specific option interfaces for better type safety and code clarity.
  • Made csrfToken a required property in AppConfig and set a default empty string value in the App class.

Editor and Linting Configuration:

  • Added a VS Code setting to use Prettier as the default formatter for TypeScript files, ensuring consistent code formatting. (.vscode/settings.json)
  • Adjusted ESLint configuration to move the curly rule into its own override block, possibly to resolve rule conflicts or improve clarity. (panel/eslint.config.js) [1] [2]

Workspace Build Settings:

  • Added an allowBuilds section to panel/pnpm-workspace.yaml to disable builds for @parcel/watcher and esbuild, likely to optimize the workspace or avoid unnecessary builds.

@giuscris giuscris requested a review from Copilot May 27, 2026 20:04
@giuscris giuscris self-assigned this May 27, 2026
@giuscris giuscris added the enhancement New feature or request label May 27, 2026
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 refactors the panel TypeScript code for stricter type checking and updates the panel toolchain toward TypeScript 6 compatibility.

Changes:

  • Updates TypeScript, pnpm, ESLint/stylelint-related lockfile entries, workspace settings, and TS compiler options.
  • Refactors panel utilities/components to reduce casts, add generics, and split some UI logic into helpers.
  • Tightens AppConfig typing and updates editor/input/view code paths for safer option handling.

Reviewed changes

Copilot reviewed 50 out of 51 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
.vscode/settings.json Adds TypeScript default formatter configuration.
panel/eslint.config.js Moves curly into a separate config block.
panel/package.json Updates TypeScript, typescript-eslint, and package manager versions.
panel/pnpm-lock.yaml Regenerates lockfile for dependency updates.
panel/pnpm-workspace.yaml Adds build approval settings.
panel/tsconfig.json Updates TypeScript compiler options.
panel/src/ts/app.ts Adds explicit app config option types.
panel/src/ts/utils/arrays.ts Simplifies array equality helper.
panel/src/ts/utils/cookies.ts Refactors cookie option iteration.
panel/src/ts/utils/forms.ts Refactors serialization loops.
panel/src/ts/utils/request.ts Refactors request option merging and callback handling.
panel/src/ts/utils/selectors.ts Adds generic selector helper return types.
panel/src/ts/utils/validation.ts Adds shared search regex helper.
panel/src/ts/polyfills/request-submit.ts Removes requestSubmit polyfill.
panel/src/ts/components/form.ts Refactors input association/loading and duplication helpers.
panel/src/ts/components/forms.ts Applies generic form selector typing.
panel/src/ts/components/files.ts Removes CSRF/dataset casts in file actions.
panel/src/ts/components/fileslist.ts Refactors replacement/search/modal file list logic.
panel/src/ts/components/modal.ts Splits modal event registration into helper methods.
panel/src/ts/components/navigation.ts Caches navigation command elements and simplifies removal.
panel/src/ts/components/notification.ts Makes notification element optional and simplifies lifecycle.
panel/src/ts/components/notifications.ts Applies typed selector and element removal helper.
panel/src/ts/components/tabs.ts Extracts tab persistence helpers.
panel/src/ts/components/tooltip.ts Initializes timer fields and types defaults.
panel/src/ts/components/tooltips.ts Defaults tooltip dataset text safely.
panel/src/ts/components/statistics-chart.ts Defaults parsed chart point index attribute.
panel/src/ts/components/color-scheme.ts Reuses dark-mode media query object.
panel/src/ts/components/dropdowns.ts Defaults dropdown dataset lookup value.
panel/src/ts/components/views/backups.ts Simplifies spinner and backup DOM updates.
panel/src/ts/components/views/dashboard.ts Removes CSRF token cast.
panel/src/ts/components/views/pages.ts Uses shared search regex and safer optional access.
panel/src/ts/components/views/plugins.ts Uses typed selector and removes CSRF cast.
panel/src/ts/components/views/updates.ts Removes casts and defaults installing text.
panel/src/ts/components/inputs/array-input.ts Simplifies parent insertion/removal handling.
panel/src/ts/components/inputs/date-input.ts Exports options and initializes calendar fields.
panel/src/ts/components/inputs/duration-input.ts Adds stricter interval typing and validation.
panel/src/ts/components/inputs/editor-input.ts Exports editor options and defaults label access.
panel/src/ts/components/inputs/image-picker.ts Refactors image picker request response typing.
panel/src/ts/components/inputs/range-input.ts Defaults ticks dataset value.
panel/src/ts/components/inputs/select-input.ts Exports options and refactors dropdown/search logic.
panel/src/ts/components/inputs/slug-input.ts Uses typed selector and optional event binding.
panel/src/ts/components/inputs/tags-input.ts Exports options and refactors dropdown/search logic.
panel/src/ts/components/inputs/togglegroup-input.ts Applies typed input selector.
panel/src/ts/components/inputs/upload-input.ts Makes files list optional and refactors upload handlers.
panel/src/ts/components/inputs/editor/code/menu.ts Defaults editor menu labels.
panel/src/ts/components/inputs/editor/markdown/commands.ts Expands inline conditional for lint compatibility.
panel/src/ts/components/inputs/editor/markdown/inputrules.ts Expands inline conditionals for lint compatibility.
panel/src/ts/components/inputs/editor/markdown/keymap.ts Expands inline conditionals for lint compatibility.
panel/src/ts/components/inputs/editor/markdown/linktooltip.ts Defaults editor tooltip labels.
panel/src/ts/components/inputs/editor/markdown/menu.ts Defaults markdown editor menu labels.
panel/src/ts/components/inputs/editor/markdown/view.ts Removes parser result casts.
Files not reviewed (1)
  • panel/pnpm-lock.yaml: Language not supported

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

Comment thread panel/tsconfig.json
"esModuleInterop": true,
"isolatedModules": true,
"verbatimModuleSyntax": true,
"lib": ["ES2020", "DOM"],
Comment thread panel/src/ts/app.ts
Comment on lines +36 to +40
DateInput?: DateInputOptions;
DurationInput?: DurationInputOptions;
EditorInput?: EditorInputOptions;
SelectInput?: SelectInputOptions;
TagsInput?: TagsInputOptions;
@@ -1,11 +1,9 @@
import "../polyfills/request-submit";
import { $, $$ } from "../utils/selectors";
Comment on lines +163 to +165
private filterFiles(rawValue: string) {
const value = escapeHtml(rawValue);
const regexp = value ? makeSearchRegExp(value, "gi") : null;
let visibleItems = 0;
$$(".dropdown-item", this.dropdown).forEach((element) => {
if (value === null || filter(element)) {
if (!regexp || regexp.test(element.textContent)) {
const text = `${element.textContent}`;
const regexp = new RegExp(`(^|\\b)${makeDiacriticsRegExp(escapeRegExp(value))}`, "i");
if (text.match(regexp) !== null && element.style.display !== "none") {
const text = element.textContent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants