My advice would be: make small things.
If module is small it can be easily tested, refactored, rewritten or replaced. I would say that for module 1–2k and for app 10–20k is maximum(depends on language).
Programming language, tooling, tests, CI make more impact on code quality than people think. I can write beautiful ES6 code in React.js where developer next door will write spaghetti code in jQuery using ES5/4.