@sitecore-lint/plugin-jss
v0.1.2
Published
JSS-specific lint rules for sitecore-lint
Maintainers
Readme
@sitecore-lint/plugin-jss
JSS-specific lint rules for sitecore-lint.
Installation
npm install -D @sitecore-lint/plugin-jssConfiguration
Add the plugin and its recommended preset to your .sitecore-lint.json:
{
"extends": ["sitecore-lint/configs/recommended", "@sitecore-lint/plugin-jss/recommended"],
"plugins": ["@sitecore-lint/plugin-jss"],
"sources": ["items/**/*.yml"]
}Or in .sitecore-lint.yaml:
extends:
- 'sitecore-lint/configs/recommended'
- '@sitecore-lint/plugin-jss/recommended'
plugins:
- '@sitecore-lint/plugin-jss'
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 |
| ---------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| jss/app-registration | warning | JSS app items (identified by AppTemplate or SiteName field hints) must use the JSS App template ({061882C0-3F52-5F5B-B476-FC760D998B0E}) |
| jss/route-template | warning | Template items whose name contains "Route" or "Page" must inherit from the JSS Route base template ({68FC498F-3E95-436C-8B24-2737BAC8E4B2}) |
| jss/component-name | warning | Rendering items must have a componentName field matching the expected JS framework naming convention |
| jss/layout-service | info | JSON Rendering items must have a Rendering Contents Resolver field set |
jss/component-name — framework option
By default the rule expects PascalCase (React / Next.js). Set the framework option to "angular" to require kebab-case instead:
{
"rules": {
"jss/component-name": ["warning", { "framework": "angular" }]
}
}| Option | Accepted values | Default | Description |
| ----------- | ------------------------------------ | --------- | --------------------------------------------------------------------------------------------------- |
| framework | "react" · "nextjs" · "angular" | "react" | Determines the naming-convention pattern (PascalCase for React/Next.js, kebab-case for Angular) |
Overriding severities
Rules from this plugin are configured the same way as built-in rules:
{
"extends": ["sitecore-lint/configs/recommended", "@sitecore-lint/plugin-jss/recommended"],
"plugins": ["@sitecore-lint/plugin-jss"],
"sources": ["items/**/*.yml"],
"rules": {
"jss/app-registration": "error",
"jss/layout-service": "off"
}
}