From 49b728d31b4ec61ba5bbc29d540b4caee8e536bd Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Sat, 30 Sep 2023 16:23:39 +0300 Subject: [PATCH] refactor: disable naming-convenction rule (#51685) --- .eslintrc.json | 55 +------------------ api/jest.utils.ts | 2 - api/src/routes/challenge.test.ts | 1 - api/src/server.test.ts | 1 - .../Donation/paypal-button-script-loader.tsx | 2 - .../src/components/Donation/paypal-button.tsx | 2 - .../components/Donation/stripe-card-form.tsx | 1 - .../growth-book-redux-connector.tsx | 1 - .../growth-book/growth-book-wrapper.tsx | 1 - .../components/helpers/avatar-renderer.tsx | 1 - client/src/components/settings/about.tsx | 1 - client/src/components/settings/portfolio.tsx | 1 - client/src/declarations.d.ts | 1 - .../src/templates/Challenges/utils/frame.ts | 1 - client/src/utils/solution-display-type.ts | 1 - client/utils/gatsby/layout-selector.test.tsx | 7 +-- .../client-plugins/browser-scripts/index.d.ts | 2 - .../browser-scripts/python-runner.ts | 1 - .../ui-components/src/drop-down/drop-down.tsx | 1 - 19 files changed, 4 insertions(+), 79 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 46a4f99388f7b6..df04fce3f5df6c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -86,60 +86,7 @@ "rules": { "import/no-unresolved": "off", "import/named": 0, - "@typescript-eslint/naming-convention": [ - "error", - { - "selector": "default", - "format": ["camelCase"], - "leadingUnderscore": "allow", - "trailingUnderscore": "allow" - }, - { - "selector": [ - "classProperty", - "objectLiteralProperty", - "typeProperty", - "classMethod", - "objectLiteralMethod", - "typeMethod", - "accessor", - "enumMember" - ], - "format": null, - "modifiers": ["requiresQuotes"] - }, - { - "selector": "variable", - "format": ["camelCase", "UPPER_CASE", "PascalCase"], - "leadingUnderscore": "allowSingleOrDouble", - "trailingUnderscore": "allow" - }, - { - "selector": "typeLike", - "format": ["PascalCase"], - "custom": { - "regex": "^I[A-Z]|[a-zA-Z]Type$", - "match": false - } - }, - { - "selector": "typeProperty", - "format": ["camelCase", "PascalCase"] - }, - { - "selector": "objectLiteralProperty", - "format": ["camelCase", "PascalCase"], - "leadingUnderscore": "allowSingleOrDouble" - }, - { - "selector": "function", - "format": ["camelCase", "PascalCase"] - }, - { - "selector": "enumMember", - "format": ["PascalCase"] - } - ] + "@typescript-eslint/naming-convention": "off" } }, { diff --git a/api/jest.utils.ts b/api/jest.utils.ts index 612b728f0d79ab..09c7b5951a6b56 100644 --- a/api/jest.utils.ts +++ b/api/jest.utils.ts @@ -14,7 +14,6 @@ type Options = { sendCSRFToken: boolean; }; -/* eslint-disable @typescript-eslint/naming-convention */ const requests = { GET: (resource: string) => request(fastifyTestInstance?.server).get(resource), POST: (resource: string) => @@ -23,7 +22,6 @@ const requests = { DELETE: (resource: string) => request(fastifyTestInstance?.server).delete(resource) }; -/* eslint-enable @typescript-eslint/naming-convention */ export const getCsrfToken = (setCookies: string[]): string | undefined => { const csrfSetCookie = setCookies.find(str => str.includes('csrf_token')); diff --git a/api/src/routes/challenge.test.ts b/api/src/routes/challenge.test.ts index 04221e95321a16..f15fd407f367c6 100644 --- a/api/src/routes/challenge.test.ts +++ b/api/src/routes/challenge.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ import { omit } from 'lodash'; diff --git a/api/src/server.test.ts b/api/src/server.test.ts index d004f468a5ed66..55f89610472a7e 100644 --- a/api/src/server.test.ts +++ b/api/src/server.test.ts @@ -5,7 +5,6 @@ jest.mock('./utils/env', () => { // eslint-disable-next-line @typescript-eslint/no-unsafe-return return { ...jest.requireActual('./utils/env'), - // eslint-disable-next-line @typescript-eslint/naming-convention COOKIE_DOMAIN: '.freecodecamp.org' }; }); diff --git a/client/src/components/Donation/paypal-button-script-loader.tsx b/client/src/components/Donation/paypal-button-script-loader.tsx index aa14fc5f724692..3615aaf693802b 100644 --- a/client/src/components/Donation/paypal-button-script-loader.tsx +++ b/client/src/components/Donation/paypal-button-script-loader.tsx @@ -6,7 +6,6 @@ import { scriptLoader, scriptRemover } from '../../utils/script-loaders'; import type { DonationApprovalData } from './types'; -/* eslint-disable @typescript-eslint/naming-convention */ type PayPalButtonScriptLoaderProps = { isMinimalForm: boolean | undefined; clientId: string; @@ -44,7 +43,6 @@ type PayPalButtonScriptLoaderProps = { }; planId: string | null; }; -/* eslint-enable @typescript-eslint/naming-convention */ type PayPalButtonScriptLoaderState = { isSdkLoaded: boolean; diff --git a/client/src/components/Donation/paypal-button.tsx b/client/src/components/Donation/paypal-button.tsx index 89852f17218716..684abd0b1901ab 100644 --- a/client/src/components/Donation/paypal-button.tsx +++ b/client/src/components/Donation/paypal-button.tsx @@ -98,7 +98,6 @@ class PaypalButton extends Component { return (
- {/* eslint-disable @typescript-eslint/naming-convention */} { color: buttonColor }} /> - {/* eslint-enable @typescript-eslint/naming-convention */}
); } diff --git a/client/src/components/Donation/stripe-card-form.tsx b/client/src/components/Donation/stripe-card-form.tsx index 6e25b505b1bf07..73c068cac283b5 100644 --- a/client/src/components/Donation/stripe-card-form.tsx +++ b/client/src/components/Donation/stripe-card-form.tsx @@ -128,7 +128,6 @@ const StripeCardForm = ({ ) => { if (stripe) { return stripe.confirmCardPayment(clientSecret, { - // eslint-disable-next-line @typescript-eslint/naming-convention payment_method: paymentMethod }); } diff --git a/client/src/components/growth-book/growth-book-redux-connector.tsx b/client/src/components/growth-book/growth-book-redux-connector.tsx index 44f9d155b0b40a..a7a078cd77dc3e 100644 --- a/client/src/components/growth-book/growth-book-redux-connector.tsx +++ b/client/src/components/growth-book/growth-book-redux-connector.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ import React, { ReactNode, useEffect } from 'react'; import { useFeature } from '@growthbook/growthbook-react'; diff --git a/client/src/components/growth-book/growth-book-wrapper.tsx b/client/src/components/growth-book/growth-book-wrapper.tsx index cd8f03c91a3e1d..f1e0b67dc61fa3 100644 --- a/client/src/components/growth-book/growth-book-wrapper.tsx +++ b/client/src/components/growth-book/growth-book-wrapper.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ import React, { ReactNode, useEffect } from 'react'; import sha1 from 'sha-1'; import { diff --git a/client/src/components/helpers/avatar-renderer.tsx b/client/src/components/helpers/avatar-renderer.tsx index f9f2bfd8db7393..4cc61507886929 100644 --- a/client/src/components/helpers/avatar-renderer.tsx +++ b/client/src/components/helpers/avatar-renderer.tsx @@ -29,7 +29,6 @@ function AvatarRenderer({ if ( // we probably have loads of records in the database with this default avatar URL set. To prevent making a request to the image we know will 404. !/freecodecamp\.com\/sample-image/.test(picture) && - // eslint-disable-next-line @typescript-eslint/naming-convention isURL(picture, { require_protocol: true }) ) { validationImage.src = picture; diff --git a/client/src/components/settings/about.tsx b/client/src/components/settings/about.tsx index 6d418d732fec2d..448a8f1927c842 100644 --- a/client/src/components/settings/about.tsx +++ b/client/src/components/settings/about.tsx @@ -165,7 +165,6 @@ class AboutSettings extends Component { handlePictureChange = (e: React.FormEvent) => { const value = (e.target as HTMLInputElement).value.slice(0); - // eslint-disable-next-line @typescript-eslint/naming-convention if (isURL(value, { require_protocol: true })) { this.validationImage.src = encodeURI(value); } else { diff --git a/client/src/components/settings/portfolio.tsx b/client/src/components/settings/portfolio.tsx index 04f4ae89196f9f..41a7f0253b0231 100644 --- a/client/src/components/settings/portfolio.tsx +++ b/client/src/components/settings/portfolio.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ import { Button, FormGroup, diff --git a/client/src/declarations.d.ts b/client/src/declarations.d.ts index 1bd8ec7dbc7fe4..94c06ce05649ec 100644 --- a/client/src/declarations.d.ts +++ b/client/src/declarations.d.ts @@ -26,7 +26,6 @@ declare module 'sha-1' { // eslint-disable-next-line no-var declare var MathJax: { Hub: { - /* eslint-disable @typescript-eslint/naming-convention*/ Config: (attributes: { tex2jax: { inlineMath: Array; diff --git a/client/src/templates/Challenges/utils/frame.ts b/client/src/templates/Challenges/utils/frame.ts index 60c74be09ce309..decfdc3bc7c7a9 100644 --- a/client/src/templates/Challenges/utils/frame.ts +++ b/client/src/templates/Challenges/utils/frame.ts @@ -18,7 +18,6 @@ export interface Source { export interface Context { window?: Window & - // eslint-disable-next-line @typescript-eslint/naming-convention typeof globalThis & { i18nContent?: i18n; __pyodide: unknown }; document?: FrameDocument | PythonDocument; element: HTMLIFrameElement; diff --git a/client/src/utils/solution-display-type.ts b/client/src/utils/solution-display-type.ts index 9f9e53ddabea7a..bb2f604ee4e6e5 100644 --- a/client/src/utils/solution-display-type.ts +++ b/client/src/utils/solution-display-type.ts @@ -2,7 +2,6 @@ import type { CompletedChallenge } from '../redux/prop-types'; import { challengeTypes } from '../../../shared/config/challenge-types'; import { maybeUrlRE } from '.'; -// eslint-disable-next-line @typescript-eslint/naming-convention type DisplayType = | 'none' | 'showMultifileProjectSolution' diff --git a/client/utils/gatsby/layout-selector.test.tsx b/client/utils/gatsby/layout-selector.test.tsx index 53c4b5f1de187e..3565e4cf4f740f 100644 --- a/client/utils/gatsby/layout-selector.test.tsx +++ b/client/utils/gatsby/layout-selector.test.tsx @@ -27,8 +27,7 @@ function getComponentNameAndProps( pathname: string, pageContext?: { challengeMeta?: { block?: string; superBlock?: string } } ): NameAndProps { - // eslint-disable-next-line testing-library/render-result-naming-convention - const shallow = ShallowRenderer.createRenderer(); + const utils = ShallowRenderer.createRenderer(); const LayoutReactComponent = layoutSelector({ element: { type: elementType, props: {}, key: '' }, props: { @@ -38,8 +37,8 @@ function getComponentNameAndProps( pageContext } }); - shallow.render({LayoutReactComponent}); - const view = shallow.getRenderOutput(); + utils.render({LayoutReactComponent}); + const view = utils.getRenderOutput(); return { props: view.props.children.props as Record, // eslint-disable-next-line @typescript-eslint/ban-ts-comment diff --git a/tools/client-plugins/browser-scripts/index.d.ts b/tools/client-plugins/browser-scripts/index.d.ts index 503a7a4a6a0376..dc041d22eee142 100644 --- a/tools/client-plugins/browser-scripts/index.d.ts +++ b/tools/client-plugins/browser-scripts/index.d.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - import { PyodideInterface } from 'pyodide'; export interface FrameDocument extends Document { diff --git a/tools/client-plugins/browser-scripts/python-runner.ts b/tools/client-plugins/browser-scripts/python-runner.ts index c2090ff4ff3fd5..7062a8368f2281 100644 --- a/tools/client-plugins/browser-scripts/python-runner.ts +++ b/tools/client-plugins/browser-scripts/python-runner.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ // We have to specify pyodide.js because we need to import that file (not .mjs) // and 'import' defaults to .mjs import { loadPyodide, type PyodideInterface } from 'pyodide/pyodide.js'; diff --git a/tools/ui-components/src/drop-down/drop-down.tsx b/tools/ui-components/src/drop-down/drop-down.tsx index bf3f551bd913e3..83dc185b122551 100644 --- a/tools/ui-components/src/drop-down/drop-down.tsx +++ b/tools/ui-components/src/drop-down/drop-down.tsx @@ -18,7 +18,6 @@ type DropdownMenuProps = Props< MenuRenderPropArg, never, { - // eslint-disable-next-line @typescript-eslint/naming-convention __demoMode?: boolean; } >;