npx create-react-app your-app --template typescript --use-npm
cd your-app
curl -o .prettierrc https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.prettierrc
curl -o .prettierignore https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.prettierignore
mkdir .vscode
curl -o .vscode/extensions.json https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.vscode_extensions.json
curl -o .vscode/settings.json https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.vscode_settings.json
curl -o .editorconfig https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.editorconfig
npx install-peerdeps --dev eslint-config-react-app
npm install eslint-plugin-react-hooks @typescript-eslint/eslint-plugin @typescript-eslint/parser --save-dev
npm install eslint-config-airbnb-typescript --save-dev
npx install-peerdeps --dev eslint-plugin-prettier
npm install eslint-config-prettier --save-dev
npm install @testing-library/react @testing-library/user-event @types/jest @types/node @types/react @types/react-dom react-scripts [email protected] @babel/core --save-dev
Add the Rules for prettier to the .eslintrc.json
curl -o .eslintrc.json https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.eslintrc.json
curl -o .eslintignore https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.eslintignore
npm install --save-dev husky
Add to you package.json
"husky": {
"hooks": {
"pre-commit": "npm run lint",
"pre-push": "npm run lint"
}
}
Add to your script in package.json
"scripts": {
...
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
...
}
Then enjoy to fix the errors in the base react typescript template
For reportWebVitals.ts
I use at the /* eslint-disable */
top or just remove it rm src/reportWebVitals.ts
I also move all the dependecies except react
, react-dom
and web-vitals @testing-library/jest-dom
to the devDependencies
Don't forget to restart your vscode and do npm install after all setup