What is "Linting"?

LintGjslint

Lint Problem Overview


PHPLint, JSLint, and I recently came across "you can lint your JS code on the fly" while reading something about some IDE.

So, what is "linting"?

Lint Solutions


Solution 1 - Lint

Linting is the process of running a program that will analyse code for potential errors.

See lint on wikipedia:

> lint was the name originally given to a particular program that flagged some suspicious and non-portable constructs (likely to be bugs) in C language source code. The term is now applied generically to tools that flag suspicious usage in software written in any computer language.

Solution 2 - Lint

Lint was the name of a program that would go through your C code and identify problems before you compiled, linked, and ran it. It was a static checker, much like FindBugs today for Java.

Like Google, "lint" became a verb that meant static checking your source code.

Solution 3 - Lint

Linting is the process of checking the source code for Programmatic as well as Stylistic errors. This is most helpful in identifying some common and uncommon mistakes that are made during coding.

A Lint or a Linter is a program that supports linting (verifying code quality). They are available for most languages like JavaScript, CSS, HTML, Python, etc..

Some of the useful linters are JSLint, CSSLint, JSHint, Pylint

Solution 4 - Lint

Apart from what others have mentioned, I would like to add that linting will run through your source code to

  • find formatting discrepancies,
  • find non-adherence to coding standards and conventions,
  • pinpoint possible logical errors in your program.

Running a lint program over your source code, helps to ensure that source code is legible, readable, less polluted and easier to maintain.

Solution 5 - Lint

A linter is a tool that is used to mark occurrences of suspicious and non-structural code (i.e. potential bugs) in source code. It was a static code analysis tool in C at the beginning, later it became the generic term used to describe the software analysis tool that mark the suspicious code.

Solution 6 - Lint

Interpreted languages like Python and JavaScript benefit greatly from linting, as these languages don’t have a compiling phase to display errors before execution.

Linters are also useful for code formatting and/or adhering to language specific best practices.

Lately I have been using ESLint for JS/React and will occasionally use it with an airbnb-config file.

Solution 7 - Lint

Linting is a process by a linter program that analyzes source code in a particular programming language and flag potential problems like syntax errors, deviations from a prescribed coding style or using constructs known to be unsafe.

For example, a JavaScript linter would flag the first use of parseInt below as unsafe:

// without a radix argument - Unsafe
var count = parseInt(countString);

// with a radix paremeter specified - Safe
var count = parseInt(countString, 10);

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAshkan Kh. NazaryView Question on Stackoverflow
Solution 1 - LintOdedView Answer on Stackoverflow
Solution 2 - LintduffymoView Answer on Stackoverflow
Solution 3 - LintVSri58View Answer on Stackoverflow
Solution 4 - LintMangu Singh RajpurohitView Answer on Stackoverflow
Solution 5 - LintMarcus ThorntonView Answer on Stackoverflow
Solution 6 - LintJSON C11View Answer on Stackoverflow
Solution 7 - LintRajeshKView Answer on Stackoverflow