Skip to content

chore: hoist dev dependencies to root and modernize tooling#237

Open
u1f992 wants to merge 11 commits intomainfrom
chore/hoist-dev-dependencies-to-root
Open

chore: hoist dev dependencies to root and modernize tooling#237
u1f992 wants to merge 11 commits intomainfrom
chore/hoist-dev-dependencies-to-root

Conversation

@u1f992
Copy link
Copy Markdown
Member

@u1f992 u1f992 commented Apr 7, 2026

モノレポにパッケージを追加する( #236 〜)にあたってルートパッケージに開発ツールを集約する必要があり、これだけで作業量が多いと判断したのでPRを分けます。インストールし直すついでにツールのバージョンも上げ、もろもろ通るように少しずつ編集しています。

ほとんどはコミットメッセージに書いてありますが、2つほど自分で言ったことを覆した点があるので個別に説明します。

  • 私自身が Add prepare script to packages/vfm for npx git execution #233 で指摘して復元したprepareスクリプトを削除しました。インストール時にビルドするのは全パッケージがやりだすと困るあまり行儀良くない仕草だと考えを改めたこと、また最近はShai-Huludなどセキュリティ問題が広がりignore-scriptsが推奨されることが増えていることを踏まえています。
  • package.jsonの"//"をコメント扱いにするのは引き続き問題なさそうなのですが、複数の"//"を用いるとnpm installなどで書き戻しが起こった際に最後のものだけに直されてしまうことに気付きました。そこで1つの"//"に対して、コメント箇所をキーに、コメント実体は配列にする方式をとることにしました。

u1f992 added 8 commits April 7, 2026 07:45
- vfm/package.json: consolidate multiple "//" keys into a single object.
  Duplicate keys are lost when npm pkg or npm install rewrites the file.
- Migrate .prettierrc to prettier.config.js for consistency with the
  upcoming ESLint flat config migration and better type completions.
- Add "type": "module" to root package.json, required for Node to
  recognize prettier.config.js as ESM.
- Add format script to vfm; root delegates via --workspaces and passes
  common --ignore-path options.
- Includes minor formatting changes from Prettier 3.
- ESLint 10 enforces flat config; replace .eslintrc.js with
  eslint.config.js using @eslint/js and typescript-eslint.
- Use eslint-config-flat-gitignore to derive ignores from .gitignore,
  matching the approach used for prettier --ignore-path.
- Add lint scripts to vfm and root.
- Fix lint errors: remove unused Root import and unused node parameter
  in section.ts, remove stale eslint-disable directive in utils.ts.
- Replace vfm's tsconfig.json with a minimal config extending the new
  root tsconfig.json. The root config tracks tsc --init defaults with
  minimal changes, to ease future migration to TypeScript 7 (tsgo).
- Fix type errors introduced by noUncheckedIndexedAccess: add non-null
  assertions for regex capture groups and array accesses guarded by
  length checks, and add a runtime guard for the ancestors array in
  section.ts.
- Convert inline type imports (import { type X } from 'pkg') to
  top-level type imports (import type { X } from 'pkg') for packages
  without a runtime entry point (unist, hast, mdast, vfile).
  With verbatimModuleSyntax, the inline form leaves an empty
  import {} in the output, which vite cannot resolve at runtime.
- Disable exactOptionalPropertyTypes in vfm's tsconfig.json as
  existing code is not compatible; to be addressed separately.
- Update root build script to use --workspaces --if-present.
- Move prettier ignore-path to each package's format script, instead
  of passing from root via -- passthrough.
- Remove the prepare script from vfm. Auto-building on install is
  uncommon and increasingly discouraged due to supply chain security
  concerns.
- Hoist shx to root.
- Update root scripts to use --workspaces --if-present for build,
  test, format, and lint. Remove dev from root as watch mode should
  be run per-package.
- Add | undefined to optional properties in StringifyMarkdownOptions,
  VFMSettings, Metadata, FootnoteOptions, and ResolvedOption to
  satisfy exactOptionalPropertyTypes.
- Remove exactOptionalPropertyTypes override from vfm's tsconfig.json.
- Fix test imports: add .js extensions for ESM module resolution, use
  import type where required by verbatimModuleSyntax.
Run tsc --project tests/tsconfig.json as part of the test script to
ensure tests are type-checked alongside vitest execution.
@u1f992 u1f992 requested review from akabekobeko and Copilot and removed request for Copilot April 7, 2026 18:18
@u1f992 u1f992 marked this pull request as ready for review April 7, 2026 18:19
@u1f992 u1f992 requested a review from Copilot April 7, 2026 23:42
Copy link
Copy Markdown

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 hoists dev dependencies from individual packages to the root of the monorepo and modernizes the development tooling configuration. The changes include:

  • Moving dev dependencies to root package.json
  • Creating centralized TypeScript, Prettier, and ESLint configurations
  • Removing old configuration files (.prettierrc, .eslintrc.js)
  • Updating all imports to use explicit .js file extensions for ES modules
  • Adding type keyword to type imports throughout the codebase
  • Removing the prepare script from packages/vfm/package.json
  • Converting package.json comments to a structured format

Changes:

  • New root-level configuration files created (tsconfig.json, prettier.config.js, eslint.config.js)
  • Root package.json updated with hoisted devDependencies and new scripts
  • All TypeScript source files updated with .js extensions and type keyword for type imports
  • Updated test files with ESM-style imports
  • Simplified tsconfig.json in packages/vfm by extending root config
  • New test tsconfig.json created for type-checking tests

Reviewed changes

Copilot reviewed 38 out of 40 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tsconfig.json New root TypeScript configuration with strict compiler options
prettier.config.js New root Prettier configuration file (replaces .prettierrc)
eslint.config.js New root ESLint flat config (replaces .eslintrc.js)
package.json Root package updated with hoisted devDependencies and workspace scripts
packages/vfm/package.json Updated to remove hoisted devDependencies and prepare script
packages/vfm/tsconfig.json Simplified to extend root config
packages/vfm/tests/tsconfig.json New configuration for test type-checking
packages/vfm/src/**/*.ts Updated with .js extensions and type imports
packages/vfm/tests/**/*.ts Updated with .js extensions in imports

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

u1f992 added 3 commits April 7, 2026 18:35
With verbatimModuleSyntax (default in TS 6), `import { type X } from`
leaves an empty `import {} from` in the output. For @types/* packages
without a runtime entry point, this causes vitest to fail (fixed in
8c7fbfc). The modules changed here all have runtime entry points so
the inline form does not error, but we use top-level `import type` for
consistency.
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.

2 participants