Repository navigation
fix(anti-slop): honor disable-next-line before asserted expression - #85
Merged
Merged
Conversation
The safety-comment rule now accepts a `disable-next-line` on the line before `as` even when that line is inside the asserted expression. For the tsgolint range that reports on assertion syntax, only same-line and block disables were honored before, so multi-line assertions with a next-line disable were flagged incorrectly. Signed-off-by: howmanysmall <26746527+howmanysmall@users.noreply.github.com>
Signed-off-by: howmanysmall <26746527+howmanysmall@users.noreply.github.com>
Contributor
Bundle size
Raw, uncompressed bytes from the minified |
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.
Summary
type({ ... }).readonly() as unknown as Type<BunFile>with the suppression on the line beforeasis a justification. The old path only saw that comment when it already knewoxlint-tsgolintwas 7.0.2002 or newer.Evidence
missingSafetyCommenton bothas unknownandas Type<BunFile>even with// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- slopwareimmediately above the assertion.After:
nr test:agent -- tests/rules/anti-slop/require-safety-comment-for-type-assertion.test.tspasses, including that case with notsgolintVersionsetting.Merge Danger
Door: two-way
Revert the rule and the test. No data migration.
Blast Radius: consumers
Fewer
require-safety-comment-for-type-assertionreports when a describeddisable-next-linesits on the line beforeas. Same-linedisable-linestill depends on the 7.0.2002 diagnostic range.