From ec3ee856ec797b01fdd8e0f0826df7bf4e7b423e Mon Sep 17 00:00:00 2001 From: Shaun Hamilton Date: Fri, 4 Nov 2022 05:13:46 +0000 Subject: [PATCH] feat(tools): ignore no-unused-vars on underscore (#48386) --- .eslintrc.json | 11 ++++++++++- api-server/src/server/middlewares/error-handlers.js | 3 +-- client/src/__mocks__/gatsby.ts | 1 - client/src/client/frame-runner.ts | 2 -- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 86091343770..d0bd5161184 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -38,7 +38,16 @@ "import/order": "error", "import/no-cycle": [2, { "maxDepth": 2 }], "react/prop-types": "off", - "no-only-tests/no-only-tests": "error" + "no-only-tests/no-only-tests": "error", + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": [ + "warn", + { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "caughtErrorsIgnorePattern": "^_" + } + ] }, "overrides": [ { diff --git a/api-server/src/server/middlewares/error-handlers.js b/api-server/src/server/middlewares/error-handlers.js index e78f26a3e29..52e8cfaee44 100644 --- a/api-server/src/server/middlewares/error-handlers.js +++ b/api-server/src/server/middlewares/error-handlers.js @@ -24,8 +24,7 @@ const isDev = process.env.FREECODECAMP_NODE_ENV !== 'production'; export default function prodErrorHandler() { // error handling in production. - // eslint-disable-next-line no-unused-vars - return function (err, req, res, next) { + return function (err, req, res, _next) { // response for when req.body is bigger than body-parser's size limit if (err?.type === 'entity.too.large') { return res.status('413').send('Request payload is too large'); diff --git a/client/src/__mocks__/gatsby.ts b/client/src/__mocks__/gatsby.ts index 7eee88b22ff..13d623892ed 100644 --- a/client/src/__mocks__/gatsby.ts +++ b/client/src/__mocks__/gatsby.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-unused-vars */ import React from 'react'; import { GatsbyLinkProps } from 'gatsby'; const gatsby: NodeModule = jest.requireActual('gatsby'); diff --git a/client/src/client/frame-runner.ts b/client/src/client/frame-runner.ts index 4a749625bea..5e9edde1203 100644 --- a/client/src/client/frame-runner.ts +++ b/client/src/client/frame-runner.ts @@ -34,7 +34,6 @@ export interface InitTestFrameArg { async function initTestFrame(e: InitTestFrameArg = { code: {} }) { const code = (e.code.contents || '').slice(); - // eslint-disable-next-line @typescript-eslint/no-unused-vars const __file = (id?: string) => { if (id && e.code.original) { return e.code.original[id]; @@ -45,7 +44,6 @@ async function initTestFrame(e: InitTestFrameArg = { code: {} }) { const editableContents = (e.code.editableContents || '').slice(); // __testEditable allows test authors to run tests against a transitory dom // element built using only the code in the editable region. - // eslint-disable-next-line @typescript-eslint/no-unused-vars const __testEditable = (cb: () => () => unknown) => { const div = document.createElement('div'); div.id = 'editable-only';