chore: refactor logic for ignoring warnings #11300
Merged
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.
Wanted to take a look at this before doing #11294 but for warnings.
It feels really weird that we need to pass the current
path
intowarn(...)
in order to extractsvelte-ignore
comments — this is exactly the sort of thingstate
is supposed to be used for. So this PR inverts things: we capture ignore comments on the way down rather than searching up for them when we encounter a warning.There is a wrinkle: because we can't use
context.visit(...)
during the analysis phase, we need to attach the set of ignored codes directly to the node in question, which is a bit hacky. We have this restriction because of our visitor merging logic. I've felt for some time now that this approach introduces much more complexity than it reduces, and that we'd be much better off having a single visitor per node during the analysis phase. I'm trying very hard to resist the temptation to validate this hypothesis until later when there are fewer more pressing concerns.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint