Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between linting and compiling?

I know that in Java there is a compiler that tells you when you're writing some wrong code. But Javascript doesn't work that ways, cause it doesn't have a compiler. However, is "linting" javascripts way to compile code?

like image 213
R. Andriana Avatar asked Oct 03 '16 12:10

R. Andriana


1 Answers

Linting is parsing code to verify that the syntax and format are good and follow good practice. A linter will tell you if your indentation is incorrect or if you should be adding spaces around your = operators. A linter could also warn you if your code contains commonly known security flaws or code smells.

Compiling is parsing code to verify that the syntax is correct and convert the code to a different language (generally a faster one).

So what's the difference?

Compiling:

  • syntax validation
  • code converted to different language

Linting:

  • syntax validation
  • style and formatting analysis
  • (optional) code smell/bad code detection
  • (optional) security/performance analysis
like image 102
sokkyoku Avatar answered Nov 14 '22 22:11

sokkyoku