The first step is to use the Expo CLI to initialize the project. If you don't have the latest version of the Expo CLI tool, (or you don't have it installed) run npm install -g expo-cli
.
Now run the following commands in the same order:
expo init my-app -t expo-template-blank-typescript
npx install-peerdeps --dev eslint-config-airbnb
npm i --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin
npm i --save-dev prettier eslint-config-prettier eslint-plugin-prettier
Create or edit the file .eslintrc.json
with the following content:
{
"extends": [
"airbnb",
"airbnb/hooks",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/react",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"plugins": ["@typescript-eslint", "react", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"import/no-unresolved": 0,
"react/jsx-filename-extension": [1, {
"extensions": [
".ts",
".tsx"
]
}],
"prettier/prettier": [
"error",
{
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid",
"endOfLine": "auto"
}
],
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"import/extensions": ["error", "never"],
"react/prop-types": 0,
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"]
}
}
I found your post on dev.to and tried to add eslint and prettier to my project. Unfortunately i get the following error
ESLint couldn't find the config "prettier/react" to extend from. Please check that the name of the config is correct. ESLint couldn't find the config "prettier/@typescript-eslint" to extend from.
How can i solve this?