Check out a free preview of the full Creating an Open Source JavaScript Library on Github course:
The "ESLint" Lesson is part of the full, Creating an Open Source JavaScript Library on Github course featured in this preview video. Here's what you'd learn in this lesson:

Linting code catches errors, encourages best practices and maintains consistency throughout the project. Kent introduces ESLint and talks about how it compares to JSLint and JSHint. The main advantage of ESLint is that it’s more flexible and pluggable.

Get Unlimited Access Now

Transcript from the "ESLint" Lesson

>> [MUSIC]

>> Speaker 1: Linting, so who here uses Lint or sorry ESLint? Anybody raise some hands? I do, and it's great. And yeah, if you're watching on the livestream you can answer those questions too. You could raise your hand like this. And yeah, that would be cool. Yeah so ESLint is fantastic.

[00:00:27] I'll just show you the website so you're familiar with it. This is the logo. Yeah, it's a really, really great tool for linting. Anybody use JSLint before? Yeah JSLint? It's a Douglas Crockford's tool that he created that was kind of the first linter that I'm aware of for JavaScript.

[00:00:47] Anyone use JSHint? Follow up to JSLint, a little bit more flexibility with JSHint but with ESLint you get even more flexibility and it's plugable. What's really cool about this is you can write your own custom rules, and my golly has the community stepped up. There are so many rules, and plug-ins, and all kinds of things.

[00:01:09] But with pluggable comes configuration and there's a whole lot to do there, and so there are some of us who actually kind of enjoy that configuration. I'm one of those weird people who really likes tuning things to the way that I like them. And so luckily, ESLint allows for the ability for you to use a preset of config.

[00:01:34] So it's like ESLint config that you can extend and that's what we're gonna do, we're gonna extend MyConfig, but don't worry. I don't have any of my stylistic things in there so you can like yeah, I actually modularized my rules so that you don't have to leave off semicolons if you don't want to.

[00:01:55] So sweet.
>> Speaker 2: A couple question on using strict. Can you elaborate on that and then should I be doing that generally, especially in libraries?
>> Speaker 1: Yeah, good question. So you strict, we're like I said, we're actually in node version 6 and I'm pretty sure that node version 6 is technically in strict mode or or like implied strict mode.

[00:02:20] I'd have to check on that but yeah, if you're using a couple of ES6 specific features. I'm pretty sure latin const will say this file's in strict mode. But yeah, generally if you are sending something to an older browser, for example you want strict mode because it saves you from a lot of stuff.

[00:02:38] I'm not gonna talk about it too much. But it's really helpful. We are going to remove that as soon as we add babel translation because babel will add it for us, so we don't need to worry about it.