-
Notifications
You must be signed in to change notification settings - Fork 115
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
Lint for reserved HTML classes #1823
Merged
Merged
Conversation
This file contains 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
🦋 Changeset detectedLatest commit: b9ed9a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
neall
force-pushed
the
neall/lint-for-reserved-html-classes
branch
from
February 10, 2023 18:46
281d8d6
to
3c85f8a
Compare
neall
had a problem deploying
to
review-pr-1823
February 10, 2023 18:46 — with
GitHub Actions
Failure
neall
force-pushed
the
neall/lint-for-reserved-html-classes
branch
from
February 10, 2023 18:50
3c85f8a
to
a8f50e8
Compare
neall
had a problem deploying
to
review-pr-1823
February 10, 2023 18:51 — with
GitHub Actions
Failure
jonrohan
reviewed
Feb 10, 2023
lib/primer/view_components/linters/view_component_html_classes_counter.rb
Outdated
Show resolved
Hide resolved
In order to preserve our ability to add, remove, and change styles for the HTML classes we create for Primer ViewComponents, this linter will complain if it sees those classes being used in ERB templates.
The `DisallowViewComponentHtmlClasses` linter will scan ERB files for use of classes that we want to reserve for internal use by Primer ViewComponents. This commit augments the `export-css-selectors` script to also generate a list of such classes that we want to restrict. Those classes are written out to `static/classes.json` and read into a constant when the linter is loaded. The script will also add classes to the individual `*.css.json` files that live alongside our CSS files for test purposes. Most of these json files are not committed.
BaseLinter already has class checking and exception count functionality. We did have to modify BaseLinter to allow an empty `TAGS` array constant, thereby checking all tags.
`DisallowComponentCssCounter` hints at the purpose of this linter better than `ViewComponentHtmlClassesCounter`.
neall
force-pushed
the
neall/lint-for-reserved-html-classes
branch
from
February 15, 2023 15:05
a8f50e8
to
bacc554
Compare
camertron
approved these changes
Feb 15, 2023
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.
🎉
@neall is this one ready to go out? 🚀 |
jonrohan
reviewed
Feb 22, 2023
jonrohan
approved these changes
Feb 22, 2023
Merged
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.
Description
This linter checks for HTML classes that we consider "internal" to Primer ViewComponents.
Integration
Merge checklist