TIL, 2022-02-23, ESLint, Nx
Trying out ESLint
- Reference - automatically fixes unused imports if need.
- Reference - automatically fixes duplicate imports.
ESlinthas plugins and
extends- have to differentiate between the two.
Intro to Nx
- Using Nx Core Without Plugins: Nx plugins, though very useful for many projects, are completely optional.
- What does Nx Core provide?
- Nx understands how your workspace is structured -
- Nx knows what is affected (
nx affected) to know which projects are affected by the current PR.
- Nx caches and distributes tasks -
nx run-many --target=build --allwill cache the file artifacts and the terminal output, so if you run again, the command will execute instantly because the results will be retrieved from the cache.
Nx Cloudwill cache between you, your teammates, and the CI agents.
- Nx is a VSCode of build tools, with a powerful core, driven by metadata, and extensible through plugins.
- Project graph - reflects the source code in the repository and all the external dependencies.
- Metadata-driven: Everything comes with metadata to enable tooling.
Nx and Angular
- Angular CLI has some limitations, and Nx addresses them.
- Nx supports using
angular.jsonto configure projects and their targets, but it comes with a few limitations (thousand lines for large workspaces).
project.jsonfiles - this means changing the version number in
angular.jsonto 2, running
nx format, and run
nx generate @nrwl/workspace:convert-to-nx-project --all=true.
- Nx supports using
- Note that even though the configuration is split, everything works the same way. All migrations and schematics that expect a single
angular.jsonfile, will receive a single file. Nx is smart, so it merges all the files in memory to make those migrations and schematics work.
Five Things You Notice When You Quit the News
- Feeling better. News exploit our negativity bias. We’ve evolved to pay more attention to what’s scary and infuriating, but that doesn’t mean every instance of fear or anger is useful. You notice that an aim of news is to agitate and dismay the viewer.
- You were never actually accomplishing anything by watching the news.
- Most current-events-related conversations are just people talking out of their asses.
- There are better ways to “be informed”. Read three books on a topic and you know more about it than 99% of the world.
- “Being concerned” makes us feel like we’re doing something, when we’re really not.
- Same with sports news.
The hard things about front-end development
- No control over the environment - supporting different browsers, devices and optimising for bad connection speed is an exclusive burden for people working on UI.
- Tooling - Linters, test runners, bundlers, Typescript.
- No best practices & design patterns. “How to structure a codebase”.
- Programming/design - implementations that can be extended and maintained.
Observables vs Subjects vs Behavior Subjects