Skip to content

[no-deprecated-colors] Add skipImportCheck option #7

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

Merged
merged 5 commits into from
Sep 20, 2021

Conversation

colebemis
Copy link
Contributor

@colebemis colebemis commented Sep 18, 2021

Problem

Memex has components that pass system props down to Primer React components (example).

import {TextInput} from '@primer/components'
import styled from 'styled-components'

const BorderlessTextInput = styled(TextInput)`
  border: 0;
`

If someone passes a deprecated to these wrapper components, the no-deprecated-colors rule won't notice it because it only looks at props passed to components imported from @primer/components.

<BorderlessTextInput color="some.deprecated.color" />
// `no-deprecated-colors` won't warn us about this

Solution

In this PR, I added a skipImportCheck option. By default, the no-deprecated-colors rule will only check for deprecated colors used in functions and components that are imported from @primer/components. You can disable this behavior by setting skipImportCheck to true. This is useful for linting custom components that that pass color-related props down to Primer React components.

@changeset-bot
Copy link

changeset-bot bot commented Sep 18, 2021

🦋 Changeset detected

Latest commit: d9dfb8d

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 Patch

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 requested a review from jonrohan September 18, 2021 02:56
@colebemis colebemis changed the title [no-deprecated-colors] Add checkImport option [no-deprecated-colors] Add skipImportCheck option Sep 20, 2021
@colebemis colebemis merged commit 6bbafca into main Sep 20, 2021
@primer-css primer-css mentioned this pull request Sep 20, 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