Skip to content

Conversation

colebemis
Copy link
Contributor

@colebemis colebemis commented Sep 21, 2021

Adds a checkAllStrings option to the no-deprecated-colors rule.

If checkAllStrings is set to true, the no-deprecated-colors rule will check for deprecated colors in all strings. This is useful for catching uses of deprecated colors outside system props and the sx prop.

/* eslint primer-react/no-deprecated-colors: ["warn", {"checkAllStrings": true}] */
import {Box} from '@primer/components'

function ExampleComponent() {
  const styles = {
    // Enabling `checkAllStrings` will find deprecated colors used like this:
    color: 'text.primary'
  }
  return <Box sx={styles}>Hello</Box>
}

This option was needed to find all the uses of deprecated colors in Memex.

@changeset-bot
Copy link

changeset-bot bot commented Sep 21, 2021

🦋 Changeset detected

Latest commit: 31d069b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-primer-react Minor

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

@colebemis colebemis changed the title Check all strings Add checkAllStrings option Sep 21, 2021
@colebemis colebemis marked this pull request as ready for review September 24, 2021 22:40
@colebemis colebemis requested a review from dusave September 24, 2021 22:40
Copy link

@dusave dusave left a comment

Choose a reason for hiding this comment

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

👏🏻 Yes! This is a great addition!!

@colebemis colebemis merged commit 689672c into main Sep 24, 2021
@primer-css primer-css mentioned this pull request Sep 24, 2021
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.

2 participants