Skip to content

Commit 6d2715d

Browse files
fix: lint
1 parent bf88ac6 commit 6d2715d

File tree

13 files changed

+88
-67
lines changed

13 files changed

+88
-67
lines changed

src/components/DateRangePicker/DateInput/index.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const DateInput = ({
2020
onClickCalendarIcon,
2121
onStartEndDateChange,
2222
placeholder,
23-
enterToSubmit
23+
enterToSubmit,
2424
}) => {
2525
const ref = useRef(null);
2626
const [focused, setFocused] = useState(false);
@@ -127,11 +127,13 @@ const DateInput = ({
127127
value={rangeText}
128128
onChange={(value) => {
129129
if (!enterToSubmit) {
130-
onChangeRangeTextDebounced.current(() => onChangeRangeText(value));
130+
onChangeRangeTextDebounced.current(() =>
131+
onChangeRangeText(value)
132+
);
131133
}
132134
}}
133135
onEnterKey={(value) => {
134-
onChangeRangeText(value)
136+
onChangeRangeText(value);
135137
}}
136138
placeholder={placeholder}
137139
/>

src/components/DateRangePicker/helpers.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ const staticRangeHandler = {
5151
*/
5252
export function createStaticRanges() {
5353
const today = moment();
54-
const endOfToday = today.set({ hour: 23, minute: 59, second: 59, millisecond: 999 });
54+
const endOfToday = today.set({
55+
hour: 23,
56+
minute: 59,
57+
second: 59,
58+
millisecond: 999,
59+
});
5560
const pastWeek = endOfToday.clone().subtract(1, "week");
5661
const pastMonth = endOfToday.clone().subtract(1, "month");
5762
const past6Months = endOfToday.clone().subtract(6, "month");

src/components/DropdownTerms/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function DropdownTerms({
5151
}
5252
}, [focused, selectedOption]);
5353
useEffect(() => {
54-
setInternalTerms(terms);
54+
setInternalTerms(terms); // eslint-disable-next-line react-hooks/exhaustive-deps
5555
}, [terms && terms.length]);
5656

5757
const CustomReactSelectRow = React.forwardRef(

src/components/NotFoundError/index.jsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ const NotFoundError = ({ message }) => (
88
<div>
99
<img src={IconNotFound} alt="not found" />
1010
</div>
11-
<h1>
12-
404 Not found
13-
</h1>
14-
<p>
15-
Sorry, we couldn’t find that page
16-
</p>
11+
<h1>404 Not found</h1>
12+
<p>Sorry, we couldn’t find that page</p>
1713
</div>
1814
);
1915

src/components/Pagination/index.jsx

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,35 +59,40 @@ const Pagination = ({ length, pageIndex, pageSize, onChange }) => {
5959
const [displayPages, setDisplayPages] = useState([]);
6060

6161
useEffect(() => {
62-
let _displayPages = displayPages;
63-
64-
if (!previousPropsRef.current
65-
|| previousPropsRef.current.length !== length
66-
|| previousPropsRef.current.pageSize !== pageSize) {
67-
const newTotal = Math.ceil(length / pageSize);
68-
_displayPages = createDisplayPages(pageIndex, newTotal);
69-
setDisplayPages(_displayPages)
70-
}
62+
let _displayPages = displayPages;
63+
64+
if (
65+
!previousPropsRef.current ||
66+
previousPropsRef.current.length !== length ||
67+
previousPropsRef.current.pageSize !== pageSize
68+
) {
69+
const newTotal = Math.ceil(length / pageSize);
70+
_displayPages = createDisplayPages(pageIndex, newTotal);
71+
setDisplayPages(_displayPages);
72+
}
7173

72-
if (!previousPropsRef.current || previousPropsRef.current.pageIndex !== pageIndex) {
73-
const start = _displayPages[0];
74-
const end = _displayPages[_displayPages.length - 1];
75-
76-
const updateDisplayPages = [];
77-
if (pageIndex < start) {
78-
for (let i = pageIndex; i < pageIndex + N; i += 1) {
79-
updateDisplayPages.push(i);
80-
}
81-
setDisplayPages(updateDisplayPages);
82-
} else if (pageIndex > end) {
83-
for (let i = pageIndex; i > pageIndex - N; i -= 1) {
84-
updateDisplayPages.unshift(i);
85-
}
86-
setDisplayPages(updateDisplayPages);
74+
if (
75+
!previousPropsRef.current ||
76+
previousPropsRef.current.pageIndex !== pageIndex
77+
) {
78+
const start = _displayPages[0];
79+
const end = _displayPages[_displayPages.length - 1];
80+
81+
const updateDisplayPages = [];
82+
if (pageIndex < start) {
83+
for (let i = pageIndex; i < pageIndex + N; i += 1) {
84+
updateDisplayPages.push(i);
8785
}
86+
setDisplayPages(updateDisplayPages);
87+
} else if (pageIndex > end) {
88+
for (let i = pageIndex; i > pageIndex - N; i -= 1) {
89+
updateDisplayPages.unshift(i);
90+
}
91+
setDisplayPages(updateDisplayPages);
8892
}
93+
}
8994

90-
previousPropsRef.current = { length, pageSize, pageIndex };
95+
previousPropsRef.current = { length, pageSize, pageIndex };
9196
}, [length, pageSize, pageIndex, displayPages, setDisplayPages]);
9297

9398
const formatPage = (p) => `${p + 1}`;

src/containers/Challenges/Listing/index.jsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@ const Listing = ({
3737

3838
const onSearch = useRef(_.debounce((f) => f(), 1000));
3939
const onChangeSortBy = (newSortByOptions) => {
40-
const selectedOption = utils.getSelectedDropdownOption(
41-
newSortByOptions
42-
);
40+
const selectedOption = utils.getSelectedDropdownOption(newSortByOptions);
4341
const filterChange = {
4442
sortBy: constants.CHALLENGE_SORT_BY[selectedOption.label],
4543
page: 1,
4644
};
4745
updateFilter(filterChange);
48-
}
46+
};
4947

5048
return (
5149
<Panel>
@@ -112,10 +110,13 @@ const Listing = ({
112110
</div>
113111
</div>
114112
</Panel.Header>
115-
{challenges.length ?
113+
{challenges.length ? (
116114
<Panel.Body>
117115
{challenges.map((challenge, index) => (
118-
<div key={challenge.id} styleName={index % 2 === 0 ? "even" : "odd"}>
116+
<div
117+
key={challenge.id}
118+
styleName={index % 2 === 0 ? "even" : "odd"}
119+
>
119120
<ChallengeItem
120121
challenge={challenge}
121122
onClickTag={(tag) => {
@@ -127,7 +128,7 @@ const Listing = ({
127128
}}
128129
onClickTrack={(track) => {
129130
const filterChange = {
130-
tracks: [track.replace('Quality Assurance', 'QA')],
131+
tracks: [track.replace("Quality Assurance", "QA")],
131132
page: 1,
132133
};
133134
updateFilter(filterChange);
@@ -150,7 +151,10 @@ const Listing = ({
150151
}}
151152
/>
152153
</div>
153-
</Panel.Body> : <ChallengeError /> }
154+
</Panel.Body>
155+
) : (
156+
<ChallengeError />
157+
)}
154158
</Panel>
155159
);
156160
};

src/containers/Challenges/index.jsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,18 @@ const Challenges = ({
4040
}, []);
4141

4242
// reset pagination
43-
if (page > 1 && challengesMeta.total && challengesMeta.total > 0 && challenges.length === 0) {
43+
if (
44+
page > 1 &&
45+
challengesMeta.total &&
46+
challengesMeta.total > 0 &&
47+
challenges.length === 0
48+
) {
4449
updateFilter({
45-
page: 1
46-
})
50+
page: 1,
51+
});
4752
updateQuery({
48-
page: 1
49-
})
53+
page: 1,
54+
});
5055
}
5156

5257
const BUCKET_OPEN_FOR_REGISTRATION = constants.FILTER_BUCKETS[1];

src/containers/Submission/Submit/Uploading/index.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ const Uploading = ({
2828
if (propsRef.current.submitDone) {
2929
const backUrl = window.location.pathname;
3030
if (backUrl === `${CHALLENGES_URL}/${challengeId}`) {
31-
navigate(`${CHALLENGES_URL}/${propsRef.current.challengeId}?reload=true`);
31+
navigate(
32+
`${CHALLENGES_URL}/${propsRef.current.challengeId}?reload=true`
33+
);
3234
}
3335
}
34-
}
36+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
3537
}, []);
3638

3739
return (

src/containers/challenge-detail/index.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,13 @@ class ChallengeDetailPageContainer extends React.Component {
253253

254254
const query = new URLSearchParams(history.location.search);
255255
const isReloading = isLoadingChallenge || isLoadingTerms;
256-
if (query.get('reload') && !isReloading) {
256+
if (query.get("reload") && !isReloading) {
257257
history.replace(history.location.pathname, history.state);
258-
loadChallengeDetails(nextProps.auth, challengeId, loadFullChallengeDetails);
258+
loadChallengeDetails(
259+
nextProps.auth,
260+
challengeId,
261+
loadFullChallengeDetails
262+
);
259263

260264
return;
261265
}

src/routers/challenge-list/index.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ const App = () => {
3737
utils.url.updateQuery(params, true);
3838
} else {
3939
store.dispatch(actions.challenges.getChallengesInit());
40-
store.dispatch(
41-
actions.challenges.getChallengesDone(currentFilter)
42-
);
40+
store.dispatch(actions.challenges.getChallengesDone(currentFilter));
4341
}
44-
42+
4543
return;
4644
}
4745

48-
let search = location.href.split('?').length ? '?' + location.href.split('?')[1]: ''
46+
let search = location.href.split("?").length
47+
? "?" + location.href.split("?")[1]
48+
: "";
4949
const params = utils.url.parseUrlQuery(search);
5050
const toUpdate = utils.challenge.createChallengeFilter(params);
5151

src/topcoder-micro-frontends-challenges-app.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ const lifecycles = singleSpaReact({
1414
rootComponent: Root,
1515
errorBoundary(err, info, props) {
1616
// Customize the root error boundary for your microfrontend here.
17-
return (
18-
<NotFoundError />
19-
);
17+
return <NotFoundError />;
2018
},
2119
});
2220

src/utils/lifeCycle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ export default function appInit() {
1717
async function mount() {
1818
try {
1919
if (firstMounted) {
20-
if (initialQuery && urlPath === '/earn/find/challenges') {
20+
if (initialQuery && urlPath === "/earn/find/challenges") {
2121
const params = utils.url.parseUrlQuery(initialQuery);
2222
const filter = utils.challenge.createChallengeFilter(params);
2323
store.dispatch(action.initApp(filter));
2424
}
2525
firstMounted = false;
2626
}
2727
} catch (error) {
28-
console.error(error)
28+
console.error(error);
2929
} finally {
3030
return Promise.resolve();
3131
}

src/utils/url.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import qs from "qs";
1818
export function buildQueryString(params, disableEncode) {
1919
params = _.omitBy(params, (p) => p == null || p === "" || p.length === 0);
2020
if (!disableEncode) {
21-
params.tags = _.map(params.tags, (t) => encodeURIComponent(t))
21+
params.tags = _.map(params.tags, (t) => encodeURIComponent(t));
2222
}
2323
let queryString = qs.stringify(params, {
2424
encode: false,
@@ -30,11 +30,11 @@ export function buildQueryString(params, disableEncode) {
3030
}
3131

3232
export function parseUrlQuery(queryString) {
33-
let params = qs.parse(queryString, { ignoreQueryPrefix: true });
33+
let params = qs.parse(queryString, { ignoreQueryPrefix: true });
3434
if (params.tags) {
35-
params.tags = _.map(params.tags, (t) => decodeURIComponent(t))
35+
params.tags = _.map(params.tags, (t) => decodeURIComponent(t));
3636
}
37-
return params
37+
return params;
3838
}
3939

4040
export function updateQuery(params, replace = false) {

0 commit comments

Comments
 (0)