Skip to content

Commit

Permalink
chore: manual eslint fixes (gatsbyjs#9750)
Browse files Browse the repository at this point in the history
* gatsbygram: consistent return

* using-faker: fix linting

* using-gatsby-source-graphql: import graphql from gatsby

* using-remark-copy-linked-files: consistent return

* gatsby-source-contentful: no-self-assign

* cache-dir: consistent return, unused vars

* add-npm-owner: re-add missing imports

* fix www linting

* gatsbygram: remove unused lifecycle methods

* return null instead of fragment
  • Loading branch information
pieh authored and gpetrioli committed Jan 22, 2019
1 parent a06978a commit 692cf83
Show file tree
Hide file tree
Showing 20 changed files with 55 additions and 81 deletions.
29 changes: 0 additions & 29 deletions examples/gatsbygram/src/layouts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,6 @@ class Layout extends React.Component {
isModal: PropTypes.bool,
}

componentDidMount() {
// Create references to html/body elements
// this.htmlElement = document.querySelector(`html`)
// this.bodyElement = document.querySelector(`body`)
// // Cache the window width.
// windowWidth = window.innerWidth
}
componentWillReceiveProps(nextProps) {
// if we're changing to a non-homepage page, put things in
// a modal (unless we're on mobile).
// if (windowWidth > 750) {
// // Freeze the background from scrolling.
// this.htmlElement.style.overflow = `hidden`
// this.bodyElement.style.overflow = `hidden`
// // Always set overflow-y to scroll so the scrollbar stays visible avoiding
// // weird jumping.
// this.htmlElement.style.overflowY = `scroll`
// } else {
// // Otherwise we're navigating back home so delete old home so the
// // modal can be destroyed.
// delete this.modalBackgroundChildren
// this.htmlElement.style.overflow = `visible`
// this.bodyElement.style.overflow = `visible`
// // Always set overflow-y to scroll so the scrollbar stays visible avoiding
// // weird jumping.
// this.htmlElement.style.overflowY = `scroll`
// }
}

render() {
const { location } = this.props
let isModal = false
Expand Down
9 changes: 6 additions & 3 deletions examples/gatsbygram/utils/download-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module.exports = function(url, dest, cb) {
// verify response code
sendReq.on(`response`, function(response) {
if (response.statusCode !== 200) {
return cb(`Response status was ` + response.statusCode)
cb(`Response status was ` + response.statusCode)
return
}
})

Expand All @@ -17,7 +18,8 @@ module.exports = function(url, dest, cb) {
fs.unlink(dest)

if (cb) {
return cb(err.message)
cb(err.message)
return
}
})

Expand All @@ -33,7 +35,8 @@ module.exports = function(url, dest, cb) {

// Delete the file async. (But we don't check the result)
if (cb) {
return cb(err.message)
cb(err.message)
return
}
})
}
4 changes: 2 additions & 2 deletions examples/using-faker/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { Link, graphql } from "gatsby"
import { graphql } from "gatsby"
import "./index.css"

const IndexPage = ({ data }) => (
Expand All @@ -26,7 +26,7 @@ const IndexPage = ({ data }) => (
<div className="company-section">
<h3>Worked at</h3>
{data.allCompanyData.edges.map(({ node }) => (
<div>
<div key={node.id}>
<div>{node.company.companyName}</div>
<div>{node.company.companySuffix}</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react"
import { graphql } from "gatsby"
import ReactMarkdown from "react-markdown"
import dateformat from "dateformat"

Expand Down
1 change: 1 addition & 0 deletions examples/using-gatsby-source-graphql/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react"
import { graphql } from "gatsby"
import { makeBlogPath } from "../utils"
import dateformat from "dateformat"

Expand Down
1 change: 1 addition & 0 deletions examples/using-gatsby-source-graphql/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react"
import { graphql } from "gatsby"
import { makeBlogPath } from "../utils"
import dateformat from "dateformat"

Expand Down
8 changes: 4 additions & 4 deletions examples/using-remark-copy-linked-files/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ class BlogIndex extends React.Component {
<Layout location={this.props.location}>
<Helmet title={siteTitle} />
<Bio />
{posts.map(post => {
if (post.node.frontmatter.path !== `/404/`) {
{posts
.filter(post => post.node.frontmatter.path !== `/404/`)
.map(post => {
const title = get(post, `node.frontmatter.title`) || post.node.path
return (
<div key={post.node.frontmatter.path}>
Expand All @@ -39,8 +40,7 @@ class BlogIndex extends React.Component {
<p dangerouslySetInnerHTML={{ __html: post.node.excerpt }} />
</div>
)
}
})}
})}
</Layout>
)
}
Expand Down
2 changes: 0 additions & 2 deletions packages/gatsby-source-contentful/src/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,6 @@ exports.createContentTypeNodes = ({
if (entryItemFieldKey.split(`___`).length > 1) {
return
}

entryItemFields[entryItemFieldKey] = entryItemFields[entryItemFieldKey]
})

// Replace text fields with text nodes so we can process their markdown
Expand Down
5 changes: 4 additions & 1 deletion packages/gatsby/cache-dir/load-directly-or-404.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export function getRedirectUrl(path) {
export default function(resources, path, replaceOnSuccess = false) {
return new Promise((resolve, reject) => {
const url = getRedirectUrl(path)
if (!url) return reject(url)
if (!url) {
reject(url)
return
}

// Always navigate directly if a custom 404 page doesn't exist.
if (!resources) {
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/cache-dir/navigation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import PropTypes from "prop-types"
import loader, { setApiRunnerForLoader } from "./loader"
import loader from "./loader"
import redirects from "./redirects.json"
import { apiRunner } from "./api-runner-browser"
import emitter from "./emitter"
Expand Down
1 change: 1 addition & 0 deletions packages/gatsby/cache-dir/prefetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const support = function(feature) {
} catch (err) {
return false
}
return false
}
const linkPrefetchStrategy = function(url) {
if (typeof document === `undefined`) {
Expand Down
2 changes: 2 additions & 0 deletions scripts/add-npm-owner/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env node
const util = require(`util`)
const exec = util.promisify(require(`child_process`).exec)
const argv = require(`yargs`)
.command(`$0 <user>`, `Add new owner to gatsby packages`)
.help().argv
Expand Down
9 changes: 1 addition & 8 deletions www/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ exports.onCreateNode = ({ node, actions, getNode, reporter }) => {
createNodeField({ node, name: `slug`, value: slug })
}
// end Community/Creators Pages
return null
}

exports.onCreatePage = ({ page, actions }) => {
Expand All @@ -641,11 +642,3 @@ exports.onPostBuild = () => {
`./public/gatsbygram.mp4`
)
}

// limited logging for debug purposes
let limitlogcount = 0
function log(max) {
return function(...args) {
if (limitlogcount++ < max) console.log(...args)
}
}
2 changes: 1 addition & 1 deletion www/src/components/ecosystem/ecosystem-board.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from "react-emotion"

import EcosystemSection from "./ecosystem-section"

import presets, { colors } from "../../utils/presets"
import presets from "../../utils/presets"

const EcosystemBoardRoot = styled(`div`)`
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/evaluation-cell.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from "react"
import React from "react"
import { rhythm } from "../utils/typography"
import presets, { colors } from "../utils/presets"

Expand Down
4 changes: 2 additions & 2 deletions www/src/components/layout/layout-with-heading.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React from "react"
import PropTypes from "prop-types"
import Helmet from "react-helmet"
import { SkipNavLink } from "@reach/skip-nav"
import styled, { css } from "react-emotion"
import styled from "react-emotion"

import Banner from "../banner"
import PageHeading from "./page-heading"
import Navigation from "../navigation"
import MobileNavigation from "../navigation-mobile"

import presets, { colors } from "../../utils/presets"
import presets from "../../utils/presets"

// Import Futura PT typeface
import "../../fonts/Webfonts/futurapt_book_macroman/stylesheet.css"
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/page-with-plugin-searchbar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component, Fragment } from "react"
import React, { Fragment } from "react"
import PluginSearchBar from "./plugin-searchbar-body"
import { rhythm } from "../utils/typography"
import presets, { colors } from "../utils/presets"
Expand Down
48 changes: 24 additions & 24 deletions www/src/views/community/community-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@ import Checkmark from "./check.svg"
import Button from "../../components/button"
import ArrowForwardIcon from "react-icons/lib/md/arrow-forward"

const CommunityHeaderLink = ({ linkTo, children }) => (
<li
css={{
display: `flex`,
alignItems: `center`,
margin: 0,
}}
>
<Link
to={linkTo}
state={{ filter: `` }}
activeStyle={{
backgroundColor: colors.gatsby,
color: `white`,
}}
css={{
...styles.communityHeaderLink,
}}
>
{children}
</Link>
</li>
)
// const CommunityHeaderLink = ({ linkTo, children }) => (
// <li
// css={{
// display: `flex`,
// alignItems: `center`,
// margin: 0,
// }}
// >
// <Link
// to={linkTo}
// state={{ filter: `` }}
// activeStyle={{
// backgroundColor: colors.gatsby,
// color: `white`,
// }}
// css={{
// ...styles.communityHeaderLink,
// }}
// >
// {children}
// </Link>
// </li>
// )

class CommunityHeader extends Component {
render() {
const { forHire, hiring, submissionText } = this.props
const { /*forHire, hiring,*/ submissionText } = this.props
return (
<div
css={{
Expand Down
2 changes: 1 addition & 1 deletion www/src/views/starter-library/filtered-starters.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class FilteredStarterLibrary extends Component {
onChangeUrlWithText = value => this.props.setURLState({ s: value })

render() {
const { data, urlState, setURLState } = this.props
const { data, urlState } = this.props
const {
setFiltersCategory,
setFiltersDependency,
Expand Down
2 changes: 1 addition & 1 deletion www/src/views/starter-library/starter-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const StartersList = ({ urlState, starters, count, sortRecent }) => {
const {
description,
gatsbyMajorVersion,
gatsbyDependencies,
name,
githubFullName,
lastUpdated,
Expand Down Expand Up @@ -171,6 +170,7 @@ const StartersList = ({ urlState, starters, count, sortRecent }) => {
</div>
)
}
return null
}

export default StartersList
Expand Down

0 comments on commit 692cf83

Please sign in to comment.