Skip to content

Module System: Modernize to ES6 modules with codemod #708

@justin808

Description

@justin808

Description

The codebase currently uses CommonJS export = and require() patterns which prevent full ES6 module adoption. This issue tracks the creation of a codemod for automated migration in a future major version.

Current State

  • Multiple files use export = for CommonJS compatibility
  • Dynamic require() calls throughout the codebase
  • Consumers rely on require() to import these modules

Files Using export =

  • package/rules/webpack.ts
  • package/rules/rspack.ts
  • package/env.ts
  • Other configuration export files

Proposed Solution

  1. Create a codemod that:
    • Converts export = to export default
    • Converts require() to import statements
    • Handles dynamic imports appropriately
  2. Test codemod on example projects
  3. Document migration path for users
  4. Release as part of next major version

Acceptance Criteria

  • Codemod successfully converts all patterns
  • Migration guide written
  • Example migrations provided
  • All tests pass with ES6 modules
  • Performance benchmarks show no regression

Breaking Change Notice

This will be a breaking change requiring a major version bump. Users will need to update their import statements or run the provided codemod.

Related

  • See ESLINT_TECHNICAL_DEBT.md for full context
  • Blocks full TypeScript strict mode adoption

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions