Skip to content
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

Add ESLint rule for new CSS Classes #900

Merged
merged 4 commits into from
Dec 15, 2022

Conversation

jhonnyoddball
Copy link
Contributor

Description

Part of department-of-veterans-affairs/vets-design-system-documentation#1343

This adds two new custom ESLint rules:

use-new-utility-classes

This Eslint rule will help VFS teams to easily update to the new CSS Class library based on USWDS v3.

This is a recommendable ESLint rule which will trigger on the pattern vads-u.

css rule eslint

Testing done

  • Testing in vets-website

Screenshots

Local testing in vets-website using:

Screen Shot 2022-12-13 at 4 10 56 PM

Acceptance criteria

  • [ ]

Definition of done

  • Changes have been tested in vets-website
  • Changes have been tested in IE11, if applicable
  • Documentation has been updated, if applicable
  • A link has been provided to the originating GitHub issue (or connected to it via ZenHub)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs

@@ -185,6 +185,7 @@ module.exports = {
'@department-of-veterans-affairs/prefer-telephone-component': 1,
'@department-of-veterans-affairs/telephone-contact-digits': 1,
'@department-of-veterans-affairs/deprecated-classes': 1,
'@department-of-veterans-affairs/use-new-utility-classes': 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhonnyoddball Do we want this set to 1 already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as recommended by default. But I will turn it off once it's installed in the vets-website

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Can we make sure that there is a follow-up ticket (or task added to a ticket) that reminds us to turn it on in vets-website when we're ready? Carol might be able to help figure out where that should be added.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After thinking about it, I'm going to remove it from the recommended so we don't have to turn it off. And when we are ready we can just upgrade to dependency and manually turn it on.
This is just in case this package is installed in another repo.

const firstErrorClass = classesArray.find(element => element.includes('vads-u'));
const newClass = getNewClass(firstErrorClass);

return newClass.includes('undefined') ? MESSAGE : `${MESSAGE} Try using ${newClass} instead of "${firstErrorClass}"`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit nitpicky but instead of saying "Try using" can we just say "Use the". I think we should be clear that it must be changed and not optional in our wording.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry. Grammatically it might be worded better with just "Use" but I'm sure you got what I meant.

@jhonnyoddball jhonnyoddball requested a review from a team as a code owner December 14, 2022 16:00
@jamigibbs
Copy link
Contributor

@jhonnyoddball In the description of this PR, the screenshot shows it updating a color class. Does this linting rule handle colors?

@jhonnyoddball
Copy link
Contributor Author

No, it just replaces the class portion. Before the --

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants