Tools / Package Managers Flashcards
what is Prettier
Tool that autoformats your code for you
explain npm i -D
same as:
~~~
npm install –save-dev
~~~
dev dependency means that application will work fine without it
Prettier vs ESLint
Formatter vs Linter
Linters have two categories of rules:
1. Formatting rules: eg: max-len, no-mixed-spaces-and-tabs, etc…
2. Code-quality rules: eg no-unused-vars, no-extra-bind, no-implicit-globals
Prettier does not not help with Code-quality Rules. It only does formatting.
use Prettier for formatting and linters for catching bugs!
what is npm
the package manager for Node.js.
npm allows you to bring in code from the npm registry which is a bunch of open source modules that people have written so you can use them in your project.
What we want from a build tool
- Organization - We can separate files out for code organization and have a tool stitch them together for us
- Download Dependencies - We can include external, third-party libraries from npm (like React!)
- Optimize Code - The tool will optimize the code for us by minifying and other optimizing techniques
Build tool examples: Vite, Parcel, Webpack
React community has currently selected Vite as tool of choice