Skip to content

Commit

Permalink
feat: add pre-commit eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
a-honey committed Dec 7, 2023
1 parent be0583f commit c9f71b6
Show file tree
Hide file tree
Showing 11 changed files with 1,081 additions and 78 deletions.
13 changes: 13 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": "standard-with-typescript",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
}
}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
26 changes: 22 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "mala-web",
"name": "mara-web",
"version": "0.1.0",
"private": true,
"scripts": {
Expand All @@ -9,7 +9,14 @@
"lint": "next lint",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"prepare": "husky install"
"prepare": "husky install",
"lint-fix": "eslint \"**\\*.{ts,tsx}\" --ext .ts,.tsx --fix",
"lint-staged": "lint-staged"
},
"lint-staged": {
"src/**": [
"eslint --fix"
]
},
"dependencies": {
"@commitlint/cli": "^18.4.3",
Expand All @@ -30,11 +37,22 @@
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"autoprefixer": "^10.0.1",
"eslint": "^8.0.1",
"eslint-config-standard-with-typescript": "^40.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
"eslint-plugin-promise": "^6.0.0",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"postcss": "^8",
"storybook": "7.6.3",
"tailwindcss": "^3.3.0",
"typescript": "^5"
}
"typescript": "*"
},
"main": "index.js",
"repository": "https://github.com/DDD-Community/mara-web.git",
"author": "a-honey <[email protected]>",
"license": "MIT"
}
2 changes: 1 addition & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@/styles/globals.css'
import type { AppProps } from 'next/app'

export default function App({ Component, pageProps }: AppProps) {
export default function App ({ Component, pageProps }: AppProps): JSX.Element {
return <Component {...pageProps} />
}
2 changes: 1 addition & 1 deletion src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Html, Head, Main, NextScript } from 'next/document'

export default function Document() {
export default function Document (): JSX.Element {
return (
<Html lang="en">
<Head />
Expand Down
6 changes: 3 additions & 3 deletions src/pages/api/hello.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'

type Data = {
interface Data {
name: string
}

export default function handler(
export default function handler (
req: NextApiRequest,
res: NextApiResponse<Data>
) {
): void {
res.status(200).json({ name: 'John Doe' })
}
8 changes: 4 additions & 4 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Inter } from "next/font/google";
import { Inter } from 'next/font/google'

const inter = Inter({ subsets: ["latin"] });
const inter = Inter({ subsets: ['latin'] })

export default function Home() {
export default function Home (): JSX.Element {
return (
<main
className={`flex min-h-screen flex-col items-center justify-between p-24 ${inter.className}`}
Expand All @@ -11,5 +11,5 @@ export default function Home() {
next js
</div>
</main>
);
)
}
12 changes: 6 additions & 6 deletions src/stories/Test.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import Test from "./Test";
import React from 'react'
import Test from './Test'

export default {
title: "Components/Test",
component: Test,
};
title: 'Components/Test',
component: Test
}

export const Default: React.FC = (args: any) => <Test {...args} />;
export const Default: React.FC = (args: any) => <Test {...args} />
8 changes: 4 additions & 4 deletions src/stories/Test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Test = () => {
return <div className="bg-orange-300">스토리북테스트</div>;
};
const Test: React.FC = () => {
return <div className="bg-orange-300">스토리북테스트</div>
}

export default Test;
export default Test
26 changes: 13 additions & 13 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import type { Config } from "tailwindcss";
import type { Config } from 'tailwindcss'

const config: Config = {
content: [
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
"./src/stories/*.{js,ts,jsx,tsx,mdx}",
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
'./src/stories/*.{js,ts,jsx,tsx,mdx}'
],
theme: {
extend: {
backgroundImage: {
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
"gradient-conic":
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
},
},
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))'
}
}
},
plugins: [],
};
export default config;
plugins: []
}
export default config
Loading

0 comments on commit c9f71b6

Please sign in to comment.