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"],
"rules": { "no-shadow": 0 },
"rules": { "no-shadow": 0, "react/no-unescaped-entities": 0 },
"settings": {
"react": {
"version": "16.4.2"

View File

@ -43,13 +43,21 @@ describe('fcc-create-nav-data', () => {
expect(result.dashedName).equal('file-writing');
});
it('node.path should equal the file path from pagesDir, prefixed with `/guide`', () => {
it(
'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(
'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', () => {
expect(result.title).to.equal(mockNode.frontmatter.title);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,6 +3,7 @@ import React from 'react';
const scripts = [
<script
async=''
key='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 = [
// bootstrap v3.3.7
<link href='/bootstrap3/css/bootstrap.min.css' rel='stylesheet' />
];
const styleSheets = [];
export default styleSheets;

View File

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

View File

@ -47,7 +47,11 @@ class Preview extends Component {
const iframeToggle = this.state.iframeStatus ? 'disable' : 'enable';
return (
<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>
);
}

View File

@ -52,7 +52,10 @@ function IntroductionPage({ data: { markdownRemark, allChallengeNode } }) {
/>
</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
</Link>
<ButtonSpacer />