-
Notifications
You must be signed in to change notification settings - Fork 10
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
V2 Annotation #37
base: master
Are you sure you want to change the base?
V2 Annotation #37
Conversation
new Range( | ||
new Location(i, startColumnIgnore), | ||
new Location(Integer.MAX_VALUE, Integer.MAX_VALUE) | ||
new Location(i, Integer.MAX_VALUE) |
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.
Is changing Integer.MAX_VALUE
to i
intentional? From what I recall (rather vaguely) the point here was to figure out the range that suppression should be applied to.
For example, if we had a doc with 100 lines and at line i=50
we encountered sldsValidatorIgnore
but in lines 51-100 there were no mention of sldsValidatorAllow
then we would want to suppress warnings in lines 50-100 (which I believe is consistent with ESLint rules).
But with this change here, we would only ignore lines 50-50 instead.
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.
In the previous version, annotation applied to the line only. Let me play with it to see what the syntax would look like. Thanks.
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 is what I'm thinking for CSS, let me know what you think
/* ESLint Pattern */
/* @sldsValidatorIgnore */ .THIS { padding: 0; } /* @sldsValidatorAllow */
.THIS { /* @sldsValidatorIgnoreNextLine */
padding: 0;
padding: 0;
}
/*CSS Lint Pattern for inline ignore */
.THIS { /* @sldsValidatorIgnore */ padding: 0
padding: 0; }
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.
When I was adding the support for linting warning suppression for HTML files, I decided to use <!-- sldsValidatorIgnoreNextLine -->
for ignoring the line containing the warning and to use <!-- sldsValidatorIgnore -->
+ <!-- sldsValidatorAllow -->
to ignore a range... and if we added <!-- sldsValidatorIgnore -->
without <!-- sldsValidatorAllow -->
then all the following lines would be ignored. Here's a screenshot of this behavior:
I decided to implement it this way b/c this seemed to be inline with what I was observing with ESLint in VSCode on a Typescript file. I did not design the suppression per HTML tag or what an HTML tag would contain, but rather it was purely based on row/column ranges in a document.
I would leave it at your discretion to decide whether it makes sense to follow the same pattern for CSS files or not... although it would be nice to have the same behavior everywhere.
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.
Left a comment about suppression approach I used for HTML files vs what you're using for CSS files. I'll leave it up to you to decide on the approach best fitting for CSS files. Aside from that LGTM 👍
V2 Annotation to enable Eslint-like behavior to ignore / to allow SLDS Recommendation. With this PR, SLDS-LSP supports the follow: In-Line Option, Full File Option, Global Option.
This PR changes how CSS handles Annotation.