From the course: ESLint: Customizing Styles

Unlock the full course today

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

Configuring options for a rule

Configuring options for a rule

From the course: ESLint: Customizing Styles

Start my 1-month free trial

Configuring options for a rule

- [Instructor] I want to add a style rule to my project to help me enforce spacing around curly braces in code for objects. ESLint supports an object curly spacing rule for this detail and in the rules list it doesn't have a check mark so I have to enable it myself if I want to use it. So I can add in my .eslintrc file object-curly-spacing with a value of error and I'll save that and then over in my code I'll add a test statement for that. So I'll do a constant called contact and I'll make that an object with a firstName of Sasha and I'm including a space after the opening curly brace and before the closing curly brace. Now this is a single line statement so for me including the spaces makes the content stand out better from the surrounding characters. But when I save it, my editor flags it as an error which I can see with those red squiggles right there. Now I wrote the test code the way I wanted it to be, so…

Contents