Skip to content

Commit

Permalink
Add new typography size names to no-renamed-props ESLint rule
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer committed Aug 21, 2024
1 parent d22fd1b commit 5a53fd9
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/eslint-plugin-circuit-ui/no-renamed-props/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ Note that the rule can only lint direct uses of a component. Wrapped instances s
Examples of **incorrect** code for this rule:

```tsx
// Since Circuit UI v9
function Component() {
return (
<div>
<Display size="one" />
<Headline size="three" />
<Body size="two" />
</div>
);
}

// Since Circuit UI v7.5
function Component() {
return (
Expand Down Expand Up @@ -53,6 +64,17 @@ function Component() {
Examples of **correct** code for this rule:

```tsx
// Since Circuit UI v9
function Component() {
return (
<div>
<Display size="l" />
<Headline size="m" />
<Body size="s" />
</div>
);
}

// Since Circuit UI v7.5
function Component() {
return (
Expand Down
42 changes: 42 additions & 0 deletions packages/eslint-plugin-circuit-ui/no-renamed-props/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,48 @@ const configs: Config[] = [
});
},
},
{
type: 'values',
component: 'Title',
prop: 'size',
values: {
one: 'l',
two: 'm',
three: 'm',
four: 's',
},
},
{
type: 'values',
component: 'Display',
prop: 'size',
values: {
one: 'l',
two: 'm',
three: 'm',
four: 's',
},
},
{
type: 'values',
component: 'Headline',
prop: 'size',
values: {
one: 'l',
two: 'm',
three: 'm',
four: 's',
},
},
{
type: 'values',
component: 'Body',
prop: 'size',
values: {
one: 'm',
two: 's',
},
},
];

export const noRenamedProps = createRule({
Expand Down

0 comments on commit 5a53fd9

Please sign in to comment.