-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
npm init
npm init -y를 통해 package.json 생성
react, react-dom 설치
npm i -D react react-dom @types/react @types/react-dom
- 버전에 맞게 peerDependencies 추가
"peerDependencies": {
"react": "*",
"react-dom": "*"
}
typescript 설정
npm i -D typescript
- 프로젝트 최상단에 tsconfig.json을 생성한다.
{
"include": ["src"],
"exclude": [
"dist",
"node_modules"
],
"compilerOptions": {
"module": "esnext",
"lib": ["dom", "esnext"],
"importHelpers": true,
"declaration": true,
"sourceMap": true,
"rootDir": "./src",
"outDir": "./dist/esm",
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"moduleResolution": "node",
"jsx": "react",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
}
}
babel 설정
npm i -D @babel/core @babel/preset-react @babel/preset-typescript
// .babelrc.js
module.exports = {
"presets": ["@babel/preset-react", "@babel/preset-typescript"],
}
eslint 설정
npm i -D eslint eslint-plugin-react eslint-plugin-react-hooks @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-airbnb
// .eslintrc.js
module.exports = {
root: true,
extends: [
'airbnb',
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'react', 'react-hooks'],
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/jsx-filename-extension': [
2,
{
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'import/extensions': 'off',
'import/order': [
'error',
{
groups: ['external', 'sibling'],
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['react'],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always',
},
],
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
node: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.json'],
},
},
'import/extensions': ['.js', '.ts', '.mjs', '.jsx', '.tsx'],
},
env: {
browser: true,
node: true,
},
globals: {
JSX: true,
},
};
.eslintignore생성
node_modules
dist
prettier 설정
npm i -D eslint-config-prettier eslint-plugin-prettier prettier
.prettierrc.js생성
module.exports = {
printWidth: 120,
tabWidth: 2,
singleQuote: true,
trailingComma: 'all',
semi: true,
useTabs: false,
endOfLine: 'auto',
bracketSpacing: true,
bracketLine: true,
};
roullup 설정
npm i -D rollup rollup-plugin-typescript2 @rollup/plugin-commonjs @rollup/plugin-node-resolve rollup-plugin-peer-deps-external @rollup/plugin-babel @rollup/plugin-image
storybook 설정
npx storybook init
Metadata
Metadata
Assignees
Labels
No labels