Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
ESLint: Flat Config Rollout Plan (eslint.org)
17 points by _samjarman on Oct 17, 2023 | hide | past | favorite | 8 comments


As a newcomer to Javascript and its tooling, I would like to know how people use ESLint. So please share your config.


I don’t have my config readily available but just pick a default that’s close to what you want then make tweaks based on your preferences. It’s an incredibly useful tool for even a solo dev to keep your code looking consistent.


Usually you would pick a config you like and set it up for your project, notable ones are already mentioned but I'll mention xo[1] and @antfu/eslint-config[2].

[1] https://github.com/xojs/xo [2] https://github.com/antfu/eslint-config for Vue, Typescript, etc


Having too many options leads to a lot of bikeshedding as the whole ecosystem ends up fragmenting and disagreeing with each other. It’s one of things I really dislike about JS compared to something like Go.

Personally, I stick to opinionated rulesets such as Standard[1], AirBnb[2] and Unicorn[3] since you won’t spend hours tweaking and selecting new rules.

[1] https://standardjs.com/

[2] https://github.com/airbnb/javascript

[3] https://github.com/sindresorhus/eslint-plugin-unicorn


I use prettier for this reason. There’s very few config options on purpose. If I use eslint it’s for additional issue detection, not formatting.


+1 for prettier, I plop the same minimal config in every project and off I go.


Integrate it into your IDE, so you get yellow and red squigglies to attract your attention to potential issues - and set it up to fix any automatically solvable issues on save. And if you’re feeling ambitious, set it up to prevent git commit until ESLint detects no errors - and set up your pull requests to likewise reject merges until issues are fixed.


There is an “eslint-recommended” rule set. (And a matching one for typescript-eslint).

I recommend those as they seem to be the least intrusive while giving a lot of sane defaults.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: