npx create-react-app [프로젝트이름] --template typescript
yarn add -D eslint prettier
yarn add -D @typescript-eslint/eslint-plugin @typescript-eslint/parser
yarn add -D eslint-config-airbnb
yarn add -D eslint-config-prettier eslint-plugin-prettier
yarn add -D eslint-plugin-react eslint-plugin-react-hooks
yarn add -D eslint-plugin-jsx-a11y eslint-plugin-import
module.exports = {
env: {
browser: true,
es2020: true,
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'prettier'],
extends: [
'airbnb',
'airbnb/hooks',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
rules: {
'no-underscore-dangle': 0,
'lines-between-class-members': 0,
'class-methods-use-this': 0,
'react/require-default-props': 0,
'react/jsx-no-useless-fragment': 0,
'react/function-component-definition': 'off',
'react/react-in-jsx-scope': 'off',
'react/prop-types': 0,
'no-extra-semi': 'error',
'react/jsx-filename-extension': [2, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }], // 확장자로 js와 jsx ts tsx 허용하도록 수정
'arrow-parens': ['warn', 'as-needed'], // 화살표 함수의 파라미터가 하나일때 괄호 생략
'no-unused-vars': ['off'], // 사용하지 않는 변수가 있을때 빌드에러가 나던 규칙 해제
'no-console': ['off'], // 콘솔을 쓰면 에러가 나던 규칙 해제
'import/prefer-default-export': ['off'], // export const 문을 쓸때 에러를 내는 규칙 해제
'react-hooks/exhaustive-deps': ['warn'], // hooks의 의존성배열이 충분하지 않을때 강제로 의존성을 추가하는 규칙을 완화
'react/jsx-props-no-spreading': [1, { custom: 'ignore' }], // props spreading을 허용하지 않는 규칙 해제
'linebreak-style': 0,
'prettier/prettier': 0,
'import/extensions': 0,
'no-use-before-define': 0,
'import/no-unresolved': 0,
'import/no-extraneous-dependencies': 0, // 테스트 또는 개발환경을 구성하는 파일에서는 devDependency 사용을 허용
'no-shadow': 0,
'jsx-a11y/no-noninteractive-element-interactions': 0,
'no-nested-ternary': 0 // 삼항 연산자 안에 삼항 연산자 가능.
},
};
{
"parser": "typescript",
"singleQuote": true,
"printWidth": 110,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"quoteProps": "as-needed",
"jsxSingleQuote": true,
"trailingComma": "all",
"arrowParens": "always",
"endOfLine": "lf",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"requirePragma": false,
"insertPragma": false,
"proseWrap": "preserve",
"vueIndentScriptAndStyle": false
}
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"allowSyntheticDefaultImports": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}
yarn add @emotion/react @emotion/styled
yarn add i18next i18next-browser-languagedetector
yarn add i18next-http-backend react-i18next
yarn add axios react-query
yarn add react-router-dom
yarn add styled-components
yarn add qs
yarn add @emotion/css --dev
yarn add recoil
yarn add @mui/material
yarn add react-toastify
yarn add styled-reset
import i18n from 'i18next';
import Backend from 'i18next-http-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
fallbackLng: sessionStorage.getItem('i18nextLng') ?? navigator.language.includes('ko') ? 'ko' : 'en',
debug: false,
detection: {
order: ['sessionStorage'],
caches: ['sessionStorage'],
},
// interpolation: {
// escapeValue: false,
// },
react: {
useSuspense: true,
},
});
export default i18n;