From the course: Learning Functional Programming with JavaScript ES6+

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Ensuring immutability: Finalize ESLint

Ensuring immutability: Finalize ESLint - JavaScript Tutorial

From the course: Learning Functional Programming with JavaScript ES6+

Start my 1-month free trial

Ensuring immutability: Finalize ESLint

The next thing we're going to do is install the eslint plugin immutable package for our project. So in the terminal, we'll type npm install dash dash save-dev eslint-plugin dash immutable and hit enter, and then all have to do is add some of these rules to our eslint rc file. So we'll open up eslintrc.js and add a plugins property right above rules. Plugins, and it's going to be an array, and then we simply add our immutable package to it. Like this: immutable, and don't forget to add the commas. Then, inside the rules object, we're going to add a rule from immutable. Specifically, we're going to use the immutable slash no dash mutation rule. And we're going to give it the value two because we want eslint to treat this as an error if it finds it, not just a warning, which would be one. And for those of you who are wondering, if we want to specifically disable a rule, we could set this value to zero like this. But we're going to leave it as two. Let's save our file, as well. So now, if…

Contents