From f11badf8a6c47bb9764eec53c9f621723c9f7b38 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Sat, 21 Oct 2017 13:04:33 -0700 Subject: [PATCH] Updated Prettier tasks to cover gatsby-* JS files in root --- gatsby-node.js | 49 +++++++++++++++++++++++++------------------------ package.json | 4 ++-- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/gatsby-node.js b/gatsby-node.js index 0fc10c4f..3abded6b 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -36,19 +36,19 @@ exports.createPages = async ({graphql, boundActionCreators}) => { const allMarkdown = await graphql( ` - { - allMarkdownRemark(limit: 1000) { - edges { - node { - fields { - redirect - slug + { + allMarkdownRemark(limit: 1000) { + edges { + node { + fields { + redirect + slug + } } } } } - } - `, + `, ); if (allMarkdown.errors) { @@ -116,9 +116,10 @@ exports.createPages = async ({graphql, boundActionCreators}) => { redirect.forEach(fromPath => { if (redirectToSlugMap[fromPath] != null) { - console.error(`Duplicate redirect detected from "${fromPath}" to:\n` + - `* ${redirectToSlugMap[fromPath]}\n` + - `* ${slug}\n` + console.error( + `Duplicate redirect detected from "${fromPath}" to:\n` + + `* ${redirectToSlugMap[fromPath]}\n` + + `* ${slug}\n`, ); process.exit(1); } @@ -136,22 +137,22 @@ exports.createPages = async ({graphql, boundActionCreators}) => { const newestBlogEntry = await graphql( ` - { - allMarkdownRemark( - limit: 1, - filter: { id: { regex: "/blog/" } } - sort: { fields: [fields___date], order: DESC } - ) { - edges { - node { - fields { - slug + { + allMarkdownRemark( + limit: 1 + filter: {id: {regex: "/blog/"}} + sort: {fields: [fields___date], order: DESC} + ) { + edges { + node { + fields { + slug + } } } } } - } - `, + `, ); const newestBlogNode = newestBlogEntry.data.allMarkdownRemark.edges[0].node; diff --git a/package.json b/package.json index 296ae387..829c9314 100644 --- a/package.json +++ b/package.json @@ -77,8 +77,8 @@ "dev": "gatsby develop -H 0.0.0.0", "lint": "eslint .", "netlify": "yarn install && yarn build", - "prettier": "prettier --config .prettierrc --write \"{flow-typed,plugins,src}/**/*.js\"", - "prettier:diff": "prettier --config .prettierrc --list-different \"{flow-typed,plugins,src}/**/*.js\"", + "prettier": "prettier --config .prettierrc --write \"{gatsby-*.js,{flow-typed,plugins,src}/**/*.js}\"", + "prettier:diff": "prettier --config .prettierrc --list-different \"{gatsby-*.js,{flow-typed,plugins,src}/**/*.js}\"", "reset": "rimraf ./.cache" }, "devDependencies": {