![]() We can replace it by pasting or typing any code we want into the window. The code that's already there ( var foo = bar ) is the default code that ESLint provides. The window on the left is where we can insert any code we want to lint. If we take a look, we'll see the following: We'll discuss the configuration further later in this lesson. Make sure you use this exact link so you are using the configuration we've set. Also, we'd rather you try finding problems in your code before using a linter - and the above approaches will lint as you go.įortunately, there is also a browser-based demo of ESLint here: ESLint Demo. Both of the above approaches involve some configuration that might feel a bit overwhelming this early in the program. ![]() We will be doing the latter in Intermediate JavaScript. Another is to bundle a development environment to include a linter that automatically lints our code. Finally, a linter is a bit like an automated mentor - as you write code, the linter will let us know if something doesn't look right, just like a real-life mentor teaching us how to code. ![]() On the other hand, many errors are genuinely hard for beginners to find and a linter can save us a lot of frustration by showing us exactly where the error is. If you rely on a linter too much early on, you may not develop this skill as fully. It's important to develop a good eye for code, including finding errors. There are advantages and disadvantages to beginning coders using linters. Linters are very helpful both for fixing errors as they arise and for writing clean code. Most developers use a linter to check their code for errors. For instance, maybe you forgot to scope a variable with let or const or maybe you forgot a semicolon. Or your code may work correctly but still have an error. Sometimes you won't be able to find a syntax error no matter how hard you look.
0 Comments
Leave a Reply. |