Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Svglint Processor

Purpose

Lints SVG files using svglint.

The Rust alternative is isvglint: svglint’s valid, elm and attr rules, in-process, with svglint’s messages, the rules written as TOML in the stanza instead of .svglintrc.js. Switching is svglint → isvglint in the stanza header plus the rules translated; a repo with custom (JavaScript) rules stays here.

How It Works

Runs svglint <files>. A non-zero exit fails the product. With no .svglintrc.js, svglint only checks that each file is valid SVG/XML:

x img/bad.svg
  x valid Expected closing tag 'g' (opened in line 1, col 6) instead of closing
           tag 'svg'.

Rules are configured in .svglintrc.js, which is an input when it exists (dep_auto), so editing it re-checks every file.

Source Files

  • Input: .svg files under src_dirs
  • Output: none (checker)

The default src_dirs is empty, so a stanza with no src_dirs or src_files checks nothing: name the directories ([""] for the whole project) or files to check.

Configuration

[processor.checker.svglint]
src_dirs = ["images"]
KeyTypeDefaultDescription
commandstring"svglint"The svglint executable to run
argsstring[][]Extra arguments passed to svglint
src_dirsstring[][]Directories to scan
src_extensionsstring[][".svg"]File extensions to check
dep_inputsstring[][]Extra files whose changes trigger rebuilds
dep_autostring[][".svglintrc.js"]Config files that are inputs when they exist

Batch support

The tool accepts multiple files on the command line. When batching is enabled (default), rsconstruct passes all files in a single invocation; a failure then marks every file in that invocation as failed (see batch in Configuration). Set batch = false to have each file reported on its own.

Clean behavior

This processor is a Checker — rsconstruct clean outputs is a no-op for it (checkers produce no outputs). See Clean behavior and rsconstruct clean.