Skip to content

Commit

Permalink
feat: settings eslint using tamplete airnb
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscojunior10 committed Apr 17, 2020
1 parent dcea613 commit c9b3911
Show file tree
Hide file tree
Showing 12 changed files with 192 additions and 239 deletions.
35 changes: 35 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"extends": "airbnb",
"parser": "babel-eslint",
"settings": {
"import/resolver": {
"node": {
"paths": [
"src"
]
}
}
},
"rules": {
"max-len": [
"error",
{
"code": 80,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true
}
],
"react/jsx-filename-extension": [
1,
{
"extensions": [
".js",
".jsx"
]
}
],
"react/require-default-props": "off",
"react/forbid-prop-types": "off"
}
}
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"semi": false,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5"
"trailingComma": "all"
}
41 changes: 21 additions & 20 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
module.exports = {
siteMetadata: {
title: `Francisco Júnior`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@franciscojunior10`,
siteUrl: `https://franciscojunior10.github.io/`,
title: 'Francisco Júnior',
description: 'Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.',
author: '@franciscojunior10',
siteUrl: 'https://franciscojunior10.github.io/',
},
plugins: [
`gatsby-plugin-react-helmet`,
`gatsby-plugin-sitemap`,
'gatsby-plugin-react-helmet',
'gatsby-plugin-sitemap',
{
resolve: `gatsby-source-filesystem`,
resolve: 'gatsby-source-filesystem',
options: {
name: `images`,
name: 'images',
path: `${__dirname}/src/images`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
{
resolve: `gatsby-plugin-manifest`,
resolve: 'gatsby-plugin-manifest',
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
name: 'gatsby-starter-default',
short_name: 'starter',
start_url: '/',
background_color: '#663399',
theme_color: '#663399',
display: 'minimal-ui',
icon: 'src/images/gatsby-icon.png', // This path is relative to the root of the site.
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// this (optional) plugin enables Progressive Web App +
// Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
],
}
};
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
"react-helmet": "^5.2.1"
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.19.0",
"prettier": "^1.19.1"
},
"keywords": [
Expand Down
74 changes: 38 additions & 36 deletions src/components/SEO/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
* See: https://www.gatsbyjs.org/docs/use-static-query/
*/

import React from "react"
import PropTypes from "prop-types"
import Helmet from "react-helmet"
import { useStaticQuery, graphql } from "gatsby"
import React from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import { useStaticQuery, graphql } from 'gatsby';

import ogImage from "../../assets/images/perfil.jpg"
import ogImage from '../../assets/images/perfil.jpg';

function SEO({ description, lang, meta, title, keywords }) {
function SEO({
description, lang, meta, title, keywords,
}) {
const { site } = useStaticQuery(
graphql`
query {
Expand All @@ -25,10 +27,10 @@ function SEO({ description, lang, meta, title, keywords }) {
}
}
}
`
)
`,
);

const metaDescription = description || site.siteMetadata.description
const metaDescription = description || site.siteMetadata.description;

return (
<Helmet
Expand All @@ -39,83 +41,83 @@ function SEO({ description, lang, meta, title, keywords }) {
titleTemplate={title && `%s | ${site.siteMetadata.title}`}
meta={[
{
name: `description`,
name: 'description',
content: metaDescription,
},
{
name: `keywords`,
name: 'keywords',
content: keywords,
},
{
name: `twitter:card`,
content: `summary`,
name: 'twitter:card',
content: 'summary',
},
{
name: `twitter:creator`,
name: 'twitter:creator',
content: site.siteMetadata.author,
},
{
name: `twitter:title`,
name: 'twitter:title',
content: title,
},
{
name: `twitter:description`,
name: 'twitter:description',
content: metaDescription,
},
{
property: `og:title`,
property: 'og:title',
content: title,
},
{
property: `og:description`,
property: 'og:description',
content: metaDescription,
},
{
property: `og:type`,
content: `website`,
property: 'og:type',
content: 'website',
},
{
property: `og:url`,
property: 'og:url',
content: site.siteMetadata.siteUrl,
},
{
property: `og:image`,
property: 'og:image',
content: `${site.siteMetadata.siteUrl}${ogImage}`,
},
{
property: `og:image:alt`,
property: 'og:image:alt',
content: metaDescription,
},
{
property: `og:image:type`,
content: `image/jpg`,
property: 'og:image:type',
content: 'image/jpg',
},
{
property: `og:image:width`,
content: `1944`,
property: 'og:image:width',
content: '1944',
},
{
property: `og:image:height`,
content: `2592`,
property: 'og:image:height',
content: '2592',
},
].concat(meta)}
/>
)
);
}

SEO.defaultProps = {
lang: `en`,
lang: 'en',
meta: [],
description: ``,
keywords: ``,
}
description: '',
keywords: '',
};

SEO.propTypes = {
description: PropTypes.string,
lang: PropTypes.string,
meta: PropTypes.arrayOf(PropTypes.object),
title: PropTypes.string.isRequired,
keywords: PropTypes.string,
}
};

export default SEO
export default SEO;
28 changes: 14 additions & 14 deletions src/components/header.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
import { Link } from "gatsby"
import PropTypes from "prop-types"
import React from "react"
import { Link } from 'gatsby';
import PropTypes from 'prop-types';
import React from 'react';

const Header = ({ siteTitle }) => (
<header
style={{
background: `rebeccapurple`,
marginBottom: `1.45rem`,
background: 'rebeccapurple',
marginBottom: '1.45rem',
}}
>
<div
style={{
margin: `0 auto`,
margin: '0 auto',
maxWidth: 960,
padding: `1.45rem 1.0875rem`,
padding: '1.45rem 1.0875rem',
}}
>
<h1 style={{ margin: 0 }}>
<Link
to="/"
style={{
color: `white`,
textDecoration: `none`,
color: 'white',
textDecoration: 'none',
}}
>
{siteTitle}
</Link>
</h1>
</div>
</header>
)
);

Header.propTypes = {
siteTitle: PropTypes.string,
}
};

Header.defaultProps = {
siteTitle: ``,
}
siteTitle: '',
};

export default Header
export default Header;
14 changes: 7 additions & 7 deletions src/components/image.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { useStaticQuery, graphql } from "gatsby"
import Img from "gatsby-image"
import React from 'react';
import { useStaticQuery, graphql } from 'gatsby';
import Img from 'gatsby-image';

/*
* This component is built using `gatsby-image` to automatically serve optimized
Expand All @@ -24,9 +24,9 @@ const Image = () => {
}
}
}
`)
`);

return <Img fluid={data.placeholderImage.childImageSharp.fluid} />
}
return <Img fluid={data.placeholderImage.childImageSharp.fluid} />;
};

export default Image
export default Image;
24 changes: 12 additions & 12 deletions src/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* See: https://www.gatsbyjs.org/docs/use-static-query/
*/

import React from "react"
import PropTypes from "prop-types"
import { useStaticQuery, graphql } from "gatsby"
import React from 'react';
import PropTypes from 'prop-types';
import { useStaticQuery, graphql } from 'gatsby';

import Header from "./header"
import "./layout.css"
import Header from './header';
import './layout.css';

const Layout = ({ children }) => {
const data = useStaticQuery(graphql`
Expand All @@ -21,16 +21,16 @@ const Layout = ({ children }) => {
}
}
}
`)
`);

return (
<>
<Header siteTitle={data.site.siteMetadata.title} />
<div
style={{
margin: `0 auto`,
margin: '0 auto',
maxWidth: 960,
padding: `0 1.0875rem 1.45rem`,
padding: '0 1.0875rem 1.45rem',
}}
>
<main>{children}</main>
Expand All @@ -41,11 +41,11 @@ const Layout = ({ children }) => {
</footer> */}
</div>
</>
)
}
);
};

Layout.propTypes = {
children: PropTypes.node.isRequired,
}
};

export default Layout
export default Layout;
Loading

0 comments on commit c9b3911

Please sign in to comment.