-
Notifications
You must be signed in to change notification settings - Fork 0
Bump to eslint 10 + typescript 6 #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
636144e
Bump to eslint 10 + typescript 6
plx d5678de
Merge main into plx/lint-ts-upgrade
plx 15cfe61
Add .npmrc with legacy-peer-deps for TS 6 / @astrojs/check conflict
plx d9a20d3
Add @eslint/js as a direct dependency
plx b4a6dea
docs: add mini-spec for #/ subpath import migration
plx ed5b83c
chore(ts): remove deprecated baseUrl from tsconfig
plx 965c42f
chore(ts): add explicit Astro and Playwright type contexts
plx 4066c73
chore(ts): add project-based typecheck scripts
plx a5c9452
chore(deps): replace legacy-peer-deps with narrow @astrojs/check over…
plx 9ecc2af
chore(node): pin engines to >=24.0.0 and enforce strict
plx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| engine-strict=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
planning/typescript6-item4-subpath-imports-migration.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| # Mini-Spec: Migrate TS Path Aliases from `@*` to `#/*` (TypeScript 6) | ||
|
|
||
| ## Context | ||
|
|
||
| This project currently uses a TypeScript path alias pattern based on `@*` in `tsconfig.json`, with imports like `@components/Container.astro`. | ||
|
|
||
| TypeScript 6.0 adds support for Node subpath imports starting with `#/` under modern module resolution modes (notably `bundler` and `nodenext`). | ||
|
|
||
| This migration standardizes import aliasing on the `#/*` convention so TypeScript, runtime tooling, and ecosystem behavior stay aligned going into TypeScript 7. | ||
|
|
||
| ## Goals | ||
|
|
||
| - Replace internal `@...` import aliases with `#/...` across source files. | ||
| - Configure `package.json#imports` to define the alias at runtime/tooling level. | ||
| - Update TypeScript path mapping to match `#/*`. | ||
| - Preserve existing behavior (no functional app changes). | ||
|
|
||
| ## Non-Goals | ||
|
|
||
| - No content changes. | ||
| - No routing changes. | ||
| - No refactors unrelated to module resolution. | ||
| - No runtime feature or dependency upgrades beyond what is required for alias resolution. | ||
|
|
||
| ## Scope | ||
|
|
||
| In scope: | ||
|
|
||
| - `tsconfig.json` path mapping for aliases. | ||
| - `package.json` `imports` field. | ||
| - All internal source imports that currently use `@...`. | ||
| - Validation scripts/build/test commands to ensure alias resolution remains correct. | ||
|
|
||
| Out of scope: | ||
|
|
||
| - External dependency import style. | ||
| - Renaming directories or moving files. | ||
|
|
||
| ## Current State | ||
|
|
||
| - Alias is configured in TypeScript via: | ||
| - `compilerOptions.paths`: `"@*": ["./src/*"]` | ||
| - Many source files import through `@...` aliases. | ||
| - Module resolution is already modern (`bundler` via Astro strict config), which is compatible with TS 6 support for `#/` subpath imports. | ||
|
|
||
| ## Target State | ||
|
|
||
| - Imports use `#/...` for internal source paths. | ||
| - `package.json` defines: | ||
|
|
||
| ```json | ||
| { | ||
| "imports": { | ||
| "#/*": "./src/*" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| - `tsconfig.json` defines equivalent `paths` mapping for editor/type-check alignment. | ||
| - Build, checks, and tests pass with no runtime resolution regressions. | ||
|
|
||
| ## Design | ||
|
|
||
| ### Configuration | ||
|
|
||
| 1. Add `imports` mapping in `package.json` for `#/* -> ./src/*`. | ||
| 2. Update `tsconfig.json` `paths` from `@*` to `#/*` (or equivalent explicit mapping). | ||
|
|
||
| ### Code Migration | ||
|
|
||
| 1. Bulk-rewrite imports from: | ||
| - `from "@..."` to `from "#/..."` | ||
| 2. Verify no remaining `@...` aliases in source/config. | ||
|
|
||
| ### Validation | ||
|
|
||
| Run at minimum: | ||
|
|
||
| - `npm run lint` | ||
| - `npm run build` | ||
| - `npm run validate:links` | ||
| - `npm run qa` (if Playwright/browser availability is present) | ||
|
|
||
| ## Risks and Mitigations | ||
|
|
||
| ### Risk: Incomplete import rewrite | ||
|
|
||
| - Mitigation: grep-based verification for remaining `from "@` occurrences. | ||
|
|
||
| ### Risk: Tooling mismatch (`imports` vs `paths`) | ||
|
|
||
| - Mitigation: keep `package.json#imports` and `tsconfig.json#paths` in lockstep; validate via `tsc -p` and `astro check`/build. | ||
|
|
||
| ### Risk: Runtime resolution differences in scripts/tests | ||
|
|
||
| - Mitigation: validate build and node-executed paths; avoid aliasing in places not covered by configured resolution. | ||
|
|
||
| ## Rollout Plan | ||
|
|
||
| 1. Add config changes (`package.json`, `tsconfig.json`). | ||
| 2. Rewrite imports in source files. | ||
| 3. Run full validation. | ||
| 4. Merge as one focused PR/commit series. | ||
|
|
||
| ## Rollback Plan | ||
|
|
||
| If any critical resolution issue appears: | ||
|
|
||
| 1. Revert migration commit(s). | ||
| 2. Restore previous alias mappings and import forms. | ||
| 3. Re-run baseline validation. | ||
|
|
||
| ## Acceptance Criteria | ||
|
|
||
| - No source files import internal modules via `@...` aliases. | ||
| - `package.json#imports` contains `#/*` mapping. | ||
| - `tsconfig` path mapping resolves `#/*`. | ||
| - `npm run build` passes. | ||
| - Link validation and lint pass. | ||
| - No observable behavior change in generated site output. | ||
|
|
||
| ## Estimated Effort | ||
|
|
||
| - Implementation: ~1-2 hours | ||
| - Validation/fixes: ~30-60 minutes | ||
|
|
||
| ## Suggested Commit Strategy | ||
|
|
||
| - Commit 1: config updates (`package.json`, `tsconfig.json`) | ||
| - Commit 2: bulk import rewrite | ||
| - Commit 3: any follow-up fixes from validation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "types": [ | ||
| "node", | ||
| "@playwright/test" | ||
| ] | ||
| }, | ||
| "include": [ | ||
| "playwright.config.ts", | ||
| "tests/**/*.ts" | ||
| ] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After bumping to
eslint@10.2.1,@eslint/jsis no longer installed transitively (it does not appear anywhere in the new lockfile), buteslint.config.jsstill imports it on line 1. On a cleannpm cienvironment this causesnpm run lintto fail at startup with a module resolution error for@eslint/js, so CI and fresh local setups cannot run lint until@eslint/jsis declared directly.Useful? React with 👍 / 👎.