Skip to main content

What is linting?

Glossary image
static code analysis static analysis

Linting is the automated process of analyzing source code to detect errors, stylistic inconsistencies, and constructs that are likely to cause bugs, before the code is ever executed. The term originates from a Unix utility called lint, first developed in the late 1970s to flag suspicious C code. Today, linting is a standard practice across virtually every programming language and is performed by tools known as linters.

A linter reads through a codebase and applies a set of predefined or configurable rules. These rules can cover a wide range, from enforcing consistent indentation and naming conventions to identifying unused variables, unreachable code, or potentially unsafe operations. When a violation is found, the linter reports it - typically with a file name, line number, and a description of the issue - so the developer can address it before the code reaches production.

Linting is closely related to, but distinct from, code compilation and testing. A compiler checks whether code is syntactically valid enough to run, while a test suite verifies that the code behaves correctly at runtime. Linting occupies an earlier stage in the development workflow, catching problems that neither a compiler nor a test might surface, such as ambiguous logic, deprecated API usage, or formatting that deviates from a team's agreed style guide.

Why linting matters for web development

In web development, linters are available for every major language and framework. ESLint is the dominant tool for JavaScript and TypeScript, while Stylelint serves CSS and its preprocessors. Python developers commonly use Flake8 or Pylint, and HTML can be validated through tools like HTMLHint. Each tool can usually be configured through a project-level configuration file, allowing teams to define exactly which rules apply to their codebase.

Linting integrates naturally into modern development workflows. Most code editors, such as VS Code, display linting warnings inline as a developer types, providing immediate feedback without requiring a separate step. Linters are also commonly run as part of a continuous integration pipeline, where a failed lint check can block a pull request from being merged. This enforces consistent code quality standards across an entire team, regardless of individual preferences or editor setups.

Linting and SEO

For SEO professionals and marketers, linting is relevant because code quality directly affects site performance and reliability. Poorly structured HTML, invalid attributes, or JavaScript errors can interfere with how search engine crawlers parse and render a page. Running an HTML linter, for instance, can surface missing alt attributes on images or improperly nested elements - both of which have implications for accessibility and indexability. Maintaining a linted codebase is therefore not only a developer concern but a factor in keeping a site technically sound for search.

Have a question?

Get in touch if you'd like to learn more about this topic.

Contact Us