npm package: @sitecore-lint/plugin-jss
Description: JSS-specific lint rules for sitecore-lint
Author: Stefan Roks
Latest version: 0.1.3

# @sitecore-lint/plugin-jss

JSS-specific lint rules for [sitecore-lint](https://github.com/theroks/sitecore-lint).

## Installation

```bash
npm install -D @sitecore-lint/plugin-jss
```

## Configuration

Add the plugin and its recommended preset to your `.sitecore-lint.json`:

```json
{
  "extends": ["sitecore-lint/configs/recommended", "@sitecore-lint/plugin-jss/recommended"],
  "plugins": ["@sitecore-lint/plugin-jss"],
  "sources": ["items/**/*.yml"]
}
```

Or in `.sitecore-lint.yaml`:

```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:

```json
{
  "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:

```json
{
  "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"
  }
}
```

## License

[MIT](../../LICENSE)