Skip to content

Commit 5ef9868

Browse files
refactor: remove unused vars (freeCodeCamp#59658)
1 parent 9d2701b commit 5ef9868

18 files changed

Lines changed: 31 additions & 58 deletions

File tree

client/src/components/profile/components/timeline-buttons.test.js

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,13 @@ jest.mock('gatsby', () => {
2323
}
2424
}),
2525
graphql: jest.fn(),
26-
Link: jest
27-
.fn()
28-
.mockImplementation(
29-
({
30-
activeClassName,
31-
activeStyle,
32-
getProps,
33-
innerRef,
34-
partiallyActive,
35-
ref,
36-
replace,
37-
to,
38-
...rest
39-
}) =>
40-
React.createElement('a', {
41-
...rest,
42-
href: to,
43-
gatsby: 'true'
44-
})
45-
)
26+
Link: jest.fn().mockImplementation(({ to, ...rest }) =>
27+
React.createElement('a', {
28+
...rest,
29+
href: to,
30+
gatsby: 'true'
31+
})
32+
)
4633
};
4734
});
4835

client/src/redux/donation-saga.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export function* updateCardSaga() {
202202

203203
if (!sessionId) throw new Error('No sessionId');
204204
(yield stripe).redirectToCheckout({ sessionId });
205-
} catch (error) {
205+
} catch {
206206
yield put(updateCardError(updateCardErrorMessage));
207207
}
208208
}

client/src/redux/save-challenge-saga.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function* saveChallengeSaga() {
6666
})
6767
);
6868
}
69-
} catch (e) {
69+
} catch {
7070
yield put(
7171
createFlashMessage({
7272
type: 'danger',

client/src/redux/settings/settings-sagas.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function* submitProfileUISaga({ payload }) {
8080
const { data } = yield call(putUpdateMyProfileUI, payload);
8181
yield put(submitProfileUIComplete({ ...data, payload }));
8282
yield put(createFlashMessage(data));
83-
} catch (e) {
83+
} catch {
8484
yield put(submitProfileUIError);
8585
}
8686
}
@@ -90,7 +90,7 @@ function* updateMySocialsSaga({ payload: update }) {
9090
const { data } = yield call(putUpdateMySocials, update);
9191
yield put(updateMySocialsComplete({ ...data, payload: update }));
9292
yield put(createFlashMessage({ ...data }));
93-
} catch (e) {
93+
} catch {
9494
yield put(updateMySocialsError);
9595
}
9696
}
@@ -104,7 +104,7 @@ function* updateMySoundSaga({ payload: update }) {
104104
};
105105
yield put(updateMySoundComplete({ ...data, payload: update }));
106106
yield put(createFlashMessage({ ...data }));
107-
} catch (e) {
107+
} catch {
108108
yield put(updateMySoundError);
109109
}
110110
}
@@ -123,7 +123,7 @@ function* resetMyEditorLayoutSaga() {
123123

124124
yield put(createFlashMessage({ ...data }));
125125
yield put(resetMyEditorLayoutComplete({ ...data }));
126-
} catch (e) {
126+
} catch {
127127
yield put(resetMyEditorLayoutError);
128128
}
129129
}
@@ -134,7 +134,7 @@ function* updateMyKeyboardShortcutsSaga({ payload: update }) {
134134
const { data } = yield call(putUpdateMyKeyboardShortcuts, update);
135135
yield put(updateMyKeyboardShortcutsComplete({ ...data, payload: update }));
136136
yield put(createFlashMessage({ ...data }));
137-
} catch (e) {
137+
} catch {
138138
yield put(updateMyKeyboardShortcutsError);
139139
}
140140
}
@@ -144,7 +144,7 @@ function* updateMyHonestySaga({ payload: update }) {
144144
const { data } = yield call(putUpdateMyHonesty, update);
145145
yield put(updateMyHonestyComplete({ ...data, payload: update }));
146146
yield put(createFlashMessage({ ...data }));
147-
} catch (e) {
147+
} catch {
148148
yield put(updateMyHonestyError);
149149
}
150150
}
@@ -154,7 +154,7 @@ function* updateMyQuincyEmailSaga({ payload: update }) {
154154
const { data } = yield call(putUpdateMyQuincyEmail, update);
155155
yield put(updateMyQuincyEmailComplete({ ...data, payload: update }));
156156
yield put(createFlashMessage({ ...data }));
157-
} catch (e) {
157+
} catch {
158158
yield put(updateMyQuincyEmailError);
159159
}
160160
}
@@ -164,7 +164,7 @@ function* updateMyPortfolioSaga({ payload: update }) {
164164
const { data } = yield call(putUpdateMyPortfolio, update);
165165
yield put(updateMyPortfolioComplete({ ...data, payload: update }));
166166
yield put(createFlashMessage({ ...data }));
167-
} catch (e) {
167+
} catch {
168168
yield put(updateMyPortfolioError);
169169
}
170170
}

client/src/redux/user-token-saga.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function* deleteUserTokenSaga() {
2626
} else {
2727
yield put(createFlashMessage(message.deleteErr));
2828
}
29-
} catch (e) {
29+
} catch {
3030
yield put(createFlashMessage(message.deleteErr));
3131
}
3232
}

client/src/templates/Challenges/redux/code-storage-epic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function saveCodeEpic(action$, state$) {
9797
throw Error('Failed to save to localStorage');
9898
}
9999
return action;
100-
} catch (e) {
100+
} catch {
101101
return { ...action, error: true };
102102
}
103103
}),

client/src/templates/Challenges/redux/execute-challenge-saga.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const initialState = {
1010
};
1111

1212
// We're not testing the reducer here, so just return the initial state
13-
function reducer(state = initialState, _action) {
13+
function reducer(state = initialState) {
1414
return state;
1515
}
1616

curriculum/get-challenges.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ async function buildChallenges({ path: filePath }, curriculum, lang) {
266266
return;
267267
}
268268
} catch (e) {
269+
console.error(e);
269270
console.log(`failed to create superBlock from ${superBlockDir}`);
270271
process.exit(1);
271272
}

curriculum/schema/challenge-schema.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ const Joi = require('joi');
22
Joi.objectId = require('joi-objectid')(Joi);
33

44
const { challengeTypes } = require('../../shared/config/challenge-types');
5-
const {
6-
SuperBlocks,
7-
chapterBasedSuperBlocks
8-
} = require('../../shared/config/curriculum');
5+
const { chapterBasedSuperBlocks } = require('../../shared/config/curriculum');
96
const {
107
availableCharacters,
118
availableBackgrounds,

curriculum/test/test-challenges.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ const {
5151
createContent,
5252
testId
5353
} = require('../../client/src/templates/Challenges/utils/frame');
54-
const {
55-
SuperBlocks,
56-
chapterBasedSuperBlocks
57-
} = require('../../shared/config/curriculum');
54+
const { chapterBasedSuperBlocks } = require('../../shared/config/curriculum');
5855
const ChallengeTitles = require('./utils/challenge-titles');
5956
const MongoIds = require('./utils/mongo-ids');
6057
const createPseudoWorker = require('./utils/pseudo-worker');
@@ -439,7 +436,7 @@ function populateTestsForLang({ lang, challenges, meta, superBlocks }) {
439436
for (const test of tests) {
440437
try {
441438
await testRunner(test);
442-
} catch (e) {
439+
} catch {
443440
fails = true;
444441
break;
445442
}
@@ -682,13 +679,7 @@ async function getWorkerEvaluator({
682679
};
683680
}
684681

685-
async function initializeTestRunner({
686-
build,
687-
sources,
688-
code,
689-
loadEnzyme,
690-
hooks
691-
}) {
682+
async function initializeTestRunner({ build, sources, loadEnzyme, hooks }) {
692683
await page.reload();
693684
await page.setContent(createContent(testId, { build, sources, hooks }));
694685
await page.evaluate(

0 commit comments

Comments
 (0)