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.
(flute and synthesizer music) - Linting. So who here uses Lint? Or sorry, ESLint? Anybody? Raise some hands. I do, and it's great. If you're watching on the live stream, you can answer those questions too. You can raise your hand like this, and that'd be cool. Yeah, so ESLint is fantastic. I'll just show you the website so you're familiar with it.
There are so many rules, and plug-ins, and all kinds of things. 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 like use a preset of config. So it's like an eslintConfig that you can extend.
And that's what we're going to do. We're going to extend my config, but don't worry, I don't have any of my stylistic things in there, so you can ... I actually modularized my rules so that you don't have to leave off semicolons if you don't want to. So sweet. - [Student] Question on using strict. Can you elaborate on that? And then should I be doing that generally, especially in libraries? - Yeah, good question. So use strict.
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 implied strict mode. I'd have to check on that, but yeah, if you're using a couple of ES6-specific features, I'm pretty sure 'let' and 'const' will say, "Oh, 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.
I'm not going to 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 won't need to worry about it.
Note: This course was created by Frontend Masters. It was originally released on 08/09/2016. We're pleased to host this training in our library.
- Creating an open-source library
- Linting and testing
- Code coverage
- Installing and configuring Babel
- Peer dependencies
- Forking and renaming
- Continuous integration and automating releases