Skip to content

Commit

Permalink
feat: add propTypes check (add sortShapeProp) (#1336)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark86092 authored Jun 17, 2024
1 parent 4c54280 commit 8cb4573
Show file tree
Hide file tree
Showing 23 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ module.exports = {
'no-use-before-define': 'error',
'react/prop-types': 'error',
'react/no-unused-prop-types': 'error',
'react/sort-prop-types': 'error',
'react/sort-prop-types': ['error', {'sortShapeProp': true}],
},
};
2 changes: 1 addition & 1 deletion src/components/About/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const Timeline = ({ year, data }) => (
Timeline.propTypes = {
data: PropTypes.arrayOf(
PropTypes.shape({
month: PropTypes.number.isRequired,
Content: PropTypes.func.isRequired,
month: PropTypes.number.isRequired,
}),
),
year: PropTypes.number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ const SubscriptionPlanCollection = ({ plans, selectedId, setSelectedId }) => (
SubscriptionPlanCollection.propTypes = {
plans: PropTypes.arrayOf(
PropTypes.shape({
amount: PropTypes.number.isRequired,
description: PropTypes.string.isRequired,
skuId: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
amount: PropTypes.number.isRequired,
type: PropTypes.oneOf(subscriptionTypes).isRequired,
}),
),
Expand Down
4 changes: 2 additions & 2 deletions src/components/Buy/SubscriptionsSection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ const SubscriptionsSection = ({
SubscriptionsSection.propTypes = {
plans: PropTypes.arrayOf(
PropTypes.shape({
skuId: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
amount: PropTypes.number.isRequired,
duration: PropTypes.shape({
amount: PropTypes.number.isRequired,
type: PropTypes.string.isRequired,
}),
skuId: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
}),
),
selectedId: PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion src/components/CompanyAndJobTitle/IndexPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ const CompanyAndJobTitleIndex = ({
CompanyAndJobTitleIndex.propTypes = {
getPageLink: PropTypes.func.isRequired,
indexesBox: PropTypes.shape({
status: PropTypes.string.isRequired,
data: PropTypes.arrayOf(
PropTypes.shape({
name: PropTypes.string.isRequired,
}),
),
error: PropTypes.any,
status: PropTypes.string.isRequired,
}),
// pagination usage
page: PropTypes.number.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ const AverageWeekWorkTimeView = ({
AverageWeekWorkTimeView.propTypes = {
averageWeekWorkTime: PropTypes.number.isRequired,
overtimeFrequencyCount: PropTypes.shape({
almost_everyday: PropTypes.number,
seldom: PropTypes.number,
sometimes: PropTypes.number,
usually: PropTypes.number,
almost_everyday: PropTypes.number,
}).isRequired,
};

Expand Down
14 changes: 7 additions & 7 deletions src/components/CompanyAndJobTitle/Overview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,20 @@ const Overview = ({
Overview.propTypes = {
canView: PropTypes.bool.isRequired,
overviewBox: PropTypes.shape({
status: PropTypes.string.isRequired,
data: PropTypes.shape({
averageWeekWorkTime: PropTypes.number.isRequired,
interviewExperiences: PropTypes.arrayOf(PropTypes.object).isRequired,
interviewExperiencesCount: PropTypes.number.isRequired,
workExperiences: PropTypes.arrayOf(PropTypes.object).isRequired,
workExperiencesCount: PropTypes.number.isRequired,
salaryWorkTimes: PropTypes.arrayOf(PropTypes.object).isRequired,
salaryWorkTimesCount: PropTypes.number.isRequired,
salaryDistribution: PropTypes.array,
jobAverageSalaries: PropTypes.array,
averageWeekWorkTime: PropTypes.number.isRequired,
overtimeFrequencyCount: PropTypes.object.isRequired,
salaryDistribution: PropTypes.array,
salaryWorkTimes: PropTypes.arrayOf(PropTypes.object).isRequired,
salaryWorkTimesCount: PropTypes.number.isRequired,
workExperiences: PropTypes.arrayOf(PropTypes.object).isRequired,
workExperiencesCount: PropTypes.number.isRequired,
}),
error: PropTypes.any,
status: PropTypes.string.isRequired,
}).isRequired,
page: PropTypes.number.isRequired,
pageName: PropTypes.string.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ TimeAndSalary.propTypes = {
pageType: PropTypes.string,
queryParams: PropTypes.object,
salaryWorkTimeStatistics: PropTypes.shape({
count: PropTypes.number,
average_estimated_hourly_wage: PropTypes.number,
average_week_work_time: PropTypes.number,
count: PropTypes.number,
}),
salaryWorkTimes: PropTypes.array,
tabType: PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion src/components/CompanyAndJobTitle/TimeAndSalary/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ TimeAndSalary.propTypes = {
pageName: PropTypes.string,
pageType: PropTypes.string,
salaryWorkTimeStatistics: PropTypes.shape({
count: PropTypes.number,
average_estimated_hourly_wage: PropTypes.number,
average_week_work_time: PropTypes.number,
count: PropTypes.number,
}),
salaryWorkTimes: PropTypes.array,
status: PropTypes.string.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ExperienceDetail/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ const ExperienceDetail = ({ ...props }) => {
ExperienceDetail.propTypes = {
location: PropTypes.shape({
state: PropTypes.shape({
replyId: PropTypes.string,
pageType: PropTypes.string,
replyId: PropTypes.string,
}),
}),
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/LandingPage/SummarySection.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,18 @@ const SummarySection = ({
SummarySection.propTypes = {
popularCompanyAverageSalary: PropTypes.arrayOf(
PropTypes.shape({
average_salaries: PropTypes.array,
company: PropTypes.shape({
name: PropTypes.string,
}),
average_salaries: PropTypes.array,
}),
).isRequired,
popularJobTitleSalaryDistribution: PropTypes.arrayOf(
PropTypes.shape({
bins: PropTypes.array,
job_title: PropTypes.shape({
name: PropTypes.string,
}),
bins: PropTypes.array,
}),
).isRequired,
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/Me/CurrentSubscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ const CurrentSubscription = ({ subscriptionPlan, expiredAt }) => {
CurrentSubscription.propTypes = {
expiredAt: PropTypes.string,
subscriptionPlan: PropTypes.shape({
title: PropTypes.string,
amount: PropTypes.number,
description: PropTypes.string,
title: PropTypes.string,
type: PropTypes.string,
amount: PropTypes.number,
}),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ WorkExperience.propTypes = {
removeSection: PropTypes.func,
sections: PropTypes.arrayOf(
PropTypes.shape({
content: PropTypes.string,
id: PropTypes.number,
subtitle: PropTypes.string,
content: PropTypes.string,
}),
),
submitted: PropTypes.bool,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ShareExperience/common/SectionEleContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ SectionEleContent.propTypes = {
placeholder: PropTypes.string,
removeSection: PropTypes.func,
section: PropTypes.shape({
content: PropTypes.string,
id: PropTypes.number,
subtitle: PropTypes.string,
content: PropTypes.string,
}).isRequired,
submitted: PropTypes.bool.isRequired,
titlePlaceholder: PropTypes.string,
Expand Down
6 changes: 3 additions & 3 deletions src/components/ShareExperience/common/Sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ Sections.propTypes = {
removeSection: PropTypes.func,
sections: PropTypes.arrayOf(
PropTypes.shape({
content: PropTypes.string,
id: PropTypes.number,
subtitle: PropTypes.string,
isSubtitleEditable: PropTypes.bool,
placeholder: PropTypes.string,
subtitle: PropTypes.string,
titlePlaceholder: PropTypes.string,
content: PropTypes.string,
isSubtitleEditable: PropTypes.bool,
}),
),
submitted: PropTypes.bool,
Expand Down
6 changes: 3 additions & 3 deletions src/components/common/Charts/JobTitleDistrubitionChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ const JobTitleDistributionChart = ({ data }) => {
JobTitleDistributionChart.propTypes = {
data: PropTypes.arrayOf(
PropTypes.shape({
job_title: PropTypes.shape({
name: PropTypes.string,
}),
average_salary: PropTypes.shape({
amount: PropTypes.number,
}),
job_title: PropTypes.shape({
name: PropTypes.string,
}),
}),
).isRequired,
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/Charts/SalaryDistributionChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ const LabelOnSmallDevice = ({ viewBox: { x, y, width, height } }) => {

LabelOnSmallDevice.propTypes = {
viewBox: PropTypes.shape({
height: PropTypes.number.isRequired,
width: PropTypes.number.isRequired,
x: PropTypes.number.isRequired,
y: PropTypes.number.isRequired,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
}).isRequired,
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/common/FeedbackBlock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class FeedbackBlock extends React.Component {
category: PropTypes.string.isRequired,
className: PropTypes.string,
placeholders: PropTypes.shape({
yes: PropTypes.string,
no: PropTypes.string,
yes: PropTypes.string,
}),
question: PropTypes.string,
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/TabLinkGroup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ TabLinkGroup.propTypes = {
to: PropTypes.oneOfType([
PropTypes.string,
PropTypes.shape({
hash: PropTypes.string,
pathname: PropTypes.string,
search: PropTypes.string,
hash: PropTypes.string,
state: PropTypes.object,
}),
]),
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/button/ButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ ButtonGroup.propTypes = {
onChange: PropTypes.func,
options: PropTypes.arrayOf(
PropTypes.shape({
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}),
),
value: PropTypes.oneOfType([
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/button/ButtonGroupImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ ButtonGroupImage.propTypes = {
onChange: PropTypes.func,
options: PropTypes.arrayOf(
PropTypes.shape({
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
icon: PropTypes.node,
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}),
),
theme: PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/form/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Select.propTypes = {
onChange: PropTypes.func,
options: PropTypes.arrayOf(
PropTypes.shape({
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}),
),
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
Expand Down
2 changes: 1 addition & 1 deletion src/utils/fetchBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const initFetchBox = (

export const fetchBoxPropType = PropTypes.shape({
data: PropTypes.any,
status: PropTypes.oneOf(Object.values(fetchingStatus)),
error: PropTypes.any,
status: PropTypes.oneOf(Object.values(fetchingStatus)),
});

const getStatus = prop('status');
Expand Down

0 comments on commit 8cb4573

Please sign in to comment.