@sitecore-lint/plugin-sxa
v0.1.3
Published
SXA-specific lint rules for sitecore-lint
Maintainers
Readme
@sitecore-lint/plugin-sxa
SXA-specific lint rules for sitecore-lint.
Installation
npm install -D @sitecore-lint/plugin-sxaConfiguration
Add the plugin and its recommended preset to your .sitecore-lint.json:
{
"extends": ["sitecore-lint/configs/recommended", "@sitecore-lint/plugin-sxa/recommended"],
"plugins": ["@sitecore-lint/plugin-sxa"],
"sources": ["items/**/*.yml"]
}Or in .sitecore-lint.yaml:
extends:
- 'sitecore-lint/configs/recommended'
- '@sitecore-lint/plugin-sxa/recommended'
plugins:
- '@sitecore-lint/plugin-sxa'
sources:
- 'items/**/*.yml'The plugins entry loads the rule implementations. The extends entry activates the recommended severities. You can use one without the other — for example, load the plugin but configure each rule manually.
Rules
| Rule | Recommended severity | Description |
| ---------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------- |
| sxa/site-grouping | warning | Items directly under /sitecore/content/ must use the SXA Tenant template (Tenant → Site Group → Site hierarchy) |
| sxa/theme-validation | warning | Rendering items with a Theme field must reference a valid SXA theme item |
| sxa/clone-source | warning | Cloned SXA rendering items must have a valid __Source Item reference |
| sxa/page-design | warning | SXA Page Design and Partial Design items must reference valid renderings in their presentation details |
In addition, the recommended preset enables two built-in engine rules that are off by default:
| Rule | Recommended severity | Description |
| ---------------------------------------- | -------------------- | ----------------------------------------------------------------------------------------- |
| sitecore/rendering-parameter-sxa | warning | SXA rendering parameters template must inherit from the SXA Standard Rendering Parameters |
| sitecore/rendering-dynamic-placeholder | warning | Dynamic placeholder renderings must declare a placeholder key |
Overriding severities
Rules from this plugin are configured the same way as built-in rules:
{
"extends": ["sitecore-lint/configs/recommended", "@sitecore-lint/plugin-sxa/recommended"],
"plugins": ["@sitecore-lint/plugin-sxa"],
"sources": ["items/**/*.yml"],
"rules": {
"sxa/site-grouping": "error",
"sxa/clone-source": "off"
}
}