DEV Community

William McGonagle
William McGonagle

Posted on • Updated on

🤬 What's your opinion on Linters, Prettiers, and Testers?

I’ve been working on a project recently and a bunch of people suggested that I should start using a testing system. This testing system was working for a while but then someone else suggested that I should start using a linter. The linter ended up breaking all of my testing code, and before long I had spend nearly three hours getting them working together.

Here was the project if you want to check it out

After that, I was told that the code was inconsistently formatted, so I needed to add a prettier system. All of my engineers are now telling me that they have lost countless man-hours battling against this new integration system.

So, I’m getting rid of it. My entire linter system, code grading, beautifier, etc. is gone. And, I’m replacing it with my own solution- if you want something done right, you have to do it yourself.

I want to hear what struggles you have had with your “systems to boost efficiency”, or if you think I am completely wrong and should shut up.

Discussion (4)

Collapse
bias profile image
Tobias Nickel

yes, you should use them. When you just start learning to code, it is.ok to just hack something together, but the the more complex your projects become it is better to have such tools in place. Adding them to existing old projects, can be challenging, and even can be a tough decision if adding them is still worth it. I hear of projects switching from JS to TS including the tooling. It can even take as long as years to change in retrospect.

As an experienced developer, I learned the value of such tools specially in teams. you made the tag webdev and javascript. And in most of such projects today, the configuration for these tools is part if the project. with editorconfig, jslint.json and tsconfig.json.

In our projects we even enforce the usage of our tool chain with git hooks.

While sometimes it can be annoying to run these tools, as an individual, it is very good when everyone on the team uses the same formatter, tests, and linting rules. and having the tools setup saves so much time in discussions about useless things such as formatting, -> just have it, and focus on making the application better.

Collapse
ravavyr profile image
Ravavyr

Personally, I don't rely on linters or prettier. I see their usefulness, especially for newbies as they essentially hold your hand through formatting and writing clean code.

I think a lot of heavy programming veterans don't use these tools because they learned to code without them, long ago. Everyone has their habits and don't want to change them.

My reasoning for not using them is because i work on multiple projects across multiple platforms and often projects I did not originally create and in these situations it's best to code straight up, rather than rely on tools the original devs didn't use because automation is great until something breaks and you spend weeks debugging it.

In your situation your project was already underway and you tried to add these tools leading to various problems.

They are good when you start a project and use them from the get go. Once you set the rules and follow them, you're good to go, but integrating them into existing projects is often just a mess waiting to happen [as you've already learned]

So, should you use them?
Again, personal preference, i say No. Don't use them, force yourself to debug your code and format it properly. Do it every time you code and before long you format it automatically and you make a lot less mistakes because you're not relying on tools to help you.

Should you run tests on your code, sure, when done, when implementing it in a real world scenario to verify it works 100%.
I see plenty of testing tools where the devs tested things but didn't test it in the final real world scenario so all their tests were meaningless because the real scenarios failed. A lot of what runs on your local will fail on a live environment so you should always have a dev scenario that mimics production so you can really test things.
Also, code testing tools are nice but they don't test UI/UX and user experience is very important. If it's a web application, cross-browser responsiveness is absolutely necessary and tools can't test that. So, learn to test your code every time, so you can do it automatically as you work.

Use tools as needed, not just because they're popular or someone insists you must use them. Use them when you have a real reason to.

Collapse
lukeshiru profile image
Luke Shiru

Prettier and ESLint can be configured to format/auto-fix on save, you shouldn't be fighting against them, they should be configured to do some work for you without having to worry about it. The main idea is to keep a consistent code style and detect some common mistakes before they happen. If they feel they are "on the way", then must surely they are not configured correctly for your coding style or something. For my personal projects I have a NPM package with shared configs for ESLint, Prettier, TypeDoc, Stylelint and TypeScript. This has proven to be very useful to me to keep the coding style concise across projects, and make them all feel similar. This can also be achieved with monorepos.

My point is that the tools themselves are great, but the usefulness depends on how you set them up, and even if they don't work for you, that doesn't mean they "suck", it only means they aren't for you.

Cheers!

Collapse
williammcgonagle profile image
William McGonagle Author

Don’t forget to let me know!