Skip to content

Commit 0eb0567

Browse files
Adds ESLint functionality and configures for AirBnB rules
1 parent 3b50aa6 commit 0eb0567

File tree

12 files changed

+2041
-326
lines changed

12 files changed

+2041
-326
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/index.js
2+
/gatsby-node.js

.eslintrc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"node": true,
5+
"es6": true,
6+
"jest": true
7+
},
8+
"extends": ["airbnb-base", "plugin:react/recommended"],
9+
"globals": {
10+
"Atomics": "readonly",
11+
"SharedArrayBuffer": "readonly"
12+
},
13+
"parser": "babel-eslint",
14+
"parserOptions": {
15+
"ecmaFeatures": {
16+
"jsx": true
17+
},
18+
"ecmaVersion": 2018,
19+
"sourceType": "module"
20+
},
21+
"plugins": ["react"],
22+
"rules": {
23+
"indent": ["error", 4],
24+
"no-unused-vars": [
25+
"error",
26+
{
27+
"vars": "local",
28+
"args": "none"
29+
}
30+
],
31+
"no-plusplus": "off",
32+
"no-underscore-dangle": "off",
33+
"react/self-closing-comp": "off",
34+
"no-restricted-syntax": ["off", "BinaryExpression[operator='in']"]
35+
}
36+
}
Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
module.exports = {
22
siteMetadata: {
3-
title: 'Gatsby Default Starter',
3+
title: 'Gatsby Default Starter',
44
},
55
plugins: [
6-
'gatsby-plugin-react-helmet',
7-
{
8-
resolve: `gatsby-plugin-manifest`,
9-
options: {
10-
name: 'gatsby-starter-default',
11-
short_name: 'starter',
12-
start_url: '/',
13-
background_color: '#663399',
14-
theme_color: '#663399',
15-
display: 'minimal-ui',
16-
icon: 'src/images/gatsby-icon.png', // This path is relative to the root of the site.
6+
'gatsby-plugin-react-helmet',
7+
{
8+
resolve: 'gatsby-plugin-manifest',
9+
options: {
10+
name: 'gatsby-starter-default',
11+
short_name: 'starter',
12+
start_url: '/',
13+
background_color: '#663399',
14+
theme_color: '#663399',
15+
display: 'minimal-ui',
16+
icon: 'src/images/gatsby-icon.png', // This path is relative to the root of the site.
17+
},
1718
},
18-
},
19-
'gatsby-plugin-offline',
20-
{
21-
resolve: 'gatsby-plugin-mailchimp',
22-
options: {
23-
endpoint: '', // replace with your own Mailchimp endpoint for testing
19+
'gatsby-plugin-offline',
20+
{
21+
resolve: 'gatsby-plugin-mailchimp',
22+
options: {
23+
endpoint: '', // replace with your own Mailchimp endpoint for testing
24+
},
2425
},
25-
},
2626
],
27-
}
28-
27+
};
Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
import React from 'react'
2-
import { Link } from 'gatsby'
1+
import React from 'react';
2+
import { Link } from 'gatsby';
33

4-
const Header = ({ siteTitle }) => (
5-
<div
6-
style={{
7-
background: 'rebeccapurple',
8-
marginBottom: '1.45rem',
9-
}}
10-
>
4+
const Header = () => (
115
<div
12-
style={{
13-
margin: '0 auto',
14-
maxWidth: 960,
15-
padding: '1.45rem 1.0875rem',
16-
}}
6+
style={{
7+
background: 'rebeccapurple',
8+
marginBottom: '1.45rem',
9+
}}
1710
>
18-
<h1 style={{ margin: 0 }}>
19-
<Link
20-
to="/"
21-
style={{
22-
color: 'white',
23-
textDecoration: 'none',
24-
}}
11+
<div
12+
style={{
13+
margin: '0 auto',
14+
maxWidth: 960,
15+
padding: '1.45rem 1.0875rem',
16+
}}
2517
>
26-
{siteTitle}
27-
</Link>
28-
</h1>
18+
<h1 style={{ margin: 0 }}>
19+
<Link
20+
to="/"
21+
style={{
22+
color: 'white',
23+
textDecoration: 'none',
24+
}}
25+
>
26+
Example usage of gatsby-plugin-mailchimp
27+
</Link>
28+
</h1>
29+
</div>
2930
</div>
30-
</div>
31-
)
31+
);
3232

33-
export default Header
33+
export default Header;
Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,42 @@
1-
import React from 'react'
2-
import PropTypes from 'prop-types'
3-
import Helmet from 'react-helmet'
4-
import { StaticQuery, graphql } from 'gatsby'
1+
import React from 'react';
52

6-
import Header from './header'
7-
import './layout.css'
3+
import Helmet from 'react-helmet';
4+
import { StaticQuery, graphql } from 'gatsby';
85

9-
const Layout = ({ children }) => (
10-
<StaticQuery
11-
query={graphql`
12-
query SiteTitleQuery {
13-
site {
14-
siteMetadata {
15-
title
16-
}
17-
}
18-
}
19-
`}
20-
render={data => (
21-
<>
22-
<Helmet
23-
title={data.site.siteMetadata.title}
24-
>
25-
<html lang="en" />
26-
</Helmet>
27-
<Header siteTitle={data.site.siteMetadata.title} />
28-
<div
29-
style={{
30-
margin: '0 auto',
31-
maxWidth: 960,
32-
padding: '0px 1.0875rem 1.45rem',
33-
paddingTop: 0,
34-
}}
35-
>
36-
{children}
37-
</div>
38-
</>
39-
)}
40-
/>
41-
)
6+
import Header from './header';
7+
import './layout.css';
428

43-
Layout.propTypes = {
44-
children: PropTypes.node.isRequired,
45-
}
9+
// eslint-disable-next-line react/prop-types
10+
const Layout = ({ children }) => (
11+
<StaticQuery
12+
query={graphql`
13+
query SiteTitleQuery {
14+
site {
15+
siteMetadata {
16+
title
17+
}
18+
}
19+
}
20+
`}
21+
render={data => (
22+
<>
23+
<Helmet title={data.site.siteMetadata.title}>
24+
<html lang="en" />
25+
</Helmet>
26+
<Header siteTitle={data.site.siteMetadata.title} />
27+
<div
28+
style={{
29+
margin: '0 auto',
30+
maxWidth: 960,
31+
padding: '0px 1.0875rem 1.45rem',
32+
paddingTop: 0,
33+
}}
34+
>
35+
{children}
36+
</div>
37+
</>
38+
)}
39+
/>
40+
);
4641

47-
export default Layout
42+
export default Layout;

0 commit comments

Comments
 (0)