-
Notifications
You must be signed in to change notification settings - Fork 653
refactor(rome_analyze): align the syntax of lint suppression with the corresponding diagnostic category #3788
Conversation
✅ Deploy Preview for docs-rometools ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Parser conformance results on ubuntu-latestjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
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.
Could you please add a new snapshot test in the CLI that shows the new diagnostic emitted for old suppression comments?
crates/rome_analyze/src/lib.rs
Outdated
let signal = DiagnosticSignal::new(move || { | ||
SuppressionDiagnostic::new( | ||
file_id, | ||
category!("suppressions/deprecatedSyntax"), | ||
range, | ||
"Suppression is using a deprecated syntax", | ||
) | ||
}); |
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.
Here this diagnostics could have the tag DiagnosticTags::DEPRECATED_CODE
. It doesn't make much sense to keep two different comment styles and should stick with one.
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.
} | ||
} | ||
DiagnosticKind::Raw(error) => { | ||
DiagnosticKind::Raw(error.with_tags(DiagnosticTags::FIXABLE)) |
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.
Are the final tags joined together with this function? Because diagnostics emitted for old suppression comments should deprecated and fixable.
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.
Yes I've implemented the .with_tags
combinator to return a new diagnostic that has both the tags of the inner diagnostics in addition to the ones passed in to the function
a24123d
to
fc2e2c7
Compare
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.
Not a blocker, but I still think that these diagnostics should be tagged as deprecations.
Also, can these warnings block rome ci
? If yes, we should demote them to simple info diagnostics. Otherwise, I think we can merge it!
…the corresponding diagnostic category
fc2e2c7
to
da9e60c
Compare
Warnings should not cause |
Summary
Fixes #3446
This PR changes the syntax of lint suppression comments from
rome-ignore lint(group/rule)
torome-ignore lint/group/rule
to align with how lint categories are presented in diagnostics. I've tried to keep backwards compatibility by continuing to parse the previous syntax, and emitting a diagnostic with a safe fix when such a comment is encountered by the linter.Test Plan
I've extended the suppression comment tests in
rome_js_analyze
to check that both the new and old syntax remain supported, and that a diagnostic is correctly emitted for the deprecated syntax. Additionally I've also used a local build of the language server to apply the automatic fix to all the files with suppression comments that we have.