![]() Now that you saw why linting your code is important let's discover ESLint. Thus, it would throw an error at you, and you would know what to do. Inside this loop, you're using a function that references variables outside of its scope, which seems like a bad practice. But a linter can! It would see you're using the var keyword in a for-loop. It's almost impossible to guess what would happen here if you haven't run into it at least once in your developer's life. This time, each iteration has its own i variable and is not declared globally. As an example, here is a for-loop that, at first glance, will log numbers from 0 to 4:Įnter fullscreen mode Exit fullscreen mode The best part of a linter is finding potential errors in your code that don't look like them. Thus, it's essential to have a tool that spots for you common errors and bad practices. But why use a linter, you might think? Because you can build an app while writing awful code. It means it checks out the code without executing it. You may think of testing tools like Jest, React Testing Library or Cypress at first, but before writing tests, you can add the first layer of safety in your app with a linter.Ī linter analyses your code statically. Nowadays, many tools allow us to write quality code and make sure our apps don't break. The same goes with React (or any other front-end library/framework). JavaScript is a language that seems easy to learn at first, but it's not that easy.Developers have different ways to code, which can confuse you and slow you down. ![]() The more your codebase grows, the more it becomes hard to maintain.Building high-quality apps is challenging for many reasons: ![]()
0 Comments
Leave a Reply. |