Browse Source

Updated Prettier tasks to cover gatsby-* JS files in root

main
Brian Vaughn 7 years ago
parent
commit
f11badf8a6
  1. 49
      gatsby-node.js
  2. 4
      package.json

49
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;

4
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": {

Loading…
Cancel
Save