Skip to content

Commit

Permalink
🚨 Fix ESLint and Prettier errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pouretrebelle committed Feb 6, 2023
1 parent 1e67e68 commit d5f02ec
Show file tree
Hide file tree
Showing 45 changed files with 929 additions and 745 deletions.
7 changes: 1 addition & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@
"plugin:react/recommended",
"plugin:prettier/recommended"
],
"plugins": [
"@typescript-eslint",
"react",
"react-hooks",
"jsx-a11y"
],
"plugins": ["@typescript-eslint", "react", "react-hooks", "jsx-a11y"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Nightly deploy

on:
schedule:
- cron: '0 0 * * *'
- cron: '0 0 * * *'

jobs:
deploy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Snapshots

on:
schedule:
- cron: '0 0 * * *'
- cron: '0 0 * * *'

jobs:
lint:
Expand Down
6 changes: 4 additions & 2 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
require('ts-node').register()

// typescript files
exports.createPagesStatefully = require('lib/gatsby-node/createPagesStatefully').createPagesStatefully
exports.createPagesStatefully =
require('lib/gatsby-node/createPagesStatefully').createPagesStatefully
exports.onCreateNode = require('lib/gatsby-node/onCreateNode').onCreateNode
exports.createSchemaCustomization = require('lib/gatsby-node/createSchemaCustomization').createSchemaCustomization
exports.createSchemaCustomization =
require('lib/gatsby-node/createSchemaCustomization').createSchemaCustomization
exports.onPostBuild = require('lib/gatsby-node/onPostBuild').onPostBuild
23 changes: 14 additions & 9 deletions plugins/gatsby-plugin-vibrant-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
### Installation

1. `npm i gatsby-plugin-extract-image-colors`
Or,
`yarn add gatsby-plugin-extract-image-colors`
Or,
`yarn add gatsby-plugin-extract-image-colors`
2. Add config to `gatsby-config.js`

```js
// gatsby-config.js
module.exports = {
plugins: [
//... Other plugins
'gatsby-plugin-extract-image-colors'
]
'gatsby-plugin-extract-image-colors',
],
}
```

Expand All @@ -31,10 +31,10 @@ module.exports = {
{
resolve: 'gatsby-plugin-extract-image-colors',
options: {
extensions: ['jpg', 'png']
}
}
]
extensions: ['jpg', 'png'],
},
},
],
}
```

Expand Down Expand Up @@ -77,7 +77,12 @@ const query = graphql`
const ImageWithBackground = () => {
const data = useStaticQuery(query)
return (
<div style={{ backgroundColor: data.file.childImageColors.vibrant, height: '100vh' }}>
<div
style={{
backgroundColor: data.file.childImageColors.vibrant,
height: '100vh',
}}
>
<Img fluid={data.file.childImageSharp.fluid} />
</div>
)
Expand Down
66 changes: 34 additions & 32 deletions plugins/gatsby-plugin-vibrant-image/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
"use strict";
'use strict'

const fs = require('fs');
const fs = require('fs')

const Vibrant = require('node-vibrant');
const Vibrant = require('node-vibrant')

const Color = require('color');
const Color = require('color')

const CoreUtils = require('gatsby-core-utils');
const CoreUtils = require('gatsby-core-utils')

const defaultOptions = {
extensions: ['jpg', 'png'],
exclude: []
};
exclude: [],
}

const getHex = rgb => {
const getHex = (rgb) => {
return Color({
r: rgb[0],
g: rgb[1],
b: rgb[2]
}).hex();
};

exports.onCreateNode = async ({
node,
actions
}, pluginOptions) => {
const options = Object.assign({}, { ...defaultOptions,
...pluginOptions
});

if (options && options.extensions && options.exclude && options.extensions.indexOf(node.extension) !== -1 && options.exclude.indexOf(`${node.name}${node.ext}`) === -1) {
b: rgb[2],
}).hex()
}

exports.onCreateNode = async ({ node, actions }, pluginOptions) => {
const options = Object.assign({}, { ...defaultOptions, ...pluginOptions })

if (
options &&
options.extensions &&
options.exclude &&
options.extensions.indexOf(node.extension) !== -1 &&
options.exclude.indexOf(`${node.name}${node.ext}`) === -1
) {
// Transform the new node here and create a new node or
// create a new node field.
await Vibrant.from(node.absolutePath).getPalette((err, palette) => {
Expand All @@ -39,20 +40,21 @@ exports.onCreateNode = async ({
lightVibrant: getHex(palette.LightVibrant._rgb),
muted: getHex(palette.Muted._rgb),
darkMuted: getHex(palette.DarkMuted._rgb),
lightMuted: getHex(palette.LightMuted._rgb)
};
const imageColorsNode = { ...colors,
lightMuted: getHex(palette.LightMuted._rgb),
}
const imageColorsNode = {
...colors,
id: `${node.id}-colors`,
internal: {
type: 'ImageColors',
contentDigest: CoreUtils.createContentDigest(node)
}
};
actions.createNode(imageColorsNode);
contentDigest: CoreUtils.createContentDigest(node),
},
}
actions.createNode(imageColorsNode)
actions.createParentChildLink({
parent: node,
child: imageColorsNode
});
});
child: imageColorsNode,
})
})
}
};
}
8 changes: 4 additions & 4 deletions plugins/gatsby-plugin-vibrant-image/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const CoreUtils = require('gatsby-core-utils')

const defaultOptions = {
extensions: ['jpg', 'png'],
exclude: []
exclude: [],
}

const getHex = rgb => {
const getHex = (rgb) => {
return Color({
r: rgb[0],
g: rgb[1],
b: rgb[2]
b: rgb[2],
}).hex()
}

Expand All @@ -34,7 +34,7 @@ exports.onCreateNode = async ({ node, actions }, pluginOptions) => {
lightVibrant: getHex(palette.LightVibrant._rgb),
muted: getHex(palette.Muted._rgb),
darkMuted: getHex(palette.DarkMuted._rgb),
lightMuted: getHex(palette.LightMuted._rgb)
lightMuted: getHex(palette.LightMuted._rgb),
}

const imageColorsNode = {
Expand Down
4 changes: 2 additions & 2 deletions plugins/gatsby-transformer-remark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ Edit your Markdown files to include that HTML tag after the text you'd like to a

```markdown
---
title: "my little pony"
date: "2017-09-18T23:19:51.246Z"
title: 'my little pony'
date: '2017-09-18T23:19:51.246Z'
---

<p>Where oh where is that pony?</p>
Expand Down
14 changes: 7 additions & 7 deletions plugins/gatsby-transformer-remark/code-handler.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"use strict";
'use strict'

const defaultHandler = require(`mdast-util-to-hast/lib/handlers/code`);
const defaultHandler = require(`mdast-util-to-hast/lib/handlers/code`)

module.exports = handler;
module.exports = handler

function handler(h, node) {
const result = defaultHandler(h, node);
const result = defaultHandler(h, node)

if (node.meta && result.children[0]) {
result.children[0].properties.dataMeta = node.meta;
result.children[0].properties.dataMeta = node.meta
}

return result;
}
return result
}
25 changes: 13 additions & 12 deletions plugins/gatsby-transformer-remark/create-schema-customization.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use strict";
'use strict'

const typeDefs = `
type MarkdownHeading {
Expand Down Expand Up @@ -31,23 +31,24 @@ const typeDefs = `
type MarkdownRemark implements Node @infer @childOf(mimeTypes: ["text/markdown", "text/x-markdown"]) {
id: ID!
}
`;
`

module.exports = (nodeApiArgs, pluginOptions = {}) => {
const {
plugins = []
} = pluginOptions;
nodeApiArgs.actions.createTypes(typeDefs); // This allows subplugins to use Node APIs bound to `gatsby-transformer-remark`
const { plugins = [] } = pluginOptions
nodeApiArgs.actions.createTypes(typeDefs) // This allows subplugins to use Node APIs bound to `gatsby-transformer-remark`
// to customize the GraphQL schema. This makes it possible for subplugins to
// modify types owned by `gatsby-transformer-remark`.

plugins.forEach(plugin => {
const resolvedPlugin = "4" === `4` ? plugin.module : require(plugin.resolve);
plugins.forEach((plugin) => {
const resolvedPlugin = '4' === `4` ? plugin.module : require(plugin.resolve)

if (typeof resolvedPlugin.createSchemaCustomization === `function`) {
resolvedPlugin.createSchemaCustomization(nodeApiArgs, plugin.pluginOptions);
resolvedPlugin.createSchemaCustomization(
nodeApiArgs,
plugin.pluginOptions
)
}
});
};
})
}

module.exports.typeDefs = typeDefs;
module.exports.typeDefs = typeDefs
Loading

0 comments on commit d5f02ec

Please sign in to comment.