Skip to content

Conversation

lumirlumir
Copy link
Owner

@lumirlumir lumirlumir commented Jul 23, 2025

This pull request migrates the codebase from CommonJS to ES Modules, modernizing the module system and improving compatibility with current JavaScript standards. The changes include updating import/export syntax, refactoring test files, and ensuring all module references use the .js extension explicitly.

Migration to ES Modules:

  • package.json: Added "type": "module" to specify the project as an ES Modules environment.
  • Refactored all require statements to import and replaced module.exports with export or export default across multiple files:

Test File Updates:

Explicit .js Extensions:

  • Ensured all import paths include the .js extension to comply with ES Modules requirements:
    • Updated imports in src/textlint-rule-allowed-uris.js, src/utils/get-uri-types/get-uri-types.js, src/utils/theme/theme.js, and other files. [1] [2] [3] [4]

These changes collectively modernize the codebase, aligning it with current JavaScript standards and improving maintainability.

@github-actions github-actions bot added 🏷️ scope: * Auto-generated label based on Conventional Commits specification for GitHub release notes 🏷️ type: refactor Auto-generated label based on Conventional Commits specification for GitHub release notes labels Jul 23, 2025
Copy link

codecov bot commented Jul 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.90%. Comparing base (84bd452) to head (f1dd2a9).
⚠️ Report is 1 commits behind head on main.

@@            Coverage Diff             @@
##             main     #301      +/-   ##
==========================================
- Coverage   98.94%   98.90%   -0.05%     
==========================================
  Files          10       10              
  Lines         379      365      -14     
  Branches        1        1              
==========================================
- Hits          375      361      -14     
  Misses          4        4              
Files with missing lines Coverage Δ
src/textlint-rule-allowed-uris.js 100.00% <100.00%> (ø)
...tion-node-uri-type/get-definition-node-uri-type.js 92.72% <100.00%> (ø)
src/utils/get-definition-node-uri-type/index.js 100.00% <100.00%> (ø)
src/utils/get-uri-types/get-uri-types.js 100.00% <100.00%> (ø)
src/utils/get-uri-types/index.js 100.00% <100.00%> (ø)
src/utils/theme/index.js 100.00% <100.00%> (ø)
src/utils/theme/theme.js 100.00% <100.00%> (ø)
src/utils/uri-types/index.js 100.00% <100.00%> (ø)
src/utils/uri-types/uri-types.js 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84bd452...f1dd2a9. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lumirlumir lumirlumir changed the title refactor(*): migrate to ESM refactor(*)!: migrate to ESM Jul 25, 2025
@lumirlumir lumirlumir force-pushed the refactor-migrate-to-ultrahtml-from-cheerio branch from 63aa17e to 5e052db Compare July 26, 2025 04:45
@lumirlumir lumirlumir marked this pull request as ready for review July 26, 2025 04:49
@Copilot Copilot AI review requested due to automatic review settings July 26, 2025 04:49
Copy link
Contributor

@Copilot 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 pull request migrates the entire codebase from CommonJS to ES Modules (ESM), modernizing the module system to align with current JavaScript standards and improve compatibility with modern tooling.

Key changes include:

  • Adding "type": "module" to package.json to specify ES Modules environment
  • Converting all require() statements to import and module.exports to export/export default
  • Adding explicit .js file extensions to all import paths as required by ESM
  • Using createRequire and import.meta for compatibility with Node.js built-ins in test files

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
package.json Added "type": "module" to enable ES Modules
src/textlint-rule-allowed-uris.js Main rule file converted to ESM with updated imports and default export
src/types/index.js Updated to use default export instead of module.exports
src/utils/*/index.js Index files converted to use ES Module re-exports
src/utils/*/*.js Utility files migrated to ESM syntax with explicit .js extensions
tests/*.test.js Test files updated to use ESM imports and Node.js compatibility helpers

@github-actions github-actions bot added the 🏷️ BREAKING CHANGE Auto-generated label based on Conventional Commits specification for GitHub release notes label Jul 26, 2025
Copy link

Labels have been automatically applied based on the Conventional Commits specification.🏷️

@lumirlumir lumirlumir merged commit f36fbeb into main Jul 26, 2025
8 checks passed
@lumirlumir lumirlumir deleted the refactor-migrate-to-ultrahtml-from-cheerio branch July 26, 2025 05:13
lumirlumir added a commit that referenced this pull request Jul 27, 2025
…or`) (#308)

## Release Information: `v2.0.0`

New release of `lumirlumir/npm-textlint-rule-allowed-uris` has arrived!
:tada:

This PR bumps the package versions from `v1.1.1` to `v2.0.0` (`major`).

See
[Actions](https://github.com/lumirlumir/npm-textlint-rule-allowed-uris/actions/runs/16551356197)
for more details.

| Info        | Value                      |
| ----------- | -------------------------- |
| Repository  | `lumirlumir/npm-textlint-rule-allowed-uris` |
| SEMVER      | `major`     |
| Pre ID      | `canary`      |
| Short SHA   | 90ae620       |
| Old Version | `v1.1.1`  |
| New Version | `v2.0.0`  |

<!-- Release notes generated using configuration in .github/release.yml
at main -->

## What's Changed
### 💥 BREAKING CHANGES
* refactor(*)!: migrate to ESM by @lumirlumir in
#301
* feat(*)!: drop async logic and add `checkUnusedDefinitions` option by
@lumirlumir in
#305
### ✨ Features
* feat(*): support `textlint` v15 by @lumirlumir in
#306
### 🐛 Bug Fixes
* fix(*): incorrect error location and refactor by @lumirlumir in
#304
### 🧰 Chores
* chore(sync-server): update `dependabot.yml` by @lumirlumir in
#280
* chore(*): move `FUNDING.yml` to `.github` repository by @lumirlumir in
#290
### 📝 Documentation
* docs(*): remove `PULL_REQUEST_TEMPLATE.md` in favor of centralized
template by @lumirlumir in
#293
* docs(*): update `README.md` by @lumirlumir in
#307
### ♻️ Code Refactoring
* refactor(*): migrate type declarations to use `@import` syntax by
@lumirlumir in
#276
* refactor(*): improve structure and clarity of URI type retrieval
functions by @lumirlumir in
#296
* refactor(*): simplify and cleanup logics by @lumirlumir in
#303
### ⬆️ Dependency Updates
* chore(deps): bump cheerio from 1.0.0 to 1.1.0 by @dependabot[bot] in
#266
* chore(deps-dev): bump the bananass group across 1 directory with 2
updates by @dependabot[bot] in
#265
* chore(deps-dev): bump @types/node from 22.15.29 to 24.0.0 by
@dependabot[bot] in
#269
* chore(deps-dev): bump @types/node from 24.0.0 to 24.0.1 by
@dependabot[bot] in
#270
* chore(deps-dev): bump lint-staged from 16.1.0 to 16.1.2 by
@dependabot[bot] in
#271
* chore(deps-dev): bump eslint from 9.28.0 to 9.29.0 by @dependabot[bot]
in #272
* chore(deps-dev): bump concurrently from 9.1.2 to 9.2.0 by
@dependabot[bot] in
#274
* chore(deps-dev): bump prettier from 3.5.3 to 3.6.0 by @dependabot[bot]
in #275
* chore(deps-dev): bump @types/node from 24.0.1 to 24.0.4 by
@dependabot[bot] in
#277
* chore(deps-dev): bump prettier from 3.6.0 to 3.6.1 by @dependabot[bot]
in #278
* chore(deps-dev): bump @babel/core from 7.27.4 to 7.27.7 in the babel
group across 1 directory by @dependabot[bot] in
#279
* chore(deps-dev): bump eslint from 9.29.0 to 9.30.0 by @dependabot[bot]
in #282
* chore(deps-dev): bump @types/node from 24.0.4 to 24.0.7 by
@dependabot[bot] in
#281
* chore(deps-dev): bump prettier from 3.6.1 to 3.6.2 by @dependabot[bot]
in #283
* chore(deps-dev): bump eslint from 9.30.0 to 9.30.1 by @dependabot[bot]
in #286
* chore(deps-dev): bump @types/node from 24.0.7 to 24.0.10 by
@dependabot[bot] in
#285
* chore(deps-dev): bump the babel group across 1 directory with 3
updates by @dependabot[bot] in
#287
* chore(deps-dev): bump the bananass group across 1 directory with 2
updates by @dependabot[bot] in
#289
* chore(deps-dev): bump @types/node from 24.0.10 to 24.0.12 by
@dependabot[bot] in
#288
* chore(deps-dev): bump eslint from 9.30.1 to 9.31.0 by @dependabot[bot]
in #292
* chore(deps-dev): bump editorconfig-checker from 6.0.1 to 6.1.0 by
@dependabot[bot] in
#295
* chore(deps): bump cheerio from 1.1.0 to 1.1.2 by @dependabot[bot] in
#299
* chore(deps-dev): bump the bananass group across 1 directory with 2
updates by @dependabot[bot] in
#302


**Full Changelog**:
v1.1.1...v2.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ BREAKING CHANGE Auto-generated label based on Conventional Commits specification for GitHub release notes 🏷️ scope: * Auto-generated label based on Conventional Commits specification for GitHub release notes 🏷️ type: refactor Auto-generated label based on Conventional Commits specification for GitHub release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant