refactor: ignore eslint less (#45082)
* refactor: remove and fix some eslint disables * refactor: drop max-line disables
This commit is contained in:
committed by
GitHub
parent
57cf47dad4
commit
7fe4695794
@ -108,12 +108,10 @@ module.exports = {
|
|||||||
resolve: 'gatsby-plugin-manifest',
|
resolve: 'gatsby-plugin-manifest',
|
||||||
options: {
|
options: {
|
||||||
name: 'freeCodeCamp',
|
name: 'freeCodeCamp',
|
||||||
/* eslint-disable camelcase */
|
|
||||||
short_name: 'fCC',
|
short_name: 'fCC',
|
||||||
start_url: '/',
|
start_url: '/',
|
||||||
theme_color: '#0a0a23',
|
theme_color: '#0a0a23',
|
||||||
background_color: '#fff',
|
background_color: '#fff',
|
||||||
/* eslint-enable camelcase */
|
|
||||||
display: 'minimal-ui',
|
display: 'minimal-ui',
|
||||||
icon: 'src/assets/images/square_puck.png'
|
icon: 'src/assets/images/square_puck.png'
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
/* eslint-disable no-undef */
|
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
|
|
||||||
const gatsby = jest.requireActual('gatsby');
|
const gatsby = jest.requireActual('gatsby');
|
||||||
|
2
client/src/__mocks__/react-i18next.js
vendored
2
client/src/__mocks__/react-i18next.js
vendored
@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable react/prop-types */
|
|
||||||
/* eslint-disable react/display-name */
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
const reactI18next = jest.genMockFromModule('react-i18next');
|
const reactI18next = jest.genMockFromModule('react-i18next');
|
||||||
|
@ -386,8 +386,4 @@ const ShowCertification = (props: ShowCertificationProps): JSX.Element => {
|
|||||||
|
|
||||||
ShowCertification.displayName = 'ShowCertification';
|
ShowCertification.displayName = 'ShowCertification';
|
||||||
|
|
||||||
export default connect(
|
export default connect(mapStateToProps, mapDispatchToProps)(ShowCertification);
|
||||||
mapStateToProps,
|
|
||||||
mapDispatchToProps
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
)(ShowCertification as any);
|
|
||||||
|
@ -85,16 +85,10 @@ class ShowProfileOrFourOhFour extends Component<ShowProfileOrFourOhFourProps> {
|
|||||||
|
|
||||||
// We have a response from the API, and we have some state in the
|
// We have a response from the API, and we have some state in the
|
||||||
// store for /:maybeUser, we now handover rendering to the Profile component
|
// store for /:maybeUser, we now handover rendering to the Profile component
|
||||||
// eslint-disable-next-line
|
|
||||||
// @ts-ignore TODO: sort out whether user.portfolio is an array or obj. lit.
|
|
||||||
return <Profile isSessionUser={isSessionUser} user={requestedUser} />;
|
return <Profile isSessionUser={isSessionUser} user={requestedUser} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line
|
|
||||||
// @ts-ignore
|
|
||||||
ShowProfileOrFourOhFour.displayName = 'ShowProfileOrFourOhFour';
|
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
makeMapStateToProps,
|
makeMapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable import/unambiguous */
|
|
||||||
// work around for SASS error in Edge
|
// work around for SASS error in Edge
|
||||||
// https://github.com/medialize/sass.js/issues/96#issuecomment-424386171
|
// https://github.com/medialize/sass.js/issues/96#issuecomment-424386171
|
||||||
interface WorkerWithSass extends Worker {
|
interface WorkerWithSass extends Worker {
|
||||||
|
@ -20,7 +20,6 @@ function DonateCompletion({
|
|||||||
isSignedIn,
|
isSignedIn,
|
||||||
error = null
|
error = null
|
||||||
}: DonateCompletionProps): JSX.Element {
|
}: DonateCompletionProps): JSX.Element {
|
||||||
/* eslint-disable no-nested-ternary */
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const style =
|
const style =
|
||||||
processing || redirecting ? 'info' : success ? 'success' : 'danger';
|
processing || redirecting ? 'info' : success ? 'success' : 'danger';
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
/* eslint-disable @typescript-eslint/unbound-method */
|
||||||
import type { Token } from '@stripe/stripe-js';
|
import type { Token } from '@stripe/stripe-js';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
@ -108,7 +108,6 @@ function DonateModal({
|
|||||||
const handleModalHide = () => {
|
const handleModalHide = () => {
|
||||||
// If modal is open on a SuperBlock page
|
// If modal is open on a SuperBlock page
|
||||||
if (isLocationSuperBlock(location)) {
|
if (isLocationSuperBlock(location)) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
||||||
goToAnchor('claim-cert-block');
|
goToAnchor('claim-cert-block');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
||||||
/* eslint-disable camelcase */
|
|
||||||
|
|
||||||
import React, { Component, Ref } from 'react';
|
import React, { Component, Ref } from 'react';
|
||||||
import { withTranslation } from 'react-i18next';
|
import { withTranslation } from 'react-i18next';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@ -91,7 +87,6 @@ export class PaypalButton extends Component<
|
|||||||
|
|
||||||
static getDerivedStateFromProps(props: PaypalButtonProps): PaypalButtonState {
|
static getDerivedStateFromProps(props: PaypalButtonProps): PaypalButtonState {
|
||||||
const { donationAmount, donationDuration } = props;
|
const { donationAmount, donationDuration } = props;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
||||||
const configurationObj: {
|
const configurationObj: {
|
||||||
amount: number;
|
amount: number;
|
||||||
duration: string;
|
duration: string;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable no-undefined */
|
|
||||||
import { Button, Form } from '@freecodecamp/react-bootstrap';
|
import { Button, Form } from '@freecodecamp/react-bootstrap';
|
||||||
import {
|
import {
|
||||||
CardNumberElement,
|
CardNumberElement,
|
||||||
@ -133,7 +132,7 @@ const StripeCardForm = ({
|
|||||||
) => {
|
) => {
|
||||||
if (stripe) {
|
if (stripe) {
|
||||||
return stripe.confirmCardPayment(clientSecret, {
|
return stripe.confirmCardPayment(clientSecret, {
|
||||||
// eslint-disable-next-line camelcase, @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
payment_method: paymentMethod
|
payment_method: paymentMethod
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,14 @@ import AppMountNotifier from './app-mount-notifier';
|
|||||||
jest.mock('react-ga');
|
jest.mock('react-ga');
|
||||||
jest.unmock('react-i18next');
|
jest.unmock('react-i18next');
|
||||||
|
|
||||||
type Language = [string, string];
|
type Language = keyof typeof i18nextCodes;
|
||||||
|
type LanguagePair = [string, string];
|
||||||
|
|
||||||
const store = createStore();
|
const store = createStore();
|
||||||
|
|
||||||
// Create a nested array for languages
|
// Create a nested array for languages
|
||||||
const languages = Object.keys(i18nextCodes).map(
|
const languages = Object.keys(i18nextCodes).map(
|
||||||
/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unsafe-return */
|
(key): LanguagePair => [i18nextCodes[key as Language], key]
|
||||||
// @ts-ignore
|
|
||||||
// TODO: convert `all-langs.js` to TypeScript
|
|
||||||
(key): Language => [i18nextCodes[key], key]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
describe('AppMountNotifier', () => {
|
describe('AppMountNotifier', () => {
|
||||||
|
@ -24,7 +24,7 @@ type FormProps = {
|
|||||||
enableSubmit?: boolean;
|
enableSubmit?: boolean;
|
||||||
formFields: { name: string; label: string }[];
|
formFields: { name: string; label: string }[];
|
||||||
hideButton?: boolean;
|
hideButton?: boolean;
|
||||||
id?: string;
|
id: string;
|
||||||
initialValues?: Record<string, unknown>;
|
initialValues?: Record<string, unknown>;
|
||||||
options: FormOptions;
|
options: FormOptions;
|
||||||
submit: (values: ValidatedValues, ...args: unknown[]) => void;
|
submit: (values: ValidatedValues, ...args: unknown[]) => void;
|
||||||
@ -49,7 +49,6 @@ function DynamicForm({
|
|||||||
>
|
>
|
||||||
{({ handleSubmit, pristine, error }) => (
|
{({ handleSubmit, pristine, error }) => (
|
||||||
<form
|
<form
|
||||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
||||||
id={`dynamic-${id}`}
|
id={`dynamic-${id}`}
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
|
1
client/src/declarations.d.ts
vendored
1
client/src/declarations.d.ts
vendored
@ -1,4 +1,3 @@
|
|||||||
// eslint-disable-next-line import/unambiguous
|
|
||||||
declare module '@freecodecamp/react-bootstrap';
|
declare module '@freecodecamp/react-bootstrap';
|
||||||
declare module '@freecodecamp/strip-comments';
|
declare module '@freecodecamp/strip-comments';
|
||||||
declare module '@types/react-redux';
|
declare module '@types/react-redux';
|
||||||
|
@ -112,8 +112,7 @@ function saveCodeEpic(action$, state$) {
|
|||||||
createFlashMessage({
|
createFlashMessage({
|
||||||
type: error ? 'warning' : 'success',
|
type: error ? 'warning' : 'success',
|
||||||
message: error
|
message: error
|
||||||
? // eslint-disable-next-line max-len
|
? "Oops, your code did not save, your browser's local storage may be full."
|
||||||
"Oops, your code did not save, your browser's local storage may be full."
|
|
||||||
: "Saved! Your code was saved to your browser's local storage."
|
: "Saved! Your code was saved to your browser's local storage."
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -54,7 +54,6 @@ it('Worker executor should successfully execute one task', async () => {
|
|||||||
expect(global.Worker).toBeCalledWith('/js/test.js');
|
expect(global.Worker).toBeCalledWith('/js/test.js');
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
|
||||||
it('Worker executor should successfully execute two tasks in parallel', async () => {
|
it('Worker executor should successfully execute two tasks in parallel', async () => {
|
||||||
const terminateHandler = jest.fn();
|
const terminateHandler = jest.fn();
|
||||||
mockWorker({ terminate: terminateHandler });
|
mockWorker({ terminate: terminateHandler });
|
||||||
@ -89,7 +88,6 @@ it('Worker executor should successfully execute two tasks in parallel', async ()
|
|||||||
expect(global.Worker).toBeCalledTimes(2);
|
expect(global.Worker).toBeCalledTimes(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
|
||||||
it('Worker executor should successfully execute 3 tasks in parallel and use two workers', async () => {
|
it('Worker executor should successfully execute 3 tasks in parallel and use two workers', async () => {
|
||||||
mockWorker();
|
mockWorker();
|
||||||
const testWorker = createWorker('test');
|
const testWorker = createWorker('test');
|
||||||
@ -104,7 +102,6 @@ it('Worker executor should successfully execute 3 tasks in parallel and use two
|
|||||||
expect(global.Worker).toBeCalledTimes(2);
|
expect(global.Worker).toBeCalledTimes(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
|
||||||
it('Worker executor should successfully execute 3 tasks, use 3 workers and terminate each worker', async () => {
|
it('Worker executor should successfully execute 3 tasks, use 3 workers and terminate each worker', async () => {
|
||||||
const terminateHandler = jest.fn();
|
const terminateHandler = jest.fn();
|
||||||
mockWorker({ terminate: terminateHandler });
|
mockWorker({ terminate: terminateHandler });
|
||||||
@ -121,7 +118,6 @@ it('Worker executor should successfully execute 3 tasks, use 3 workers and termi
|
|||||||
expect(global.Worker).toBeCalledTimes(3);
|
expect(global.Worker).toBeCalledTimes(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
|
||||||
it('Worker executor should successfully execute 3 tasks in parallel and use 3 workers', async () => {
|
it('Worker executor should successfully execute 3 tasks in parallel and use 3 workers', async () => {
|
||||||
mockWorker();
|
mockWorker();
|
||||||
const testWorker = createWorker('test', { maxWorkers: 3 });
|
const testWorker = createWorker('test', { maxWorkers: 3 });
|
||||||
@ -136,7 +132,6 @@ it('Worker executor should successfully execute 3 tasks in parallel and use 3 wo
|
|||||||
expect(global.Worker).toBeCalledTimes(3);
|
expect(global.Worker).toBeCalledTimes(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
|
||||||
it('Worker executor should successfully execute 3 tasks and use 1 worker', async () => {
|
it('Worker executor should successfully execute 3 tasks and use 1 worker', async () => {
|
||||||
mockWorker();
|
mockWorker();
|
||||||
const testWorker = createWorker('test', { maxWorkers: 1 });
|
const testWorker = createWorker('test', { maxWorkers: 1 });
|
||||||
|
@ -54,7 +54,6 @@ const mapStateToProps = (state: unknown) => {
|
|||||||
fetchState: CertChallengeProps['fetchState'],
|
fetchState: CertChallengeProps['fetchState'],
|
||||||
isSignedIn
|
isSignedIn
|
||||||
) => ({
|
) => ({
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
||||||
currentCerts,
|
currentCerts,
|
||||||
fetchState,
|
fetchState,
|
||||||
isSignedIn
|
isSignedIn
|
||||||
|
@ -3,10 +3,8 @@ This string sentence has various white spaces characters:
|
|||||||
\t* This line starts with a tab character.
|
\t* This line starts with a tab character.
|
||||||
\t* This line has several preceding white space characters.`;
|
\t* This line has several preceding white space characters.`;
|
||||||
|
|
||||||
/* eslint-disable max-len */
|
|
||||||
const stringWithWhiteSpaceCharsRemoved =
|
const stringWithWhiteSpaceCharsRemoved =
|
||||||
'Thisstringsentencehasvariouswhitespacescharacters:*Thislinestartswithatabcharacter.*Thislinehasseveralprecedingwhitespacecharacters.';
|
'Thisstringsentencehasvariouswhitespacescharacters:*Thislinestartswithatabcharacter.*Thislinehasseveralprecedingwhitespacecharacters.';
|
||||||
/* esline-enable max-len */
|
|
||||||
|
|
||||||
const testValues = {
|
const testValues = {
|
||||||
stringWithWhiteSpaceChars,
|
stringWithWhiteSpaceChars,
|
||||||
|
Reference in New Issue
Block a user