chore: Apply linting fixes

This commit is contained in:
Bouncey
2019-02-16 08:20:53 +00:00
committed by mrugesh mohapatra
parent a63b84e748
commit 8e0237d042
16 changed files with 95 additions and 51 deletions

View File

@ -1,6 +1,6 @@
{ {
"extends": ["plugin:react/recommended", "@freecodecamp/eslint-config"], "extends": ["plugin:react/recommended", "@freecodecamp/eslint-config"],
"rules": { "no-shadow": 0 }, "rules": { "no-shadow": 0, "react/no-unescaped-entities": 0 },
"settings": { "settings": {
"react": { "react": {
"version": "16.4.2" "version": "16.4.2"

View File

@ -43,13 +43,21 @@ describe('fcc-create-nav-data', () => {
expect(result.dashedName).equal('file-writing'); expect(result.dashedName).equal('file-writing');
}); });
it('node.path should equal the file path from pagesDir, prefixed with `/guide`', () => { it(
expect(result.path).to.equal('/guide/php/functions/files/file-writing'); 'node.path should equal the file path from pagesDir, ' +
}); 'prefixed with `/guide`',
() => {
expect(result.path).to.equal('/guide/php/functions/files/file-writing');
}
);
it('node.parentPath should equal the path of the parent page, prefixed with `/guide`', () => { it(
expect(result.parentPath).to.equal('/guide/php/functions/files'); 'node.parentPath should equal the path of the parent page, ' +
}); 'prefixed with `/guide`',
() => {
expect(result.parentPath).to.equal('/guide/php/functions/files');
}
);
it('node.title should equal srcNode.frontmatter.title', () => { it('node.title should equal srcNode.frontmatter.title', () => {
expect(result.title).to.equal(mockNode.frontmatter.title); expect(result.title).to.equal(mockNode.frontmatter.title);

View File

@ -258,7 +258,6 @@ function ShowSettings(props) {
verifyCert={verifyCert} verifyCert={verifyCert}
/> />
<Spacer /> <Spacer />
{/* <DangerZone /> */}
</main> </main>
</Grid> </Grid>
</Fragment> </Fragment>

View File

@ -21,6 +21,7 @@ import { userSelector, isSignedInSelector } from '../../../redux';
const propTypes = { const propTypes = {
email: PropTypes.string, email: PropTypes.string,
isSignedIn: PropTypes.bool,
stripe: PropTypes.shape({ stripe: PropTypes.shape({
createToken: PropTypes.func.isRequired createToken: PropTypes.func.isRequired
}) })
@ -120,9 +121,9 @@ class DonateForm extends Component {
} }
})); }));
const chargeStripePath = isSignedIn ? const chargeStripePath = isSignedIn
`/internal/donate/charge-stripe` : ? `${apiLocation}/internal/donate/charge-stripe`
`${apiLocation}/unauthenticated/donate/charge-stripe`; : `${apiLocation}/unauthenticated/donate/charge-stripe`;
return postJSON$(chargeStripePath, { return postJSON$(chargeStripePath, {
token, token,
amount amount
@ -151,7 +152,7 @@ class DonateForm extends Component {
} }
resetDonation() { resetDonation() {
return this.setState({...initialState}); return this.setState({ ...initialState });
} }
renderCompletion(props) { renderCompletion(props) {

View File

@ -1,14 +1,22 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { Link as GatsbyLink } from 'gatsby'; import { Link as GatsbyLink } from 'gatsby';
import { Grid, Row, Col } from '@freecodecamp/react-bootstrap'; import { Grid, Row, Col } from '@freecodecamp/react-bootstrap';
import './footer.css'; import './footer.css';
const propTypes = {
children: PropTypes.any,
external: PropTypes.bool,
to: PropTypes.string.isRequired
};
const ColHeader = ({ children, ...other }) => ( const ColHeader = ({ children, ...other }) => (
<div className='col-header' {...other}> <div className='col-header' {...other}>
{children} {children}
</div> </div>
); );
ColHeader.propTypes = propTypes;
const Link = ({ children, to, external, ...other }) => { const Link = ({ children, to, external, ...other }) => {
if (!external && (/^\/(?!\/)/).test(to)) { if (!external && (/^\/(?!\/)/).test(to)) {
@ -25,6 +33,7 @@ const Link = ({ children, to, external, ...other }) => {
</a> </a>
); );
}; };
Link.propTypes = propTypes;
function Footer() { function Footer() {
return ( return (

View File

@ -109,7 +109,13 @@ export class Block extends Component {
} }
render() { render() {
const { blockDashedName, completedChallenges, challenges, isExpanded, intro } = this.props; const {
blockDashedName,
completedChallenges,
challenges,
isExpanded,
intro
} = this.props;
let completedCount = 0; let completedCount = 0;
const challengesWithCompleted = challenges.map(challenge => { const challengesWithCompleted = challenges.map(challenge => {
const { id } = challenge; const { id } = challenge;

View File

@ -65,7 +65,7 @@ export function getValidationState(field) {
return null; return null;
} }
if (/https?:\/\/glitch\.com\/edit\/#!\/.*/g.test(field.value)) { if ((/https?:\/\/glitch\.com\/edit\/#!\/.*/g).test(field.value)) {
return 'glitch-warning'; return 'glitch-warning';
} }

View File

@ -78,12 +78,8 @@ const isCertMapSelector = createSelector(
is2018DataVisCert, is2018DataVisCert,
isApisMicroservicesCert, isApisMicroservicesCert,
isJsAlgoDataStructCert, isJsAlgoDataStructCert,
isBackEndCert,
isDataVisCert,
isFrontEndCert,
isInfosecQaCert, isInfosecQaCert,
isFrontEndLibsCert, isFrontEndLibsCert,
isFullStackCert,
isRespWebDesignCert isRespWebDesignCert
}) => ({ }) => ({
'Responsive Web Design': isRespWebDesignCert, 'Responsive Web Design': isRespWebDesignCert,

View File

@ -3,32 +3,53 @@ import React from 'react';
const favicons = [ const favicons = [
<link <link
href='/assets/apple-touch-icon.png' href='/assets/apple-touch-icon.png'
key='/assets/apple-touch-icon.png'
rel='apple-touch-icon' rel='apple-touch-icon'
sizes='180x180' sizes='180x180'
/>, />,
<link <link
href='/assets/favicon-32x32.png' href='/assets/favicon-32x32.png'
key='/assets/favicon-32x32.png'
rel='icon' rel='icon'
sizes='32x32' sizes='32x32'
type='image/png' type='image/png'
/>, />,
<link <link
href='/assets/android-chrome-192x192.png' href='/assets/android-chrome-192x192.png'
key='/assets/android-chrome-192x192.png'
rel='icon' rel='icon'
sizes='192x192' sizes='192x192'
type='image/png' type='image/png'
/>, />,
<link <link
href='/assets/favicon-16x16.png' href='/assets/favicon-16x16.png'
key='/assets/favicon-16x16.png'
rel='icon' rel='icon'
sizes='16x16' sizes='16x16'
type='image/png' type='image/png'
/>, />,
<link href='/assets/site.webmanifest' rel='manifest' />, <link
<link color='#006400' href='/assets/safari-pinned-tab.svg' rel='mask-icon' />, href='/assets/site.webmanifest'
<meta content='#006400' name='msapplication-TileColor' />, key='/assets/site.webmanifest'
<meta content='/assets/mstile-144x144.png' name='msapplication-TileImage' />, rel='manifest'
<meta content='#006400' name='theme-color' /> />,
<link
color='#006400'
href='/assets/safari-pinned-tab.svg'
key='/assets/safari-pinned-tab.svg'
rel='mask-icon'
/>,
<meta
content='#006400'
key='msapplication-TileColor'
name='msapplication-TileColor'
/>,
<meta
content='/assets/mstile-144x144.png'
key='msapplication-TileImage'
name='msapplication-TileImage'
/>,
<meta content='#006400' key='theme-color' name='theme-color' />
]; ];
export default favicons; export default favicons;

View File

@ -1,16 +1,22 @@
import React from 'react'; import React from 'react';
const meta = [ const meta = [
<meta charSet='utf-8' />, <meta charSet='utf-8' key='charset' />,
<meta content='IE=edge' httpEquiv='X-UA-Compatible' />, <meta content='IE=edge' httpEquiv='X-UA-Compatible' key='IE=edge' />,
<meta content='width=device-width, initial-scale=1.0' name='viewport' />, <meta
<meta content='summary_large_image' name='twitter:card' />, content='width=device-width, initial-scale=1.0'
key='viewport'
name='viewport'
/>,
<meta content='summary_large_image' key='twitter:card' name='twitter:card' />,
<meta <meta
content='https://s3.amazonaws.com/freecodecamp/curriculum-diagram-full.jpg' content='https://s3.amazonaws.com/freecodecamp/curriculum-diagram-full.jpg'
key='https://s3.amazonaws.com/freecodecamp/curriculum-diagram-full.jpg'
name='twitter:image:src' name='twitter:image:src'
/>, />,
<meta <meta
content='https://s3.amazonaws.com/freecodecamp/curriculum-diagram-full.jpg' content='https://s3.amazonaws.com/freecodecamp/curriculum-diagram-full.jpg'
key='https://s3.amazonaws.com/freecodecamp/curriculum-diagram-full.jpg'
property='og:image' property='og:image'
/> />
]; ];

View File

@ -1,14 +1,9 @@
import React from 'react'; import React from 'react';
import styleSheets from './styleSheets'; import styleSheets from './styleSheets';
const preloads = styleSheets.map((styleSheet, i) => ( const preloads = styleSheets.map(styleSheet => (
<React.Fragment> <React.Fragment key={`preload-${styleSheet.props.href}`}>
<link <link as='style' href={styleSheet.props.href} rel='preload' />
as='style'
href={styleSheet.props.href}
key={`preload-${i}`}
rel='preload'
/>
{styleSheet} {styleSheet}
</React.Fragment> </React.Fragment>
)); ));

View File

@ -3,6 +3,7 @@ import React from 'react';
const scripts = [ const scripts = [
<script <script
async='' async=''
key='https://www.googletagmanager.com/gtag/js?id=AW-795617839'
src='https://www.googletagmanager.com/gtag/js?id=AW-795617839' src='https://www.googletagmanager.com/gtag/js?id=AW-795617839'
/> />
]; ];

View File

@ -1,8 +1,3 @@
import React from 'react'; const styleSheets = [];
const styleSheets = [
// bootstrap v3.3.7
<link href='/bootstrap3/css/bootstrap.min.css' rel='stylesheet' />
];
export default styleSheets; export default styleSheets;

View File

@ -1,43 +1,43 @@
import React from 'react'; import React from 'react';
const policy = [ const policy = [
<p> <p key={1}>
Before we issue our verified certification to a camper, he or she must Before we issue our verified certification to a camper, he or she must
accept our Academic Honesty Pledge, which reads: accept our Academic Honesty Pledge, which reads:
</p>, </p>,
<p> <p key={2}>
"I understand that plagiarism means copying someone elses work and "I understand that plagiarism means copying someone elses work and
presenting the work as if it were my own, without clearly attributing the presenting the work as if it were my own, without clearly attributing the
original author." original author."
</p>, </p>,
<p> <p key={3}>
"I understand that plagiarism is an act of intellectual dishonesty, and that "I understand that plagiarism is an act of intellectual dishonesty, and that
people usually get kicked out of university or fired from their jobs if they people usually get kicked out of university or fired from their jobs if they
get caught plagiarizing". get caught plagiarizing".
</p>, </p>,
<p> <p key={4}>
"Aside from using open source libraries such as jQuery and Bootstrap, and "Aside from using open source libraries such as jQuery and Bootstrap, and
short snippets of code which are clearly attributed to their original short snippets of code which are clearly attributed to their original
author, 100% of the code in my projects was written by me, or along with author, 100% of the code in my projects was written by me, or along with
another camper with whom I was pair programming in real time." another camper with whom I was pair programming in real time."
</p>, </p>,
<p> <p key={5}>
"I pledge that I did not plagiarize any of my freeCodeCamp.org work. I "I pledge that I did not plagiarize any of my freeCodeCamp.org work. I
understand that freeCodeCamp.orgs team will audit my projects to confirm understand that freeCodeCamp.orgs team will audit my projects to confirm
this." this."
</p>, </p>,
<p> <p key={6}>
In the situations where we discover instances of unambiguous plagiarism, we In the situations where we discover instances of unambiguous plagiarism, we
will replace the camper in questions certification with a message that will replace the camper in questions certification with a message that
"Upon review, this account has been flagged for academic dishonesty." "Upon review, this account has been flagged for academic dishonesty."
</p>, </p>,
<p> <p key={7}>
As an academic institution that grants achievement-based certifications, we As an academic institution that grants achievement-based certifications, we
take academic honesty very seriously. If you have any questions about this take academic honesty very seriously. If you have any questions about this
policy, or suspect that someone has violated it, you can email{' '} policy, or suspect that someone has violated it, you can email{' '}
<a href='mailto:team@freecodecamp.org'>team@freecodecamp.org</a> <a href='mailto:team@freecodecamp.org'>team@freecodecamp.org</a>
&thinsp;and we will investigate. &thinsp;and we will investigate.
</p> </p>
].map((el, i) => ({...el, key: `honesty-${i}`})); ];
export default policy; export default policy;

View File

@ -47,7 +47,11 @@ class Preview extends Component {
const iframeToggle = this.state.iframeStatus ? 'disable' : 'enable'; const iframeToggle = this.state.iframeStatus ? 'disable' : 'enable';
return ( return (
<div className={`challenge-preview ${iframeToggle}-iframe`}> <div className={`challenge-preview ${iframeToggle}-iframe`}>
<iframe className={'challenge-preview-frame'} id={mainId} title='Challenge Preview'/> <iframe
className={'challenge-preview-frame'}
id={mainId}
title='Challenge Preview'
/>
</div> </div>
); );
} }

View File

@ -52,7 +52,10 @@ function IntroductionPage({ data: { markdownRemark, allChallengeNode } }) {
/> />
</FullWidthRow> </FullWidthRow>
<FullWidthRow> <FullWidthRow>
<Link className='btn btn-lg btn-primary btn-block' to={firstLessonPath}> <Link
className='btn btn-lg btn-primary btn-block'
to={firstLessonPath}
>
Go to the first lesson Go to the first lesson
</Link> </Link>
<ButtonSpacer /> <ButtonSpacer />