Skip to content

Commit

Permalink
chore: added eslint and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
taijusanagi committed Feb 5, 2022
1 parent a5f1ce2 commit e3aeed7
Show file tree
Hide file tree
Showing 11 changed files with 1,554 additions and 49 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,3 @@
{
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"]
}
9 changes: 8 additions & 1 deletion package.json
Expand Up @@ -11,10 +11,17 @@
"devDependencies": {
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0",
"husky": "^7.0.0"
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"husky": "^7.0.0",
"prettier": "^2.5.1"
},
"scripts": {
"prepare": "husky install",
"format": "prettier . --ignore-path .gitignore --write",
"lint": "eslint --ext .ts,.tsx . --ignore-path .gitignore",
"dev:frontend": "yarn workspace frontend dev"
}
}
7 changes: 6 additions & 1 deletion packages/frontend/.eslintrc.json
@@ -1,3 +1,8 @@
{
"extends": "next/core-web-vitals"
"extends": ["../../.eslintrc.json", "next"],
"settings": {
"next": {
"rootDir": "packages/frontend/"
}
}
}
4 changes: 2 additions & 2 deletions packages/frontend/next.config.js
@@ -1,6 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}
};

module.exports = nextConfig
module.exports = nextConfig;
1 change: 0 additions & 1 deletion packages/frontend/package.json
Expand Up @@ -16,7 +16,6 @@
"devDependencies": {
"@types/node": "17.0.15",
"@types/react": "17.0.39",
"eslint": "8.8.0",
"eslint-config-next": "12.0.10",
"typescript": "4.5.5"
}
Expand Down
8 changes: 4 additions & 4 deletions packages/frontend/pages/_app.tsx
@@ -1,8 +1,8 @@
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import "../styles/globals.css";
import type { AppProps } from "next/app";

function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
return <Component {...pageProps} />;
}

export default MyApp
export default MyApp;
13 changes: 5 additions & 8 deletions packages/frontend/pages/api/hello.ts
@@ -1,13 +1,10 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from "next";

type Data = {
name: string
}
name: string;
};

export default function handler(
req: NextApiRequest,
res: NextApiResponse<Data>
) {
res.status(200).json({ name: 'John Doe' })
export default function handler(req: NextApiRequest, res: NextApiResponse<Data>) {
res.status(200).json({ name: "John Doe" });
}
28 changes: 11 additions & 17 deletions packages/frontend/pages/index.tsx
@@ -1,7 +1,7 @@
import type { NextPage } from 'next'
import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'
import type { NextPage } from "next";
import Head from "next/head";
import Image from "next/image";
import styles from "../styles/Home.module.css";

const Home: NextPage = () => {
return (
Expand All @@ -18,8 +18,7 @@ const Home: NextPage = () => {
</h1>

<p className={styles.description}>
Get started by editing{' '}
<code className={styles.code}>pages/index.tsx</code>
Get started by editing <code className={styles.code}>pages/index.tsx</code>
</p>

<div className={styles.grid}>
Expand All @@ -33,10 +32,7 @@ const Home: NextPage = () => {
<p>Learn about Next.js in an interactive course with quizzes!</p>
</a>

<a
href="https://github.com/vercel/next.js/tree/canary/examples"
className={styles.card}
>
<a href="https://github.com/vercel/next.js/tree/canary/examples" className={styles.card}>
<h2>Examples &rarr;</h2>
<p>Discover and deploy boilerplate example Next.js projects.</p>
</a>
Expand All @@ -46,9 +42,7 @@ const Home: NextPage = () => {
className={styles.card}
>
<h2>Deploy &rarr;</h2>
<p>
Instantly deploy your Next.js site to a public URL with Vercel.
</p>
<p>Instantly deploy your Next.js site to a public URL with Vercel.</p>
</a>
</div>
</main>
Expand All @@ -59,14 +53,14 @@ const Home: NextPage = () => {
target="_blank"
rel="noopener noreferrer"
>
Powered by{' '}
Powered by{" "}
<span className={styles.logo}>
<Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
</span>
</a>
</footer>
</div>
)
}
);
};

export default Home
export default Home;
4 changes: 2 additions & 2 deletions packages/frontend/styles/Home.module.css
Expand Up @@ -61,8 +61,8 @@
border-radius: 5px;
padding: 0.75rem;
font-size: 1.1rem;
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
Bitstream Vera Sans Mono, Courier New, monospace;
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New,
monospace;
}

.grid {
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/styles/globals.css
Expand Up @@ -2,8 +2,8 @@ html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans,
Helvetica Neue, sans-serif;
}

a {
Expand Down

0 comments on commit e3aeed7

Please sign in to comment.