Hacker News new | ask | show | jobs
by SadWebDeveloper 1086 days ago
> 1. Use npm.

Better use pnpm, faster for those that don't have 1 Gbps uplink and live outside the usa.

> 3. Use Typescript

Better use jsDoc, d.ts files are scary and are really complex, you need a typescript wizard la matt pollock just to tell you are mistakenly trying to concatenate a string and int.

> 5. Use prettier

yes use prettier but don't forget to configure eslint to work with prettier otherwise you are going to have a bad time.

> 6. Use react

Use whatever fits your problem but if you are going to really use rect then do it with Next.js, no point in still using CRA/CRACO

> 7. state management

Avoid using state, try to solve every problem with pure functions, if you must use state then consider redux/react-query

> 8 & 9.

You should still recommend stylelint, specially if you are going to write css by hand otherwise don't just use tailwind, tailwind is bootstrap with extra batteries (change my mind).

2 comments

> yes use prettier but don't forget to configure eslint to work with prettier otherwise you are going to have a bad time.

Can you elaborate? I'm using eslint and prettier with pretty much default settings and never had it conflict with each other. My impression was that they work on different aspects. May be there're some overlapping eslint checks, but they're not enabled by default (or I didn't stumble upon them yet).

Depends a lot on what you are doing but mostly stylelint is the one that make me look on configuring eslint/stylelint for prettier...

https://prettier.io/docs/en/integrating-with-linters.html

> Better use jsDoc, d.ts files are scary and are really complex

Why would you use d.ts files and not just... .ts files?

When you want to integrate a javascript module that isn't annotated with types... types in a dynamic language like javascript are complex once you start doing really abstract things like generics the fun of typescript ends, also there is a recent push to abandon typescript mostly fueled by svelte fan base but nevertheless typescript is really complex, easy to shotgun yourself.
The whole point of explicit complexity of Typescript is to prevent you from shotgunning yourself from implicit complexity of Javascript.
And thats why it isn't worth, you are adding complexity to a problem that doesn't need to be complex, jsDoc is the best of both worlds, type safety, zero complexity and it works with typescript (if you still really want to use it).

Personally i think typescript isn't going to be around much time on the frontend side, maybe on the backend by some people that still believe in adding another compiler layer to their build time.