add lint-fix command

This commit is contained in:
Chuck Dries 2021-06-14 18:10:54 -07:00
parent e54d501f0f
commit 077a4149c9
No known key found for this signature in database
GPG Key ID: 4E6B9B2DCEC64BA9
4 changed files with 23 additions and 22 deletions

View File

@ -12,7 +12,8 @@
"start": "gatsby develop", "start": "gatsby develop",
"build": "gatsby build", "build": "gatsby build",
"serve": "gatsby serve", "serve": "gatsby serve",
"clean": "gatsby clean" "clean": "gatsby clean",
"lint-fix": "eslint --fix --ext .jsx,.js src"
}, },
"dependencies": { "dependencies": {
"@mdx-js/mdx": "^1.6.22", "@mdx-js/mdx": "^1.6.22",

View File

@ -1,12 +1,12 @@
import React from 'react' import React from 'react';
import { graphql } from 'gatsby' import { graphql } from 'gatsby';
import { getMeta, getName, hasName } from '../utils'; import { getMeta, getName, hasName } from '../utils';
import { GatsbyImage, getImage } from 'gatsby-plugin-image' import { GatsbyImage, getImage } from 'gatsby-plugin-image';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';
import classnames from 'classnames' import classnames from 'classnames';
const GalleryImage = ({ data }) => { const GalleryImage = ({ data }) => {
const image = data.allFile.edges[0].node const image = data.allFile.edges[0].node;
const ar = image.childImageSharp.fluid.aspectRatio; const ar = image.childImageSharp.fluid.aspectRatio;
console.log(ar); console.log(ar);
// const imageStyle = {} // const imageStyle = {}
@ -16,7 +16,7 @@ const GalleryImage = ({ data }) => {
// imageStyle.height = '90vh' // imageStyle.height = '90vh'
// } // }
console.log(`calc(90vw * ${ar})px`) console.log(`calc(90vw * ${ar})px`);
const name = getName(image); const name = getName(image);
return (<> return (<>
@ -50,7 +50,7 @@ const GalleryImage = ({ data }) => {
</div> </div>
</div> </div>
</>); </>);
} };
export const query = graphql` export const query = graphql`
query GalleryImage($imageFilename: String) { query GalleryImage($imageFilename: String) {
@ -93,6 +93,6 @@ export const query = graphql`
} }
` `;
export default GalleryImage export default GalleryImage;

View File

@ -1,28 +1,28 @@
import * as React from 'react' import * as React from 'react';
import { Link } from 'gatsby' import { Link } from 'gatsby';
// styles // styles
const pageStyles = { const pageStyles = {
color: '#232129', color: '#232129',
padding: '96px', padding: '96px',
fontFamily: '-apple-system, Roboto, sans-serif, serif', fontFamily: '-apple-system, Roboto, sans-serif, serif',
} };
const headingStyles = { const headingStyles = {
marginTop: 0, marginTop: 0,
marginBottom: 64, marginBottom: 64,
maxWidth: 320, maxWidth: 320,
} };
const paragraphStyles = { const paragraphStyles = {
marginBottom: 48, marginBottom: 48,
} };
const codeStyles = { const codeStyles = {
color: '#8A6534', color: '#8A6534',
padding: 4, padding: 4,
backgroundColor: '#FFF4DB', backgroundColor: '#FFF4DB',
fontSize: '1.25rem', fontSize: '1.25rem',
borderRadius: 4, borderRadius: 4,
} };
// markup // markup
const NotFoundPage = () => { const NotFoundPage = () => {
@ -48,7 +48,7 @@ const NotFoundPage = () => {
<Link to="/">Go home</Link>. <Link to="/">Go home</Link>.
</p> </p>
</main> </main>
) );
} };
export default NotFoundPage export default NotFoundPage;

View File

@ -1,5 +1,5 @@
export const getMeta = (image) => image.childImageSharp.fields.imageMeta export const getMeta = (image) => image.childImageSharp.fields.imageMeta;
export const getName = (image) => getMeta(image)?.iptc.object_name || image.base export const getName = (image) => getMeta(image)?.iptc.object_name || image.base;
export const hasName = (image) => Boolean(getMeta(image)?.iptc.object_name) export const hasName = (image) => Boolean(getMeta(image)?.iptc.object_name);