1. 27
    Avoid Common JavaScript Errors with ESLint
    8m 59s

Avoid Common JavaScript Errors with ESLint

Share this video with your friends

Send Tweet

JavaScript is great! JavaScript is also full of features and flexible options that can make it easy to introduce bugs. ESLint uses static analysis to check that your code adheres to a list of rules to help you avoid some specific runtime errors. ESLint is highly configurable, so in this lesson, we'll install ESLint and configure some baseline rules for our boilerplate.

Hrafnkell Pálsson
Hrafnkell Pálsson
~ 6 years ago

You can also use "settings": { "react": { "version": "detect", }, }

Hrafnkell Pálsson
Hrafnkell Pálsson
~ 6 years ago

You can also use "settings": { "react": { "version": "detect", } }

Hrafnkell Pálsson
Hrafnkell Pálsson
~ 6 years ago

Ok, final try to get rid of extra commas 😂 "settings": { "react": { "version": "detect" } }

Andy Van Slaars
Andy Van Slaars(instructor)
~ 6 years ago

Hrafnkell, that’s a great tip! Thanks for sharing!

2359 Media
2359 Media
~ 6 years ago

Hello Andy,

May I ask what is the purpose of this -> Warning.displayName = 'Warning' ?

Thanks

Hakan Karaduman
Hakan Karaduman
~ 6 years ago

Thanks so much for this lesson, so helpful.

Kamil L
Kamil L
~ 5 years ago

Property displayName it's not needed because it's automatically set up to component name. It is only needed if you want display different name for debugging purposes. https://reactjs.org/docs/react-component.html#displayname

Andy Van Slaars
Andy Van Slaars(instructor)
~ 5 years ago

right, displayName is not strictly required. We’re applying it here to adhere to a lint rule that enforces some standard practices across a code base. Display name is derived from the component, but it’s useful to explicitly set one when using higher order components to create a new component. The displayName shows up in error messages and in the DevTools. Ultimately, if you don’t find this useful in your code, you can disable the lint rule.