Commands

Use these commands to work with SLDS Linter. To uplift your code to SLDS 2 best practices, review and fix the issues that are captured in the generated report.

Performs style and component linting on your files.

This command runs SLDS Linter on your code and identifies all the instances where the code doesn’t meet the SLDS 2 rules. It runs ESLint and Stylelint rules on HTML, CMP, and CSS files.

See the lint output in the Terminal:

Recursively lint all style and markup files in a single directory:

Recursively lint all style and markup files in multiple directories:

Recursively lint all CSS files in a single directory:

Lint multiple types of style files:

Recursively lint all HTML files in a single directory:

Lint multiple types of markup files:

--fix
Optional

Automatically fix problems.

Type: Boolean

--config-stylelint <path>
Optional

Path to Stylelint configuration file.

Type: Option/String

–config-eslint <path>
Optional

Path to ESLint configuration file.

Type: Option/String

--editor <editor>
Optional

Editor to open files. For example, VS Code, Atom, Sublime.

Type: Option/String

Default value: VS Code

Generates a SARIF or CSV report for analyzing the issues identified by SLDS Linter. The default format is SARIF.

This command generates a report containing all the instances in your code that don’t align with SLDS 2 guidelines. The report is generated in .csv or .sarif format.

Generate a report:

Generate a CSV report:

Generate a CSV report to a specific directory:

-o, --output <path>
Optional

Output directory for reports. Defaults to the current directory.

Type: Option/String

--config-stylelint <path>
Optional

Path to Stylelint configuration file.

Type: Option/String

--config-eslint <path>
Optional

Path to ESLint configuration file.

Type: Option/String

–format <type>
Optional

Output format for the report. Allowed values are sarif and csv.

Type: Option/String

Default value: sarif

Generates the custom configuration files used by SLDS Linter. By default, the files are placed in the current directory.

This command generates the .eslintrc.yml and .stylelintrc.yml configuration files used by the SLDS Linter CLI. In these files, you can add new rules and enable or disable existing rules.

-d, –directory <path>
Optional

Target directory to scan. Defaults to the current directory. Supports glob patterns.

Type: Option/String

Displays help for the various commands.

To view help, add --help to each command.

See which options you can use with the lint command:

-V, --version
Optional

Displays the version number.

Type: Option/String

-h, –help
Optional

Displays help for the various commands.

Type: Option/String