-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(eslint-plugin-vtex): right docs url for eslint rules
- Loading branch information
1 parent
5c58793
commit cee7fd5
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/eslint-plugin-vtex/docs/rules/consistent-props-type.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Enforce the consistent way to define the props type (`vtex/consistent-props-type`) | ||
|
||
Examples of **incorrect** code for this rule: | ||
|
||
- Invalid props type name. Must be: DividerProps | ||
|
||
```tsx | ||
type Props = {} | ||
|
||
const Divider = (props: Props) => { | ||
return <hr {...props} /> | ||
} | ||
``` | ||
|
||
- Invalid inline props type. DividerProps must define all the props. | ||
|
||
```tsx | ||
type DividerProps = {} | ||
|
||
const Divider = (props: DividerProps & { inline: true }) => { | ||
return <hr {...props} /> | ||
} | ||
``` | ||
|
||
- Invalid generics props type name. Must be: Props | ||
|
||
```tsx | ||
type DividerProps = {} | ||
|
||
const Divider = <T extends DividerProps>(props: T) => { | ||
return <hr /> | ||
} | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```tsx | ||
type DividerProps = {} | ||
|
||
const Divider = (props: DividerProps) => { | ||
return <hr {...props} /> | ||
} | ||
``` | ||
|
||
```tsx | ||
type DividerProps = {} | ||
|
||
const Divider = <Props extends DividerProps>(props: Props) => { | ||
return <hr /> | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters