refactor: remove unused vars (#59658)

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