Repository navigation
fix(attw): apply profiles to file-based problems - #1108
Merged
Merged
Conversation
✅ Deploy Preview for tsdown-main ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
tsdown
create-tsdown
@tsdown/css
@tsdown/exe
tsdown-migrate
commit: |
1 of 3 tasks
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the ATTW profile-filtering change.
No open issues 🎉
What changed in this PR
Fixes tsdown’s ATTW profile filtering so file-based problems confined to ignored resolutions no longer fail builds, addressing #1096.
Changes:
- Collects visible problem indices from resolutions required by the selected profile.
- Applies visibility filtering alongside
ignoreRulesto both file-based and resolution-based problems. - Adds stub-based tests for
esm-only,node16,strict, and ignored rules.
| File | Description |
|---|---|
src/features/pkg/attw.ts |
Filters problems using entrypoint resolution visibility. |
src/features/pkg/attw.test.ts |
Adds regression tests for profile filtering and ignored rules. |
Review effort: Balanced
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The attw
profilefilter only looked atproblem.resolutionKind. File-based problems (InternalResolutionError,FalseCJS,FalseESM,NamedExports,FalseExportDefault,MissingExportEquals,UnexpectedModuleSyntax,CJSOnlyExportsDefault) don't have that field, so no profile could ignore them. Withprofile: 'esm-only', anode10-only internal resolution error still failed the build.This PR uses the same filtering as the attw CLI's summary output (
problemAffectsResolutionKindinrender/typed.ts). Every problem index is recorded invisibleProblemsof the entrypoint resolutions it affects. A problem is kept only if it is visible from at least one resolution kind the profile still requires.Note that the CLI's exit code (
getExitCode.ts) still filters byresolutionKindonly, soattw --profile esm-onlycan print "No problems found" and still exit 1 (see arethetypeswrong/arethetypeswrong.github.io#248). tsdown follows the documented profile semantics instead. The visible indices are collected into aSetonce, so a single check covers both resolution-based and file-based problems, with no special case forstrict.Tests in
src/features/pkg/attw.test.tsinject a stubbedmodulewith a hand-builtcheckResult, so they run in milliseconds without packing a tarball. They cover theesm-only,node16andstrictprofiles andignoreRules. I also ran the reproduction from #1096 end to end: before this change it fails with💥 Internal resolution error … (node10), after it printsNo problems found.The default profile has been
esm-onlysince 9b3cfca, but the JSDoc,schema.jsonand the lint docs (en and zh-CN) still saidstrict. This PR updates them to match the code.This takes over from #1098; thanks @rudycelekli for the initial investigation.
Closes #1096
Closes #1098