Web apps & software

What is linting?

Linting is the automatic analysis of source code, without running it, to flag likely bugs, risky constructs and style inconsistencies, so they are corrected before review or release.

What a linter finds

An unused variable, a comparison that is always false, a missing await on a promise, a forgotten return, a deprecated function or inconsistent naming. Some rules catch security problems, such as building SQL by joining strings.

Common tools

ESLint for JavaScript and TypeScript, Pylint and Ruff for Python, PHP_CodeSniffer and PHPStan for PHP, RuboCop for Ruby, ktlint and detekt for Kotlin, SwiftLint for Swift, and dart analyze for Flutter. Formatters such as Prettier and Black fix layout automatically, ending arguments about spacing.

Where to run it

In the editor as you type, in a pre-commit hook, and in the CI pipeline so a pull request cannot merge with violations.

Keeping it useful

Agree on a rule set and keep it. Too many noisy rules train people to ignore warnings; suppressing a rule should come with a short reason. Introduce linting to an old codebase gradually, by checking only changed files.

Questions, answered

No. Linting inspects code without running it. Tests run the code and check behavior.

It saves time by catching mistakes early, especially when running in the editor.

By the Stegnor team · Updated