From the course: Learning Functional Programming with JavaScript ES6+

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Ensuring immutability: Finalize ESLint

Ensuring immutability: Finalize ESLint

- [Instructor] 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 --save-dev eslint-plugin-immutable, and hit Enter. And then all we have to do is add some of these rules to our eslintrc 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/no-mutation rule. And we're going to give it the value 2 because we want ESLint to treat this as an error if it finds it, not just a warning, which would be 1. And for those of you who are wondering, if we want to specifically disable a rule, we could set this value to 0, like this. But we're going to leave it as 2. Let's save our file as well. So now, if we delete all…

Contents