Skip to content

Commit 9c13d19

Browse files
committed
refactor: add PropTypes
1 parent d0c3bd9 commit 9c13d19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+380
-41
lines changed

.eslintrc.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ module.exports = {
2020
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
2121
],
2222
plugins: ['jsdoc', '@typescript-eslint', 'react', 'react-hooks'],
23-
rules: {
24-
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
25-
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
26-
'react/prop-types': 'off',
27-
},
23+
// rules: {
24+
// // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
25+
// // e.g. "@typescript-eslint/explicit-function-return-type": "off",
26+
// 'react/prop-types': 'off',
27+
// },
2828
}

src/components/accordion/CAccordion.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { forwardRef, HTMLAttributes } from 'react'
2+
import PropTypes from 'prop-types'
23
import classNames from 'classnames'
34

45
export interface CAccordionProps extends HTMLAttributes<HTMLDivElement> {
@@ -23,4 +24,10 @@ export const CAccordion = forwardRef<HTMLDivElement, CAccordionProps>(
2324
},
2425
)
2526

27+
CAccordion.propTypes = {
28+
children: PropTypes.node,
29+
className: PropTypes.string,
30+
flush: PropTypes.bool,
31+
}
32+
2633
CAccordion.displayName = 'CAccordion'

src/components/accordion/CAccordionBody.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { forwardRef, HTMLAttributes } from 'react'
2+
import PropTypes from 'prop-types'
23
import classNames from 'classnames'
34

45
export interface CAccordionBodyProps extends HTMLAttributes<HTMLDivElement> {
@@ -20,4 +21,9 @@ export const CAccordionBody = forwardRef<HTMLDivElement, CAccordionBodyProps>(
2021
},
2122
)
2223

24+
CAccordionBody.propTypes = {
25+
children: PropTypes.node,
26+
className: PropTypes.string,
27+
}
28+
2329
CAccordionBody.displayName = 'CAccordionBody'

src/components/accordion/CAccordionButton.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import React, { forwardRef, HTMLAttributes } from 'react'
2+
import PropTypes from 'prop-types'
23
import classNames from 'classnames'
34

45
export interface CAccordionButtonProps extends HTMLAttributes<HTMLButtonElement> {
56
/**
67
* A string of all className you want applied to the base component. [docs]
78
*/
89
className?: string
10+
/**
11+
* TODO:. [docs]
12+
*/
913
collapsed?: boolean
1014
}
1115

@@ -21,4 +25,10 @@ export const CAccordionButton = forwardRef<HTMLButtonElement, CAccordionButtonPr
2125
},
2226
)
2327

28+
CAccordionButton.propTypes = {
29+
children: PropTypes.node,
30+
className: PropTypes.string,
31+
collapsed: PropTypes.bool,
32+
}
33+
2434
CAccordionButton.displayName = 'CAccordionButton'

src/components/accordion/CAccordionCollapse.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { forwardRef } from 'react'
2+
import PropTypes from 'prop-types'
23
import { CCollapse, CCollapseProps } from '../collapse/CCollapse'
34

45
export const CAccordionCollapse = forwardRef<HTMLDivElement, CCollapseProps>(
@@ -11,4 +12,8 @@ export const CAccordionCollapse = forwardRef<HTMLDivElement, CCollapseProps>(
1112
},
1213
)
1314

15+
CAccordionCollapse.propTypes = {
16+
children: PropTypes.node,
17+
}
18+
1419
CAccordionCollapse.displayName = 'CAccordionCollapse'

src/components/accordion/CAccordionHeader.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { forwardRef, HTMLAttributes } from 'react'
2+
import PropTypes from 'prop-types'
23
import classNames from 'classnames'
34

45
export interface CAccordionHeaderProps extends HTMLAttributes<HTMLDivElement> {
@@ -20,4 +21,9 @@ export const CAccordionHeader = forwardRef<HTMLDivElement, CAccordionHeaderProps
2021
},
2122
)
2223

24+
CAccordionHeader.propTypes = {
25+
children: PropTypes.node,
26+
className: PropTypes.string,
27+
}
28+
2329
CAccordionHeader.displayName = 'CAccordionHeader'

src/components/accordion/CAccordionItem.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { forwardRef, HTMLAttributes } from 'react'
2+
import PropTypes from 'prop-types'
23
import classNames from 'classnames'
34

45
export interface CAccordionItemProps extends HTMLAttributes<HTMLDivElement> {
@@ -20,4 +21,9 @@ export const CAccordionItem = forwardRef<HTMLDivElement, CAccordionItemProps>(
2021
},
2122
)
2223

24+
CAccordionItem.propTypes = {
25+
children: PropTypes.node,
26+
className: PropTypes.string,
27+
}
28+
2329
CAccordionItem.displayName = 'CAccordionItem'

src/components/alert/CAlert.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { forwardRef, HTMLAttributes, useState } from 'react'
2+
import PropTypes from 'prop-types'
23
import classNames from 'classnames'
34
import { Transition } from 'react-transition-group'
45

@@ -13,7 +14,7 @@ export interface CAlertProps extends HTMLAttributes<HTMLDivElement> {
1314
/**
1415
* Sets the color context of the component to one of CoreUI’s themed colors. [docs]
1516
*
16-
* @type 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string
17+
* @type {'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string }
1718
* @default 'primary'
1819
*/
1920
color: Colors
@@ -107,4 +108,15 @@ export const CAlert = forwardRef<HTMLDivElement, CAlertProps>(
107108
},
108109
)
109110

111+
CAlert.propTypes = {
112+
children: PropTypes.node,
113+
className: PropTypes.string,
114+
color: PropTypes.string.isRequired,
115+
dismissible: PropTypes.bool,
116+
onDismiss: PropTypes.func,
117+
onDismissed: PropTypes.func,
118+
variant: PropTypes.string,
119+
visible: PropTypes.bool,
120+
}
121+
110122
CAlert.displayName = 'CAlert'

src/components/alert/CAlertHeading.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { ElementType, forwardRef, HTMLAttributes } from 'react'
2+
import PropTypes from 'prop-types'
23
import classNames from 'classnames'
34

45
export interface CAlertHeadingProps extends HTMLAttributes<HTMLHeadingElement> {
@@ -26,4 +27,10 @@ export const CAlertHeading = forwardRef<HTMLHeadingElement, CAlertHeadingProps>(
2627
},
2728
)
2829

30+
CAlertHeading.propTypes = {
31+
children: PropTypes.node,
32+
className: PropTypes.string,
33+
component: PropTypes.elementType,
34+
}
35+
2936
CAlertHeading.displayName = 'CAlertHeading'

src/components/alert/CAlertLink.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { AnchorHTMLAttributes, forwardRef } from 'react'
2+
import PropTypes from 'prop-types'
23
import classNames from 'classnames'
34

45
import { CLink } from '../link/CLink'
@@ -8,14 +9,6 @@ export interface CAlertLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement>
89
* A string of all className you want applied to the base component. [docs]
910
*/
1011
className?: string
11-
/**
12-
* The href attribute specifies the URL of the page the link goes to. [docs]
13-
*/
14-
href?: string
15-
// /**
16-
// * A string representation of the Link location, created by concatenating the location’s pathname, search, and hash properties. [docs]
17-
// */
18-
// to?: string
1912
}
2013

2114
export const CAlertLink = forwardRef<HTMLAnchorElement, CAlertLinkProps>(
@@ -30,4 +23,9 @@ export const CAlertLink = forwardRef<HTMLAnchorElement, CAlertLinkProps>(
3023
},
3124
)
3225

26+
CAlertLink.propTypes = {
27+
children: PropTypes.node,
28+
className: PropTypes.string,
29+
}
30+
3331
CAlertLink.displayName = 'CAlertLink'

0 commit comments

Comments
 (0)