I installed React TypeScript using the create react-app my-app - typescript package, I just can’t install Prettier after this. How to install Prettier?

    1 answer 1

    ## Если еще не создан, делаем проект: npx create-react-app my-app --typescript ## Переходим в папку с проектом cd my-app ## Устанавливаем пакеты npm install --save-dev husky lint-staged prettier 

    Open package.json and expand the configuration:

     { // ... "scripts": { // ... "precommit": "lint-staged", "prettify": "prettier --write './src/**/*.{js,json,jsx,ts,tsx,css,scss}'" }, "lint-staged": { "src/**/*.{js,json,jsx,ts,tsx,css,scss}": [ "prettier --write", "git add" ] }, // ... } 

    Now at each commit, prettier will format the modified files, and to format the entire project, you can use the command:

     npm run prettify 
    • I did everything as you said, but Prettier does not work at all - Silicum Silium
    • It does not work what does this mean? What does the console write after the npm run prettyfy ? - Alexandr Tovmach
    • This means that I tried 3 times, npm ERR! missing script: prettyfy npm ERR! npm ERR! Did you mean this? npm ERR! prettify npm ERR! Found in: npm ERR! C: \ Users \ vigo \ AppData \ Roaming \ npm-cache_logs \ 2019-02-09T10_59_06_039Z-debug.log - Silicum Silium
    • Typo npm run prettify - Alexandr Tovmach
    • I shot a video look myself. youtube.com/watch?v=1DVBBakwdGs&feature=youtu.be - Silicum Silium