From ec458191fbec728b8156f2499a4550340b087ccb Mon Sep 17 00:00:00 2001 From: Ariful Alam Date: Sun, 20 Mar 2022 01:36:43 +0600 Subject: [PATCH] Validate missing prop types --- postcss.config.js | 2 +- src/components/avatar-card/index.jsx | 3 ++- src/components/blog/index.jsx | 6 +++++- src/components/details/index.jsx | 9 +++++++++ src/components/education/index.jsx | 12 +++++++++++- src/components/experience/index.jsx | 12 +++++++++++- src/components/head-tag-editor/index.jsx | 7 ++++--- src/components/lazy-image/index.jsx | 7 +++++++ src/components/project/index.jsx | 1 + src/components/skill/index.jsx | 5 +++++ src/components/theme-changer/index.jsx | 7 +++++++ 11 files changed, 63 insertions(+), 8 deletions(-) diff --git a/postcss.config.js b/postcss.config.js index 33ad091..12a703d 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -3,4 +3,4 @@ module.exports = { tailwindcss: {}, autoprefixer: {}, }, -} +}; diff --git a/src/components/avatar-card/index.jsx b/src/components/avatar-card/index.jsx index 65c0093..bcc94d1 100644 --- a/src/components/avatar-card/index.jsx +++ b/src/components/avatar-card/index.jsx @@ -1,5 +1,5 @@ import PropTypes from 'prop-types'; -import { skeleton } from '../../helpers/utils'; +import { fallbackImage, skeleton } from '../../helpers/utils'; import LazyImage from '../lazy-image'; const AvatarCard = ({ profile, loading }) => { @@ -54,6 +54,7 @@ const AvatarCard = ({ profile, loading }) => { AvatarCard.propTypes = { profile: PropTypes.object, + loading: PropTypes.bool, }; export default AvatarCard; diff --git a/src/components/blog/index.jsx b/src/components/blog/index.jsx index d817cb4..cd8e0b7 100644 --- a/src/components/blog/index.jsx +++ b/src/components/blog/index.jsx @@ -1,10 +1,10 @@ import { getDevtoArticle, getMediumArticle } from 'article-api'; import moment from 'moment'; import { Fragment, useEffect, useState } from 'react'; -import { CgHashtag } from 'react-icons/cg'; import config from '../../ezprofile.config'; import { ga, skeleton } from '../../helpers/utils'; import LazyImage from '../lazy-image'; +import PropTypes from 'prop-types'; const displaySection = () => { if ( @@ -201,4 +201,8 @@ const Blog = ({ loading }) => { ); }; +Blog.propTypes = { + loading: PropTypes.bool, +}; + export default Blog; diff --git a/src/components/details/index.jsx b/src/components/details/index.jsx index a2e808f..63d6fb7 100644 --- a/src/components/details/index.jsx +++ b/src/components/details/index.jsx @@ -189,6 +189,15 @@ const Details = ({ profile, loading }) => { Details.propTypes = { profile: PropTypes.object, + loading: PropTypes.bool, +}; + +ListItem.propTypes = { + icon: PropTypes.node, + title: PropTypes.node, + value: PropTypes.node, + link: PropTypes.string, + skeleton: PropTypes.bool, }; export default Details; diff --git a/src/components/education/index.jsx b/src/components/education/index.jsx index bef8fa0..9702c35 100644 --- a/src/components/education/index.jsx +++ b/src/components/education/index.jsx @@ -1,7 +1,7 @@ -import { GoPrimitiveDot } from 'react-icons/go'; import { skeleton } from '../../helpers/utils'; import config from '../../ezprofile.config'; import { Fragment } from 'react'; +import PropTypes from 'prop-types'; const ListItem = ({ time, degree, institution }) => (
  • @@ -79,4 +79,14 @@ const Education = ({ loading }) => { ); }; +Education.propTypes = { + loading: PropTypes.bool, +}; + +ListItem.propTypes = { + time: PropTypes.node, + degree: PropTypes.node, + institution: PropTypes.node, +}; + export default Education; diff --git a/src/components/experience/index.jsx b/src/components/experience/index.jsx index 1aa1559..fd4567b 100644 --- a/src/components/experience/index.jsx +++ b/src/components/experience/index.jsx @@ -1,7 +1,7 @@ -import { GoPrimitiveDot } from 'react-icons/go'; import { skeleton } from '../../helpers/utils'; import config from '../../ezprofile.config'; import { Fragment } from 'react'; +import PropTypes from 'prop-types'; const ListItem = ({ time, position, company }) => (
  • @@ -79,4 +79,14 @@ const Experience = ({ loading }) => { ); }; +ListItem.propTypes = { + time: PropTypes.node, + position: PropTypes.node, + company: PropTypes.node, +}; + +Experience.propTypes = { + loading: PropTypes.bool, +}; + export default Experience; diff --git a/src/components/head-tag-editor/index.jsx b/src/components/head-tag-editor/index.jsx index beff2a3..048aa29 100644 --- a/src/components/head-tag-editor/index.jsx +++ b/src/components/head-tag-editor/index.jsx @@ -31,9 +31,9 @@ const HeadTagEditor = ({ profile, theme }) => { - - - + + + { HeadTagEditor.propTypes = { profile: PropTypes.object, + theme: PropTypes.string, }; export default HeadTagEditor; diff --git a/src/components/lazy-image/index.jsx b/src/components/lazy-image/index.jsx index 5c54f7d..1d43f55 100644 --- a/src/components/lazy-image/index.jsx +++ b/src/components/lazy-image/index.jsx @@ -1,4 +1,5 @@ import { useState, Fragment, useEffect } from 'react'; +import PropTypes from 'prop-types'; const LazyImage = ({ placeholder, src, alt, ...rest }) => { const [loading, setLoading] = useState(true); @@ -19,4 +20,10 @@ const LazyImage = ({ placeholder, src, alt, ...rest }) => { ); }; +LazyImage.propTypes = { + placeholder: PropTypes.node, + alt: PropTypes.string, + src: PropTypes.string, +}; + export default LazyImage; diff --git a/src/components/project/index.jsx b/src/components/project/index.jsx index b6c2f7b..42e976e 100644 --- a/src/components/project/index.jsx +++ b/src/components/project/index.jsx @@ -167,6 +167,7 @@ const Project = ({ repo, loading }) => { Project.propTypes = { repo: PropTypes.array, + loading: PropTypes.bool, }; export default Project; diff --git a/src/components/skill/index.jsx b/src/components/skill/index.jsx index f782b80..25b1cda 100644 --- a/src/components/skill/index.jsx +++ b/src/components/skill/index.jsx @@ -1,5 +1,6 @@ import config from '../../ezprofile.config'; import { skeleton } from '../../helpers/utils'; +import PropTypes from 'prop-types'; const Skill = ({ loading }) => { const renderSkeleton = () => { @@ -50,4 +51,8 @@ const Skill = ({ loading }) => { ); }; +Skill.propTypes = { + loading: PropTypes.bool, +}; + export default Skill; diff --git a/src/components/theme-changer/index.jsx b/src/components/theme-changer/index.jsx index 3e5ec6d..d63da27 100644 --- a/src/components/theme-changer/index.jsx +++ b/src/components/theme-changer/index.jsx @@ -1,6 +1,7 @@ import { AiOutlineControl } from 'react-icons/ai'; import { skeleton } from '../../helpers/utils'; import config from '../../ezprofile.config'; +import PropTypes from 'prop-types'; const ThemeChanger = ({ theme, setTheme, loading }) => { const changeTheme = (e, selectedTheme) => { @@ -88,4 +89,10 @@ const ThemeChanger = ({ theme, setTheme, loading }) => { ); }; +ThemeChanger.propTypes = { + theme: PropTypes.string, + setTheme: PropTypes.func, + loading: PropTypes.bool, +}; + export default ThemeChanger;