Skip to content

Convert tidier.js to TypeScript #3815

@raclim

Description

@raclim

Note: Preserved for CodeDay contributors.

This issue is part of the ongoing work to upgrade CodeMirror from v5 to v6 (see the parent issue for additional context). Alongside this upgrade, the project is also continuing a broader ongoing TypeScript Migration from JavaScript.

Increasing Access

As we're preparing to release the new CodeMirror v6 feature, we'd like to maintain consistency and long-term maintainability to convert files into TypeScript. Breaking down conversion process to happen incrementally through smaller, scoped modules and components can help contributors participate in the migration without needing to immediately understand the entire codebase at once.

Feature Details

The files within the upcoming CM v6 upgrade will need to be converted from JavaScript to TypeScript files.

This issue specifically focuses on tidier.js file. This file runs Prettier on the active CodeMirror editor instance by formatting the current file content using prettier.formatWithCursor and then updating the editor document while keeping the cursor's position.

Suggestions to Start

  • Rename tidier.js to tidier.ts.
  • Add in TypeScript types for the CodeMirror view and the mode argument, as well as any other values that will be flagged during the conversion.
  • Update any needed imports/exports.
  • Manually check that "Tidy" and "Format" works for JavaScript, HTML, and CSS files. When formatting the editor content, the cursor should remain stable and not jump to a different location unexpectedly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Code QualityFor refactoring, cleanup, or improvements to maintainabilityArea: Typescript MigrationRelated to Typescript Migration after the initial pr05 grant 2025 migration workEnhancementImprovement to an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions