Posts

Showing posts from October, 2020

Setting up ESLint in React

  I love ESLint. It’s a pluggable linter that’s going to tell you if you’ve imported something and not used it, if your function could be short-handed, and loads of other little gotchas that you can fully configure. I really think that it makes me a better developer — I know the things it normally picks me up on, so I learn not to do them! Let’s go through how I get up and running in a new React project with ESLint installed. In reality though, this setup could be used for any Javascript application. I’m going to assume you already have   npm and node   installed. Starting a New React App There are a whole bunch of React starter projects out there, but Facebook’s own —  create-react-app  is one of the simplest. All you need to do is  create-react-app app-name  and you have a React starter with a local server, Babel, Webpack and Jest. It's a super easy way to get setup, and naturally  Facebook have some great documentation . Installing ESLint Installing our linter couldn’t be easier