csslint
Lint CSS code for errors and style
TLDR
Lint a single CSS file
Lint multiple CSS files
List all possible style rules
Treat certain rules as errors (which results in a non-zero exit code)
Treat certain rules as warnings
Ignore specific rules
SYNOPSIS
csslint [OPTIONS] <FILE> [<FILE2> ...]
PARAMETERS
--help
Display usage information
--version
Show CSSLint version
--format=FORMAT
Output format: text (default), compact, lint-xml, csslint-xml, json
--quiet
Only report error count
--errors
Report only errors, ignore warnings
--warnings
Report only warnings, ignore errors
--list-rules
List all available rules
--rules=RULES
Apply specific rules (comma-separated, e.g. errors,known-properties)
--exclude-list=RULES
Exclude specific rules (comma-separated)
--ignore=RULES
Alias for --exclude-list
--help-rules
List rules with descriptions
DESCRIPTION
CSSLint is a command-line tool for analyzing CSS code to detect errors, potential problems, and violations of best practices. Installed via npm install -g csslint, it helps developers maintain clean, efficient stylesheets by flagging issues like duplicate properties, inefficient selectors, or non-standard rules.
Run it on CSS files to get reports in various formats. It categorizes issues into errors (likely bugs) and warnings (style improvements). Highly configurable via rule lists, allowing focus on specific concerns. Ideal for CI/CD pipelines, pre-commit hooks, or manual checks.
Though effective, note it's somewhat dated; modern alternatives like Stylelint offer broader support including preprocessors.
CAVEATS
Node.js dependency; deprecated in favor of Stylelint. Limited preprocessor support. No stdin reading.
RULE CATEGORIES
Errors: syntax bugs, invalid rules. Warnings: performance, maintainability issues like adjoining-classes, box-model.
USAGE EXAMPLE
csslint --format=compact style.css for concise output.
HISTORY
Developed by Nicholas C. Zakas in 2011 as part of Yahoo's YUI library. Evolved into standalone tool. Maintained until ~2017; last major release v1.0.5. Widely used in early CSS linting era.


