2021. 04. 01
.prettierrc
{
"arrowParens": "avoid",
"singleQuote": true,
"semi": false,
"useTabs": false,
"tabWidth": 2,
"trailingComma": "none",
"printWidth": 80
}
tsconfig.json
{
"compilerOptions": {
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"baseUrl": "./src"
},
"exclude": ["node_modules"],
"include": ["**/*.ts", "**/*.tsx", "**/*.js"]
}
tailwind.config.js
const colors = require('tailwindcss/colors')
module.exports = {
purge: ['./src/**/*.{js,jsx,ts,tsx}'],
darkMode: false,
theme: {
extend: {
colors: {
...colors
}
}
},
variants: {
extend: {}
},
plugins: []
}
process.env typescript
declare namespace NodeJS {
interface Process {
env: ProcessEnv
}
interface ProcessEnv {
NODE_ENV: string
}
}
nextjs typescript _app.tsx
import 'styles/globals.css'
import App from 'next/app'
import { ErrorInfo } from 'react'
interface Props {}
interface State {
hasError: boolean
}
class MyApp extends App<Props, {}, State> {
state = {
hasError: false
}
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
if (error) this.setState({ hasError: true })
}
static getDerivedStateFromError() {
return { hasError: true }
}
render() {
const {} = this.state
const { Component, pageProps } = this.props
return <Component {...pageProps} />
}
}
export default MyApp