diff --git a/gatsby-node.js b/gatsby-node.js index af4204c..b85fd7f 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -1,8 +1,7 @@ -const _ = require('lodash') -const Promise = require('bluebird') -const path = require('path') +const _ = require("lodash") +const Promise = require("bluebird") +const path = require("path") const select = require(`unist-util-select`) -const precache = require(`sw-precache`) const fs = require(`fs-extra`) exports.createPages = ({ args }) => { @@ -10,8 +9,9 @@ exports.createPages = ({ args }) => { return new Promise((resolve, reject) => { const pages = [] - const blogPost = path.resolve('templates/template-blog-post.js') - graphql(` + const blogPost = path.resolve("templates/template-blog-post.js") + graphql( + ` { allMarkdownRemark(limit: 1000) { edges { @@ -21,15 +21,15 @@ exports.createPages = ({ args }) => { } } } - `) - .then((result) => { + ` + ).then(result => { if (result.errors) { console.log(result.errors) reject(result.errors) } // Create blog posts pages. - _.each(result.data.allMarkdownRemark.edges, (edge) => { + _.each(result.data.allMarkdownRemark.edges, edge => { pages.push({ path: edge.node.slug, // required component: blogPost, @@ -47,8 +47,8 @@ exports.createPages = ({ args }) => { // Add custom url pathname for blog posts. exports.modifyAST = ({ args }) => { const { ast } = args - const files = select(ast, 'File') - files.forEach((file) => { + const files = select(ast, "File") + files.forEach(file => { if (file.extension !== `md`) { return } diff --git a/package.json b/package.json index 5fbb330..b813a59 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "test": "echo \"Error: no test specified\" && exit 1", "develop": "gatsby develop", "build": "gatsby build", - "deploy": "gatsby build --prefix-links && gh-pages -d public" + "deploy": "gatsby build --prefix-links && gh-pages -d public", + "fix-semi": "eslint --quiet --ignore-pattern node_modules --ignore-pattern public --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix gatsby-node.js" } }