From the course: JavaScript: Best Practices for Code Formatting
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Optimize punctuation - JavaScript Tutorial
From the course: JavaScript: Best Practices for Code Formatting
Solution: Optimize punctuation
(upbeat music0 - [Instructor] This challenge was to enforce best practices around punctuation and line length in this java script code. So the way I like to approach these is to start with my eslintrc file. Get the rules in place that will highlight issues with my existing code and then I can work on it from there. So I have several eslint rules that will help me identify issues with this code and enforce those best practices. First off is just requiring semi-colons, and that's the semi rule. Don't even need quotes on that. And that is an error, and I want it always. And then I also want to make sure that I don't have a space before my semi-colons So that's semi-spacing and that value is simply error. And I want to disallow extra unneeded semi-colons, so that's no-extra-semi and error. Then in terms of my lines, I want to make sure that I don't have unexpected multilines, so that's the no unexpected…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
End statements with a semicolon5m 10s
-
(Locked)
Don't rely on auto semicolon insertion4m 19s
-
(Locked)
Standardize line length6m 33s
-
(Locked)
Use commas consistently3m 38s
-
(Locked)
Include a comma in a list of values3m 21s
-
(Locked)
Challenge: Optimize punctuation31s
-
(Locked)
Solution: Optimize punctuation5m 23s
-
(Locked)
-
-