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

View File

@@ -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"
}
},
{

View File

@@ -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'));

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-assignment */
import { omit } from 'lodash';

View File

@@ -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'
};
});

View File

@@ -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;

View File

@@ -98,7 +98,6 @@ class PaypalButton extends Component<PaypalButtonProps, PaypalButtonState> {
return (
<div className={'paypal-buttons-container'}>
{/* eslint-disable @typescript-eslint/naming-convention */}
<PayPalButtonScriptLoader
clientId={paypalClientId}
createOrder={(
@@ -170,7 +169,6 @@ class PaypalButton extends Component<PaypalButtonProps, PaypalButtonState> {
color: buttonColor
}}
/>
{/* eslint-enable @typescript-eslint/naming-convention */}
</div>
);
}

View File

@@ -128,7 +128,6 @@ const StripeCardForm = ({
) => {
if (stripe) {
return stripe.confirmCardPayment(clientSecret, {
// eslint-disable-next-line @typescript-eslint/naming-convention
payment_method: paymentMethod
});
}

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import React, { ReactNode, useEffect } from 'react';
import { useFeature } from '@growthbook/growthbook-react';

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import React, { ReactNode, useEffect } from 'react';
import sha1 from 'sha-1';
import {

View File

@@ -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;

View File

@@ -165,7 +165,6 @@ class AboutSettings extends Component<AboutProps, AboutState> {
handlePictureChange = (e: React.FormEvent<HTMLInputElement>) => {
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 {

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import {
Button,
FormGroup,

View File

@@ -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<string[]>;

View File

@@ -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;

View File

@@ -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'

View File

@@ -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(<Provider store={store}>{LayoutReactComponent}</Provider>);
const view = shallow.getRenderOutput();
utils.render(<Provider store={store}>{LayoutReactComponent}</Provider>);
const view = utils.getRenderOutput();
return {
props: view.props.children.props as Record<string, unknown>,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment

View File

@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { PyodideInterface } from 'pyodide';
export interface FrameDocument extends Document {

View File

@@ -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';

View File

@@ -18,7 +18,6 @@ type DropdownMenuProps = Props<
MenuRenderPropArg,
never,
{
// eslint-disable-next-line @typescript-eslint/naming-convention
__demoMode?: boolean;
}
>;