refactor: disable naming-convenction rule (#51685)

This commit is contained in:
Muhammed Mustafa
2023-09-30 16:23:39 +03:00
committed by GitHub
parent bbe1f46d6e
commit 49b728d31b
19 changed files with 4 additions and 79 deletions
+1 -54
View File
@@ -86,60 +86,7 @@
"rules": { "rules": {
"import/no-unresolved": "off", "import/no-unresolved": "off",
"import/named": 0, "import/named": 0,
"@typescript-eslint/naming-convention": [ "@typescript-eslint/naming-convention": "off"
"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"]
}
]
} }
}, },
{ {
-2
View File
@@ -14,7 +14,6 @@ type Options = {
sendCSRFToken: boolean; sendCSRFToken: boolean;
}; };
/* eslint-disable @typescript-eslint/naming-convention */
const requests = { const requests = {
GET: (resource: string) => request(fastifyTestInstance?.server).get(resource), GET: (resource: string) => request(fastifyTestInstance?.server).get(resource),
POST: (resource: string) => POST: (resource: string) =>
@@ -23,7 +22,6 @@ const requests = {
DELETE: (resource: string) => DELETE: (resource: string) =>
request(fastifyTestInstance?.server).delete(resource) request(fastifyTestInstance?.server).delete(resource)
}; };
/* eslint-enable @typescript-eslint/naming-convention */
export const getCsrfToken = (setCookies: string[]): string | undefined => { export const getCsrfToken = (setCookies: string[]): string | undefined => {
const csrfSetCookie = setCookies.find(str => str.includes('csrf_token')); const csrfSetCookie = setCookies.find(str => str.includes('csrf_token'));
-1
View File
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { omit } from 'lodash'; import { omit } from 'lodash';
-1
View File
@@ -5,7 +5,6 @@ jest.mock('./utils/env', () => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return // eslint-disable-next-line @typescript-eslint/no-unsafe-return
return { return {
...jest.requireActual('./utils/env'), ...jest.requireActual('./utils/env'),
// eslint-disable-next-line @typescript-eslint/naming-convention
COOKIE_DOMAIN: '.freecodecamp.org' COOKIE_DOMAIN: '.freecodecamp.org'
}; };
}); });
@@ -6,7 +6,6 @@ import { scriptLoader, scriptRemover } from '../../utils/script-loaders';
import type { DonationApprovalData } from './types'; import type { DonationApprovalData } from './types';
/* eslint-disable @typescript-eslint/naming-convention */
type PayPalButtonScriptLoaderProps = { type PayPalButtonScriptLoaderProps = {
isMinimalForm: boolean | undefined; isMinimalForm: boolean | undefined;
clientId: string; clientId: string;
@@ -44,7 +43,6 @@ type PayPalButtonScriptLoaderProps = {
}; };
planId: string | null; planId: string | null;
}; };
/* eslint-enable @typescript-eslint/naming-convention */
type PayPalButtonScriptLoaderState = { type PayPalButtonScriptLoaderState = {
isSdkLoaded: boolean; isSdkLoaded: boolean;
@@ -98,7 +98,6 @@ class PaypalButton extends Component<PaypalButtonProps, PaypalButtonState> {
return ( return (
<div className={'paypal-buttons-container'}> <div className={'paypal-buttons-container'}>
{/* eslint-disable @typescript-eslint/naming-convention */}
<PayPalButtonScriptLoader <PayPalButtonScriptLoader
clientId={paypalClientId} clientId={paypalClientId}
createOrder={( createOrder={(
@@ -170,7 +169,6 @@ class PaypalButton extends Component<PaypalButtonProps, PaypalButtonState> {
color: buttonColor color: buttonColor
}} }}
/> />
{/* eslint-enable @typescript-eslint/naming-convention */}
</div> </div>
); );
} }
@@ -128,7 +128,6 @@ const StripeCardForm = ({
) => { ) => {
if (stripe) { if (stripe) {
return stripe.confirmCardPayment(clientSecret, { return stripe.confirmCardPayment(clientSecret, {
// eslint-disable-next-line @typescript-eslint/naming-convention
payment_method: paymentMethod payment_method: paymentMethod
}); });
} }
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import React, { ReactNode, useEffect } from 'react'; import React, { ReactNode, useEffect } from 'react';
import { useFeature } from '@growthbook/growthbook-react'; import { useFeature } from '@growthbook/growthbook-react';
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import React, { ReactNode, useEffect } from 'react'; import React, { ReactNode, useEffect } from 'react';
import sha1 from 'sha-1'; import sha1 from 'sha-1';
import { import {
@@ -29,7 +29,6 @@ function AvatarRenderer({
if ( 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. // 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) && !/freecodecamp\.com\/sample-image/.test(picture) &&
// eslint-disable-next-line @typescript-eslint/naming-convention
isURL(picture, { require_protocol: true }) isURL(picture, { require_protocol: true })
) { ) {
validationImage.src = picture; validationImage.src = picture;
-1
View File
@@ -165,7 +165,6 @@ class AboutSettings extends Component<AboutProps, AboutState> {
handlePictureChange = (e: React.FormEvent<HTMLInputElement>) => { handlePictureChange = (e: React.FormEvent<HTMLInputElement>) => {
const value = (e.target as HTMLInputElement).value.slice(0); const value = (e.target as HTMLInputElement).value.slice(0);
// eslint-disable-next-line @typescript-eslint/naming-convention
if (isURL(value, { require_protocol: true })) { if (isURL(value, { require_protocol: true })) {
this.validationImage.src = encodeURI(value); this.validationImage.src = encodeURI(value);
} else { } else {
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { import {
Button, Button,
FormGroup, FormGroup,
-1
View File
@@ -26,7 +26,6 @@ declare module 'sha-1' {
// eslint-disable-next-line no-var // eslint-disable-next-line no-var
declare var MathJax: { declare var MathJax: {
Hub: { Hub: {
/* eslint-disable @typescript-eslint/naming-convention*/
Config: (attributes: { Config: (attributes: {
tex2jax: { tex2jax: {
inlineMath: Array<string[]>; inlineMath: Array<string[]>;
@@ -18,7 +18,6 @@ export interface Source {
export interface Context { export interface Context {
window?: Window & window?: Window &
// eslint-disable-next-line @typescript-eslint/naming-convention
typeof globalThis & { i18nContent?: i18n; __pyodide: unknown }; typeof globalThis & { i18nContent?: i18n; __pyodide: unknown };
document?: FrameDocument | PythonDocument; document?: FrameDocument | PythonDocument;
element: HTMLIFrameElement; element: HTMLIFrameElement;
@@ -2,7 +2,6 @@ import type { CompletedChallenge } from '../redux/prop-types';
import { challengeTypes } from '../../../shared/config/challenge-types'; import { challengeTypes } from '../../../shared/config/challenge-types';
import { maybeUrlRE } from '.'; import { maybeUrlRE } from '.';
// eslint-disable-next-line @typescript-eslint/naming-convention
type DisplayType = type DisplayType =
| 'none' | 'none'
| 'showMultifileProjectSolution' | 'showMultifileProjectSolution'
+3 -4
View File
@@ -27,8 +27,7 @@ function getComponentNameAndProps(
pathname: string, pathname: string,
pageContext?: { challengeMeta?: { block?: string; superBlock?: string } } pageContext?: { challengeMeta?: { block?: string; superBlock?: string } }
): NameAndProps { ): NameAndProps {
// eslint-disable-next-line testing-library/render-result-naming-convention const utils = ShallowRenderer.createRenderer();
const shallow = ShallowRenderer.createRenderer();
const LayoutReactComponent = layoutSelector({ const LayoutReactComponent = layoutSelector({
element: { type: elementType, props: {}, key: '' }, element: { type: elementType, props: {}, key: '' },
props: { props: {
@@ -38,8 +37,8 @@ function getComponentNameAndProps(
pageContext pageContext
} }
}); });
shallow.render(<Provider store={store}>{LayoutReactComponent}</Provider>); utils.render(<Provider store={store}>{LayoutReactComponent}</Provider>);
const view = shallow.getRenderOutput(); const view = utils.getRenderOutput();
return { return {
props: view.props.children.props as Record<string, unknown>, props: view.props.children.props as Record<string, unknown>,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-2
View File
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { PyodideInterface } from 'pyodide'; import { PyodideInterface } from 'pyodide';
export interface FrameDocument extends Document { export interface FrameDocument extends Document {
@@ -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) // We have to specify pyodide.js because we need to import that file (not .mjs)
// and 'import' defaults to .mjs // and 'import' defaults to .mjs
import { loadPyodide, type PyodideInterface } from 'pyodide/pyodide.js'; import { loadPyodide, type PyodideInterface } from 'pyodide/pyodide.js';
@@ -18,7 +18,6 @@ type DropdownMenuProps = Props<
MenuRenderPropArg, MenuRenderPropArg,
never, never,
{ {
// eslint-disable-next-line @typescript-eslint/naming-convention
__demoMode?: boolean; __demoMode?: boolean;
} }
>; >;