React Native 환경설정(1)

SELOG·2023년 10월 13일
0

ReactNative

목록 보기
2/2
  • 초기 React-Native 설치

    npx react-native init Dallim --template react-native-template-typescript

  • eslint, prettier 설정

1. tslint 통합

npm install --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser (안됨)

npm install --save-dev prettier@latest
npm install --save-dev eslint-plugin-prettier eslint-config-prettier

2. pretter 통합

npm install --save-dev eslint-plugin-prettier eslint-config-prettier

  • .eslintrc.js 는 아래와 같이 변경

    module.exports = {
    root: true,
    parser: '@typescript-eslint/parser',
    extends: [
    '@react-native-community',
    'plugin:@typescript-eslint/recommended',
    'plugin:prettier/recommended', // Prettier 권장 설정 추가 // 반드시 마지막에 넣어주어야 한다.
    ],
    plugins: ['@typescript-eslint'],
    rules: {
    // 다른 규칙을 설정할 수 있습니다.
    },
    };

  • ESLint 설정을 마지막에 추가
    "eslint.format.enable": true,
    "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
    }
  • tsconfig.json 설정

    {
    "extends": "@tsconfig/react-native/tsconfig.json",
    "compilerOptions": {
    // 기존 옵션들...
    "baseUrl": "./",
    "paths": {
    "@component/": ["./src/component/"],
    "@model/": ["./src/model/"],
    "@model": ["./src/model"]
    }
    },
    }

profile
금융 IT 전문가가 될거야

0개의 댓글