Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: What should be the maximal lines size of a vue.js single file component?
1 point by julienreszka on Sept 15, 2019 | hide | past | favorite | 2 comments


I don't think LOC is a good measure of complexity (which is typically what LOC limits are trying to stop). Generally I try to split things up once the component is trying to accomplish multiple tasks that could be separated. So something that handles the file upload API probably shouldn't contain oauth checks, instead calling an oauth component, separate business logic from domain logic, etc. Typically this ends up limiting them to ~500 LOC, but that's just a coincidence.


A SFC should do a single thing well.

Check out atomic design, it might help you :)

http://bradfrost.com/blog/post/atomic-web-design/




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: