Skip to content

Add an eslint rule for updating Octicon to a named icon from @primer/octicons-react #375

@joshblack

Description

@joshblack

We are removing the Octicon component that is imported from @primer/react/deprecated in the next major release of this package. We would like to update usage of this component to use the icon directly from @primer/octicons-react instead.

This rule should do the following:

  • Update usage like <Octicon icon={XIcon} /> to be <XIcon /> and should remove the import to Octicons from @primer/react/deprecated
  • Preserve additional props on the component, like <Octicon {...rest} className="test" icon={XIcon} /> should map to <XIcon {...rest} className="test" />
  • If there is logic in the icon prop, like conditionally rendered, then it should preserve that condition when rendering the icons and correctly map props to each
  • It should also support updating dynamic icon lookups, like <Octicon icon={icon} />, by replacing the call to icon with the icon directly, like: <Icon />

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions