Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 1.9 KB

How to prevent Disasters.md

File metadata and controls

49 lines (37 loc) · 1.9 KB

TEST: How to Prevent Disasters(Lesson 18)

Description

  • How to use tooling as a safety net for your code.
  • Use it automatically to check the code you write
  • And automatically run tests.

Linting

  • LINTING = a way to automatically check JavaScript code for errors.
  • This can be done via your:
    1. editor (live linting)
    1. build process
    1. pre-commit hook in version control

There is a difference of CodeStyle Linting vs Syntax Linting.

    1. Syntax (Structural) Linting= checks for JavaScript Anti-patterns, like: unreachble statements and forget a strict comparison against null.
    1. Code Style Linting = to know errors regarding
  • incorrect camel cases of `variables
  • particular incorrect `braces {}[] for functions.

NOTE: The linting ONLY checks for intentional errors.

  • YET, it doesn´t have any idea of what you are trying to accomplish with your code.

  • A linter helps your code to:

    1. uncover code style problems
    1. help eliminate dead code or variables

Popular JavaScript Linters

Unit Test

  • Use Unit Test to test the functionality of your project.
  • To test the Front-End code in the browser.

Resources