Skip to content

Commit 92515df

Browse files
committed
fix prettier and eslint
1 parent b246611 commit 92515df

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

.prettierrc.js

-1
This file was deleted.

.prettierrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
singleQuote: true,
3+
jsxSingleQuote: true,
4+
trailingComma: 'none',
5+
arrowParens: 'avoid',
6+
endOfLine: 'auto',
7+
};

pages/post/[postname].js

+13-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import PropTypes from 'prop-types';
22
import matter from 'gray-matter';
33
import ReactMarkdown from 'react-markdown';
4-
import remarkGfm from 'remark-gfm'
4+
import remarkGfm from 'remark-gfm';
55
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
66
import Layout from 'components/Layout';
77
import headerColor from 'helpers/post-header';
@@ -12,7 +12,7 @@ export default function BlogPost({
1212
siteTitle,
1313
frontmatter,
1414
markdownBody,
15-
date,
15+
date
1616
}) {
1717
// eslint-disable-next-line react/jsx-no-useless-fragment
1818
if (!frontmatter) return <></>;
@@ -42,23 +42,21 @@ export default function BlogPost({
4242
<div className='container'>
4343
<div className={styles.post__intro}>{frontmatter.intro}</div>
4444
<ReactMarkdown
45-
includeElementIndex={true}
4645
remarkPlugins={[remarkGfm]}
4746
components={{
48-
code({ node, inline, className, children, ref }) {
47+
// eslint-disable-next-line react/no-unstable-nested-components
48+
code({ inline, className, children }) {
4949
const match = /language-(\w+)/.exec(className || '');
5050

5151
return !inline && match ? (
52-
<SyntaxHighlighter
53-
language={match[1]}
54-
>
52+
<SyntaxHighlighter language={match[1]}>
5553
{String(children).replace(/\n$/, '')}
5654
</SyntaxHighlighter>
5755
) : (
5856
<code className={className}>{children}</code>
5957
);
6058
},
61-
img: ProgressiveImage,
59+
img: ProgressiveImage
6260
}}
6361
>
6462
{markdownBody}
@@ -74,7 +72,7 @@ BlogPost.propTypes = {
7472
siteTitle: PropTypes.string,
7573
frontmatter: PropTypes.object,
7674
markdownBody: PropTypes.string,
77-
date: PropTypes.array,
75+
date: PropTypes.array
7876
};
7977

8078
export async function getStaticProps({ ...ctx }) {
@@ -89,15 +87,15 @@ export async function getStaticProps({ ...ctx }) {
8987
siteTitle: config.title,
9088
frontmatter: data.data,
9189
markdownBody: data.content,
92-
date,
93-
},
90+
date
91+
}
9492
};
9593
}
9694

9795
export async function getStaticPaths() {
98-
const blogSlugs = ((context) => {
96+
const blogSlugs = (context => {
9997
const keys = context.keys();
100-
const data = keys.map((key) => {
98+
const data = keys.map(key => {
10199
const slug = key.replace(/^.*[\\/]/, '').slice(0, -3);
102100

103101
return slug;
@@ -106,10 +104,10 @@ export async function getStaticPaths() {
106104
return data;
107105
})(require.context('../../posts', true, /\.\/.*\.md$/));
108106

109-
const paths = blogSlugs.map((slug) => `/post/${slug}`);
107+
const paths = blogSlugs.map(slug => `/post/${slug}`);
110108

111109
return {
112110
paths,
113-
fallback: false,
111+
fallback: false
114112
};
115113
}

0 commit comments

Comments
 (0)