refactor: ignore eslint less (#45082)

* refactor: remove and fix some eslint disables

* refactor: drop max-line disables
This commit is contained in:
Oliver Eyton-Williams
2022-02-11 19:28:13 +01:00
committed by GitHub
parent 57cf47dad4
commit 7fe4695794
18 changed files with 7 additions and 45 deletions

View File

@ -108,12 +108,10 @@ module.exports = {
resolve: 'gatsby-plugin-manifest',
options: {
name: 'freeCodeCamp',
/* eslint-disable camelcase */
short_name: 'fCC',
start_url: '/',
theme_color: '#0a0a23',
background_color: '#fff',
/* eslint-enable camelcase */
display: 'minimal-ui',
icon: 'src/assets/images/square_puck.png'
}

View File

@ -1,5 +1,4 @@
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
const React = require('react');
const gatsby = jest.requireActual('gatsby');

View File

@ -1,5 +1,3 @@
/* eslint-disable react/prop-types */
/* eslint-disable react/display-name */
import React from 'react';
const reactI18next = jest.genMockFromModule('react-i18next');

View File

@ -386,8 +386,4 @@ const ShowCertification = (props: ShowCertificationProps): JSX.Element => {
ShowCertification.displayName = 'ShowCertification';
export default connect(
mapStateToProps,
mapDispatchToProps
// eslint-disable-next-line @typescript-eslint/no-explicit-any
)(ShowCertification as any);
export default connect(mapStateToProps, mapDispatchToProps)(ShowCertification);

View File

@ -85,16 +85,10 @@ class ShowProfileOrFourOhFour extends Component<ShowProfileOrFourOhFourProps> {
// 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
// eslint-disable-next-line
// @ts-ignore TODO: sort out whether user.portfolio is an array or obj. lit.
return <Profile isSessionUser={isSessionUser} user={requestedUser} />;
}
}
// eslint-disable-next-line
// @ts-ignore
ShowProfileOrFourOhFour.displayName = 'ShowProfileOrFourOhFour';
export default connect(
makeMapStateToProps,
mapDispatchToProps

View File

@ -1,4 +1,3 @@
/* eslint-disable import/unambiguous */
// work around for SASS error in Edge
// https://github.com/medialize/sass.js/issues/96#issuecomment-424386171
interface WorkerWithSass extends Worker {

View File

@ -20,7 +20,6 @@ function DonateCompletion({
isSignedIn,
error = null
}: DonateCompletionProps): JSX.Element {
/* eslint-disable no-nested-ternary */
const { t } = useTranslation();
const style =
processing || redirecting ? 'info' : success ? 'success' : 'danger';

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/unbound-method */
import type { Token } from '@stripe/stripe-js';
import React, { Component } from 'react';

View File

@ -108,7 +108,6 @@ function DonateModal({
const handleModalHide = () => {
// If modal is open on a SuperBlock page
if (isLocationSuperBlock(location)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
goToAnchor('claim-cert-block');
}
};

View File

@ -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 { withTranslation } from 'react-i18next';
import { connect } from 'react-redux';
@ -91,7 +87,6 @@ export class PaypalButton extends Component<
static getDerivedStateFromProps(props: PaypalButtonProps): PaypalButtonState {
const { donationAmount, donationDuration } = props;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const configurationObj: {
amount: number;
duration: string;

View File

@ -1,4 +1,3 @@
/* eslint-disable no-undefined */
import { Button, Form } from '@freecodecamp/react-bootstrap';
import {
CardNumberElement,
@ -133,7 +132,7 @@ const StripeCardForm = ({
) => {
if (stripe) {
return stripe.confirmCardPayment(clientSecret, {
// eslint-disable-next-line camelcase, @typescript-eslint/naming-convention
// eslint-disable-next-line @typescript-eslint/naming-convention
payment_method: paymentMethod
});
}

View File

@ -11,16 +11,14 @@ import AppMountNotifier from './app-mount-notifier';
jest.mock('react-ga');
jest.unmock('react-i18next');
type Language = [string, string];
type Language = keyof typeof i18nextCodes;
type LanguagePair = [string, string];
const store = createStore();
// Create a nested array for languages
const languages = Object.keys(i18nextCodes).map(
/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unsafe-return */
// @ts-ignore
// TODO: convert `all-langs.js` to TypeScript
(key): Language => [i18nextCodes[key], key]
(key): LanguagePair => [i18nextCodes[key as Language], key]
);
describe('AppMountNotifier', () => {

View File

@ -24,7 +24,7 @@ type FormProps = {
enableSubmit?: boolean;
formFields: { name: string; label: string }[];
hideButton?: boolean;
id?: string;
id: string;
initialValues?: Record<string, unknown>;
options: FormOptions;
submit: (values: ValidatedValues, ...args: unknown[]) => void;
@ -49,7 +49,6 @@ function DynamicForm({
>
{({ handleSubmit, pristine, error }) => (
<form
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
id={`dynamic-${id}`}
onSubmit={handleSubmit}
style={{ width: '100%' }}

View File

@ -1,4 +1,3 @@
// eslint-disable-next-line import/unambiguous
declare module '@freecodecamp/react-bootstrap';
declare module '@freecodecamp/strip-comments';
declare module '@types/react-redux';

View File

@ -112,8 +112,7 @@ function saveCodeEpic(action$, state$) {
createFlashMessage({
type: error ? 'warning' : 'success',
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."
})
)

View File

@ -54,7 +54,6 @@ it('Worker executor should successfully execute one task', async () => {
expect(global.Worker).toBeCalledWith('/js/test.js');
});
// eslint-disable-next-line max-len
it('Worker executor should successfully execute two tasks in parallel', async () => {
const terminateHandler = jest.fn();
mockWorker({ terminate: terminateHandler });
@ -89,7 +88,6 @@ it('Worker executor should successfully execute two tasks in parallel', async ()
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 () => {
mockWorker();
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);
});
// eslint-disable-next-line max-len
it('Worker executor should successfully execute 3 tasks, use 3 workers and terminate each worker', async () => {
const terminateHandler = jest.fn();
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);
});
// eslint-disable-next-line max-len
it('Worker executor should successfully execute 3 tasks in parallel and use 3 workers', async () => {
mockWorker();
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);
});
// eslint-disable-next-line max-len
it('Worker executor should successfully execute 3 tasks and use 1 worker', async () => {
mockWorker();
const testWorker = createWorker('test', { maxWorkers: 1 });

View File

@ -54,7 +54,6 @@ const mapStateToProps = (state: unknown) => {
fetchState: CertChallengeProps['fetchState'],
isSignedIn
) => ({
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
currentCerts,
fetchState,
isSignedIn

View File

@ -3,10 +3,8 @@ This string sentence has various white spaces characters:
\t* This line starts with a tab character.
\t* This line has several preceding white space characters.`;
/* eslint-disable max-len */
const stringWithWhiteSpaceCharsRemoved =
'Thisstringsentencehasvariouswhitespacescharacters:*Thislinestartswithatabcharacter.*Thislinehasseveralprecedingwhitespacecharacters.';
/* esline-enable max-len */
const testValues = {
stringWithWhiteSpaceChars,