Skip to content

Conversation

@yihao03
Copy link

@yihao03 yihao03 commented Jan 26, 2026

  • Rename vue-components JS files to TypeScript
  • Adapt vue-components TypeScript files

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Overview of changes:
Migrate the packages/vue-components JavaScript files to TypeScript.

Anything you'd like to highlight/discuss:
This migration is done as part of the effort to migrate the entire codebase to TypeScript and ES6
It is done primarily using OpenCode with Claude Sonnet 4.5 to experiment PR #2804: Adding ai agent's effectiveness.

Testing instructions:
Run the existing test suite to ensure all tests pass successfully.
Serve or build some websites to make sure everything works as expected.

Proposed commit message: (wrap lines at 72 characters)
Migrate vue-components to TypeScript


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

Reviewer checklist:

Indicate the SEMVER impact of the PR:

  • Major (when you make incompatible API changes)
  • Minor (when you add functionality in a backward compatible manner)
  • Patch (when you make backward compatible bug fixes)

At the end of the review, please label the PR with the appropriate label: r.Major, r.Minor, r.Patch.

Breaking change release note preparation (if applicable):

  • To be included in the release note for any feature that is made obsolete/breaking

Give a brief explanation note about:

  • what was the old feature that was made obsolete
  • any replacement feature (if any), and
  • how the author should modify his website to migrate from the old feature to the replacement feature (if possible).

- Add TypeScript type annotations to all migrated files:
  * Wrap Vue Options API components with defineComponent for proper type
inference
  * Convert directives (Closeable, Float) to ES6 exports with proper
types
  * Add comprehensive type safety to utilities (utils, urls, pubsub,
dropdown, submenu)
  * Fix NodeList.ts with proper type handling and linting compliance
  * Add 'this: any' parameters to QuizQuestionMixin for dynamic property
access

- Configure build tools for TypeScript:
  * Install and configure @babel/preset-typescript
  * Update babel.config.js with TypeScript preset
  * Configure Jest with ts-jest for test transformation

- Configure ESLint for TypeScript + Vue:
  * Add packages/vue-components/tsconfig.lint.json for ESLint
  * Update root .eslintrc.js to include vue-components tsconfig in
project array
  * Configure vue-components/.eslintrc.js with vue-eslint-parser and
TypeScript support
  * Add .eslintignore to exclude coverage and config files from linting
  * Configure import resolver to handle .ts file resolution
  * Add overrides for .js files to not require TypeScript project

- Fix all linting errors without disabling rules:
  * Fix 83 linting errors in NodeList.ts (bitwise operators, parameter
reassignments, for-in loops)
  * Fix 32 linting errors in utils.ts (nested ternaries, line length,
typeof checks)
  * Reorder function declarations to fix no-use-before-define errors
  * Add inline eslint-disable only for unavoidable legacy patterns
(lodash checks where lodash isn't available)
  * Replace ~arr.indexOf(x) with arr.indexOf(x) !== -1
  * Replace for-in loops with Object.keys().forEach()
  * Fix parameter reassignments by using local variables
  * Break up nested ternaries into if-else statements
  * Use Number.isNaN instead of isNaN

- Configure Vue-specific TypeScript settings:
  * Set strict: false for incremental migration
  * Disable noImplicitAny and noImplicitThis for Vue Options API
compatibility
  * Configure jsx: 'preserve' for Vue template compilation
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.

1 participant