shell
npx create-expo-app@latest --template tabs@50
プロジェクト名を聞かれますが、自分は GitHub から clone したリポジトリのルートで上のコマンドを実行して、プロジェクト名は .
を打っています。すると、リポジトリのルートにそのままプロジェクトファイルが作られていきます。
https://docs.expo.dev/guides/typescript/
まずは動作確認
インストール後に以下のようなコマンドが表示されます。
- npm run android
- npm run ios
- npm run web
shell
npm run ios
コマンドを打つと、iPhoneのシミュレーターが立ち上がります(既にシミュレーターをインストール済である必要があります)
実機で動作確認する
shell
npx expo start --tunnel --clear
https://docs.expo.dev/more/expo-cli/
ビルドしてリリースする
shell
eas build:configure
eas build
eas submit
https://docs.expo.dev/build/introduction/
ESLint の設定
shell
npm install eslint --save-dev
shell
npm init @eslint/config
✔ How would you like to use ESLint? · style
✔ What type of modules does your project use? · esm
✔ Which framework does your project use? · react
✔ Does your project use TypeScript? · Yes
✔ Where does your code run? · browser
✔ How would you like to define a style for your project? · guide
✔ Which style guide do you want to follow? · standard-with-typescript
✔ What format do you want your config file to be in? · JavaScript
Checking peerDependencies of eslint-config-standard-with-typescript@latest
The config that you've selected requires the following dependencies:
eslint-plugin-react@latest eslint-config-standard-with-typescript@latest @typescript-eslint/eslint-plugin@^5.43.0 eslint@^8.0.1 eslint-plugin-import@^2.25.2 eslint-plugin-n@^15.0.0 eslint-plugin-promise@^6.0.0 typescript@*
✔ Would you like to install them now? · Yes
✔ Which package manager do you want to use? · npm
.eslintrc.js
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ['plugin:react/recommended', 'standard-with-typescript', 'prettier'],
overrides: [],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
},
plugins: ['react'],
rules: {
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-floating-promises': 'off',
},
};
Prettier の設定
shell
npm install --save-dev prettier eslint-config-prettier @trivago/prettier-plugin-sort-imports eslint-config-prettier
shell
touch .prettierrc.json
.prettierrc.json
{
"arrowParens": "always",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"quoteProps": "as-needed",
"singleQuote": true,
"semi": true,
"printWidth": 100,
"useTabs": false,
"tabWidth": 2,
"trailingComma": "es5",
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
}