-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
filenames
to component and proptype nodes (#9)
- Loading branch information
Showing
8 changed files
with
2,680 additions
and
12 deletions.
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
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
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
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
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,20 @@ | ||
import * as React from 'react'; | ||
|
||
// it's technically not correct since this descripts props the component | ||
// sees not just the one available to the user. We're abusing this to provide | ||
// some concrete documentation for `key` regarding this component | ||
export interface SnackBarProps extends React.HTMLAttributes<any> { | ||
/** | ||
* some hints about state reset that relates to prop of this component | ||
*/ | ||
key?: any; | ||
} | ||
|
||
export function Snackbar(props: SnackBarProps) { | ||
return <div {...props} />; | ||
} | ||
|
||
// here we don't care about `key` | ||
export function SomeOtherComponent(props: { children?: React.ReactNode }) { | ||
return <div>{props.children}</div>; | ||
} |
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,19 @@ | ||
import * as path from 'path'; | ||
import { TestOptions } from '../../types'; | ||
|
||
const options: TestOptions = { | ||
injector: { | ||
includeUnusedProps: true, | ||
shouldInclude: ({ prop }) => { | ||
let isLocallyTyped = false; | ||
prop.filenames.forEach((filename) => { | ||
if (!path.relative(__dirname, filename).startsWith('..')) { | ||
isLocallyTyped = true; | ||
} | ||
}); | ||
return isLocallyTyped; | ||
}, | ||
}, | ||
}; | ||
|
||
export default options; |
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,24 @@ | ||
import * as React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
function Snackbar(props) { | ||
return <div {...props} />; | ||
} | ||
// here we don't care about `key` | ||
|
||
Snackbar.propTypes = { | ||
/** | ||
* some hints about state reset that relates to prop of this component | ||
*/ | ||
key: PropTypes.any, | ||
}; | ||
|
||
export { Snackbar }; | ||
function SomeOtherComponent(props) { | ||
return <div>{props.children}</div>; | ||
} | ||
|
||
SomeOtherComponent.propTypes = { | ||
children: PropTypes.node, | ||
}; | ||
|
||
export { SomeOtherComponent }; |
Oops, something went wrong.