mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 18:18:27 -05:00
refactor: remove unused vars (#59658)
This commit is contained in:
committed by
GitHub
parent
9d2701b1ab
commit
5ef98680f9
@@ -23,26 +23,13 @@ jest.mock('gatsby', () => {
|
||||
}
|
||||
}),
|
||||
graphql: jest.fn(),
|
||||
Link: jest
|
||||
.fn()
|
||||
.mockImplementation(
|
||||
({
|
||||
activeClassName,
|
||||
activeStyle,
|
||||
getProps,
|
||||
innerRef,
|
||||
partiallyActive,
|
||||
ref,
|
||||
replace,
|
||||
to,
|
||||
...rest
|
||||
}) =>
|
||||
React.createElement('a', {
|
||||
...rest,
|
||||
href: to,
|
||||
gatsby: 'true'
|
||||
})
|
||||
)
|
||||
Link: jest.fn().mockImplementation(({ to, ...rest }) =>
|
||||
React.createElement('a', {
|
||||
...rest,
|
||||
href: to,
|
||||
gatsby: 'true'
|
||||
})
|
||||
)
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ export function* updateCardSaga() {
|
||||
|
||||
if (!sessionId) throw new Error('No sessionId');
|
||||
(yield stripe).redirectToCheckout({ sessionId });
|
||||
} catch (error) {
|
||||
} catch {
|
||||
yield put(updateCardError(updateCardErrorMessage));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ function* saveChallengeSaga() {
|
||||
})
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
yield put(
|
||||
createFlashMessage({
|
||||
type: 'danger',
|
||||
|
||||
@@ -80,7 +80,7 @@ function* submitProfileUISaga({ payload }) {
|
||||
const { data } = yield call(putUpdateMyProfileUI, payload);
|
||||
yield put(submitProfileUIComplete({ ...data, payload }));
|
||||
yield put(createFlashMessage(data));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
yield put(submitProfileUIError);
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ function* updateMySocialsSaga({ payload: update }) {
|
||||
const { data } = yield call(putUpdateMySocials, update);
|
||||
yield put(updateMySocialsComplete({ ...data, payload: update }));
|
||||
yield put(createFlashMessage({ ...data }));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
yield put(updateMySocialsError);
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ function* updateMySoundSaga({ payload: update }) {
|
||||
};
|
||||
yield put(updateMySoundComplete({ ...data, payload: update }));
|
||||
yield put(createFlashMessage({ ...data }));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
yield put(updateMySoundError);
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ function* resetMyEditorLayoutSaga() {
|
||||
|
||||
yield put(createFlashMessage({ ...data }));
|
||||
yield put(resetMyEditorLayoutComplete({ ...data }));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
yield put(resetMyEditorLayoutError);
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ function* updateMyKeyboardShortcutsSaga({ payload: update }) {
|
||||
const { data } = yield call(putUpdateMyKeyboardShortcuts, update);
|
||||
yield put(updateMyKeyboardShortcutsComplete({ ...data, payload: update }));
|
||||
yield put(createFlashMessage({ ...data }));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
yield put(updateMyKeyboardShortcutsError);
|
||||
}
|
||||
}
|
||||
@@ -144,7 +144,7 @@ function* updateMyHonestySaga({ payload: update }) {
|
||||
const { data } = yield call(putUpdateMyHonesty, update);
|
||||
yield put(updateMyHonestyComplete({ ...data, payload: update }));
|
||||
yield put(createFlashMessage({ ...data }));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
yield put(updateMyHonestyError);
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ function* updateMyQuincyEmailSaga({ payload: update }) {
|
||||
const { data } = yield call(putUpdateMyQuincyEmail, update);
|
||||
yield put(updateMyQuincyEmailComplete({ ...data, payload: update }));
|
||||
yield put(createFlashMessage({ ...data }));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
yield put(updateMyQuincyEmailError);
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ function* updateMyPortfolioSaga({ payload: update }) {
|
||||
const { data } = yield call(putUpdateMyPortfolio, update);
|
||||
yield put(updateMyPortfolioComplete({ ...data, payload: update }));
|
||||
yield put(createFlashMessage({ ...data }));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
yield put(updateMyPortfolioError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ function* deleteUserTokenSaga() {
|
||||
} else {
|
||||
yield put(createFlashMessage(message.deleteErr));
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
yield put(createFlashMessage(message.deleteErr));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ function saveCodeEpic(action$, state$) {
|
||||
throw Error('Failed to save to localStorage');
|
||||
}
|
||||
return action;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return { ...action, error: true };
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -10,7 +10,7 @@ const initialState = {
|
||||
};
|
||||
|
||||
// We're not testing the reducer here, so just return the initial state
|
||||
function reducer(state = initialState, _action) {
|
||||
function reducer(state = initialState) {
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
@@ -266,6 +266,7 @@ async function buildChallenges({ path: filePath }, curriculum, lang) {
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.log(`failed to create superBlock from ${superBlockDir}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,7 @@ const Joi = require('joi');
|
||||
Joi.objectId = require('joi-objectid')(Joi);
|
||||
|
||||
const { challengeTypes } = require('../../shared/config/challenge-types');
|
||||
const {
|
||||
SuperBlocks,
|
||||
chapterBasedSuperBlocks
|
||||
} = require('../../shared/config/curriculum');
|
||||
const { chapterBasedSuperBlocks } = require('../../shared/config/curriculum');
|
||||
const {
|
||||
availableCharacters,
|
||||
availableBackgrounds,
|
||||
|
||||
@@ -51,10 +51,7 @@ const {
|
||||
createContent,
|
||||
testId
|
||||
} = require('../../client/src/templates/Challenges/utils/frame');
|
||||
const {
|
||||
SuperBlocks,
|
||||
chapterBasedSuperBlocks
|
||||
} = require('../../shared/config/curriculum');
|
||||
const { chapterBasedSuperBlocks } = require('../../shared/config/curriculum');
|
||||
const ChallengeTitles = require('./utils/challenge-titles');
|
||||
const MongoIds = require('./utils/mongo-ids');
|
||||
const createPseudoWorker = require('./utils/pseudo-worker');
|
||||
@@ -439,7 +436,7 @@ function populateTestsForLang({ lang, challenges, meta, superBlocks }) {
|
||||
for (const test of tests) {
|
||||
try {
|
||||
await testRunner(test);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
fails = true;
|
||||
break;
|
||||
}
|
||||
@@ -682,13 +679,7 @@ async function getWorkerEvaluator({
|
||||
};
|
||||
}
|
||||
|
||||
async function initializeTestRunner({
|
||||
build,
|
||||
sources,
|
||||
code,
|
||||
loadEnzyme,
|
||||
hooks
|
||||
}) {
|
||||
async function initializeTestRunner({ build, sources, loadEnzyme, hooks }) {
|
||||
await page.reload();
|
||||
await page.setContent(createContent(testId, { build, sources, hooks }));
|
||||
await page.evaluate(
|
||||
|
||||
@@ -55,7 +55,7 @@ function createPseudoWorker(context) {
|
||||
if (this[eventName]) {
|
||||
this[eventName](data);
|
||||
}
|
||||
} catch (err) {
|
||||
} catch {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,6 @@ export default tseslint.config(
|
||||
'react/prop-types': 'off',
|
||||
'react/jsx-no-useless-fragment': 'error',
|
||||
'no-only-tests/no-only-tests': 'error',
|
||||
'no-unused-vars': 'off',
|
||||
'no-unused-expressions': 'error', // This is so the js rules are more in line with the ts rules
|
||||
'filenames-simple/naming-convention': ['warn']
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ const addBeforeHook = require('./add-before-hook');
|
||||
|
||||
describe('add-before-hook plugin', () => {
|
||||
let withBeforeHookAST,
|
||||
withEmptyHookAST,
|
||||
withInvalidHookAST,
|
||||
withAnotherInvalidHookAST,
|
||||
withNonJSHookAST;
|
||||
@@ -14,7 +13,6 @@ describe('add-before-hook plugin', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
withBeforeHookAST = await parseFixture('with-before-hook.md');
|
||||
withEmptyHookAST = await parseFixture('with-empty-before-hook.md');
|
||||
withInvalidHookAST = await parseFixture('with-invalid-before-hook.md');
|
||||
withAnotherInvalidHookAST = await parseFixture(
|
||||
'with-another-invalid-before-hook.md'
|
||||
|
||||
@@ -27,7 +27,7 @@ const testTree = {
|
||||
|
||||
describe('findAll', () => {
|
||||
it('should return an array', () => {
|
||||
expect(findAll(testTree, _node => false)).toEqual([]);
|
||||
expect(findAll(testTree, () => false)).toEqual([]);
|
||||
});
|
||||
it('should return an array of nodes that match the test', () => {
|
||||
expect(findAll(testTree, { type: 'text', value: 'test' })).toEqual([
|
||||
|
||||
@@ -30,7 +30,7 @@ function handleError(err, client) {
|
||||
console.error(err);
|
||||
try {
|
||||
client.close();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// no-op
|
||||
} finally {
|
||||
process.exit(1);
|
||||
|
||||
@@ -36,7 +36,7 @@ function handleError(err, client) {
|
||||
console.error(err);
|
||||
try {
|
||||
client.close();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// no-op
|
||||
} finally {
|
||||
process.exit(1);
|
||||
|
||||
@@ -24,7 +24,7 @@ function handleError(err, client) {
|
||||
console.error(err);
|
||||
try {
|
||||
client.close();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// no-op
|
||||
} finally {
|
||||
process.exit(1);
|
||||
|
||||
@@ -26,7 +26,7 @@ function handleError(err, client) {
|
||||
console.error(err);
|
||||
try {
|
||||
client.close();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// no-op
|
||||
} finally {
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user