sitecore-lint 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +133 -0
  3. package/package.json +82 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Stefan Roks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,133 @@
1
+ # sitecore-lint
2
+
3
+ Static analysis for Sitecore serialized items — ESLint for your Sitecore repository.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -D sitecore-lint
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ### Zero-config mode
14
+
15
+ ```bash
16
+ sitecore-lint --sitecore-json src/sitecore.json
17
+ ```
18
+
19
+ ### Config-file mode
20
+
21
+ ```bash
22
+ sitecore-lint --config .sitecore-lint.json
23
+ ```
24
+
25
+ Config files are auto-discovered by walking up from the current directory when `--config` is omitted. Supported formats: `.sitecore-lint.json`, `.sitecore-lint.yml`, `.sitecore-lint.yaml`, `.sitecore-lint.js`.
26
+
27
+ ## Config file reference
28
+
29
+ ```json
30
+ {
31
+ "extends": ["sitecore-lint/configs/recommended"],
32
+ "sources": ["items/**/*.yml"],
33
+ "modules": ["modules/**/*.module.json"],
34
+ "iar": ["artifacts/items.master.items.dat"],
35
+ "plugins": ["@sitecore-lint/plugin-sxa", "@sitecore-lint/plugin-jss"],
36
+ "rules": {
37
+ "helix/layer-dependency": "error",
38
+ "sitecore/max-versions": ["warning", { "maxVersions": 5 }],
39
+ "sitecore/template-name-convention": "off"
40
+ }
41
+ }
42
+ ```
43
+
44
+ | Field | Type | Description |
45
+ | -------------- | ---------- | ------------------------------------------------------------------------------------------- |
46
+ | `extends` | `string[]` | Shareable config presets. Processed left-to-right; your `rules` always win. |
47
+ | `sources` | `string[]` | Glob patterns for serialized YAML item files (relative to the config file) |
48
+ | `sitecoreJson` | `string` | Path to `sitecore.json` — use instead of `sources` for zero-config discovery |
49
+ | `modules` | `string[]` | Glob patterns for `.module.json` files — enables `module-path` and `module-reference` rules |
50
+ | `iar` | `string[]` | Glob patterns for IAR `.dat` binary item archives |
51
+ | `plugins` | `string[]` | Plugin package names or relative paths resolved via `require()` |
52
+ | `rules` | `object` | Per-rule severity or option overrides |
53
+
54
+ ## Rule configuration formats
55
+
56
+ **Severity string:**
57
+
58
+ ```json
59
+ { "rules": { "helix/layer-dependency": "error" } }
60
+ ```
61
+
62
+ **Tuple `[severity, options]`:**
63
+
64
+ ```json
65
+ { "rules": { "sitecore/max-versions": ["warning", { "maxVersions": 5 }] } }
66
+ ```
67
+
68
+ Accepted severity values: `"error"` · `"warning"` · `"info"` · `"off"`
69
+
70
+ ## Built-in shareable presets
71
+
72
+ | Preset | Description |
73
+ | ----------------------------------- | ---------------------------------------- |
74
+ | `sitecore-lint/configs/recommended` | Sensible defaults for all built-in rules |
75
+ | `sitecore-lint/configs/strict` | All rules promoted to `error` |
76
+ | `sitecore-lint/configs/all` | Every rule enabled at `warning` |
77
+
78
+ ## CLI reference
79
+
80
+ ```text
81
+ Usage: sitecore-lint [options]
82
+
83
+ Options:
84
+ -c, --config <path> Path to config file (auto-discovered when omitted)
85
+ --sitecore-json <path> Path to sitecore.json for zero-config discovery
86
+ --format <stylish|json|junit|github> Output format (default: stylish)
87
+ -q, --quiet Suppress output; only set exit code
88
+ --max-errors <n> Exit 1 only when N or more errors are found
89
+ --fix Report fixable rules (auto-fix stub)
90
+ --verbose Print rule descriptions alongside diagnostics
91
+ --debug Print debug information to stderr
92
+ --cache Enable incremental lint cache
93
+ --cache-location <path> Path to the cache file
94
+ -V, --version Show version
95
+ -h, --help Show help
96
+ ```
97
+
98
+ ### Output formats
99
+
100
+ | Format | Description |
101
+ | --------- | ----------------------------------------------------------------------- |
102
+ | `stylish` | Human-readable grouped output with icons (default) |
103
+ | `json` | `{ summary, diagnostics }` JSON for downstream tooling |
104
+ | `junit` | JUnit XML for CI artifact reporters (e.g. GitHub Actions test reporter) |
105
+ | `github` | GitHub Actions `::error` / `::warning` / `::notice` annotations |
106
+
107
+ ### Exit codes
108
+
109
+ | Code | Meaning |
110
+ | ---- | ---------------------------------------- |
111
+ | `0` | No errors (warnings/info may be present) |
112
+ | `1` | One or more `error`-severity diagnostics |
113
+ | `2` | Configuration error or engine failure |
114
+
115
+ ## Programmatic API
116
+
117
+ ```ts
118
+ import { lintAsync } from 'sitecore-lint/api';
119
+
120
+ // Zero-config
121
+ const diagnostics = await lintAsync({ sitecoreJson: './src/sitecore.json' });
122
+
123
+ // Config-file with overrides
124
+ const diagnostics = await lintAsync({
125
+ config: './.sitecore-lint.json',
126
+ rules: { 'helix/layer-dependency': 'error' },
127
+ });
128
+
129
+ const errors = diagnostics.filter((d) => d.severity === 'error');
130
+ process.exitCode = errors.length > 0 ? 1 : 0;
131
+ ```
132
+
133
+ See the [repository README](../../README.md) for the full rule reference and plugin documentation.
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "sitecore-lint",
3
+ "version": "0.1.0",
4
+ "description": "Sitecore serialization linter backed by a Rust engine",
5
+ "author": "Stefan Roks",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/theroks/sitecore-lint.git",
10
+ "directory": "packages/cli"
11
+ },
12
+ "homepage": "https://github.com/theroks/sitecore-lint#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/theroks/sitecore-lint/issues"
15
+ },
16
+ "engines": {
17
+ "node": ">=22"
18
+ },
19
+ "keywords": [
20
+ "sitecore",
21
+ "lint",
22
+ "helix",
23
+ "serialization",
24
+ "sitecore-cli",
25
+ "static-analysis"
26
+ ],
27
+ "main": "dist/index.js",
28
+ "exports": {
29
+ ".": "./dist/index.js",
30
+ "./api": "./dist/api.js",
31
+ "./config": "./dist/config.js",
32
+ "./configs/recommended": "./dist/configs/recommended.js",
33
+ "./configs/strict": "./dist/configs/strict.js",
34
+ "./configs/all": "./dist/configs/all.js"
35
+ },
36
+ "typesVersions": {
37
+ "*": {
38
+ "api": [
39
+ "./dist/api.d.ts"
40
+ ],
41
+ "config": [
42
+ "./dist/config.d.ts"
43
+ ],
44
+ "configs/recommended": [
45
+ "./dist/configs/recommended.d.ts"
46
+ ],
47
+ "configs/strict": [
48
+ "./dist/configs/strict.d.ts"
49
+ ],
50
+ "configs/all": [
51
+ "./dist/configs/all.d.ts"
52
+ ]
53
+ }
54
+ },
55
+ "files": [
56
+ "dist/",
57
+ "README.md",
58
+ "LICENSE"
59
+ ],
60
+ "bin": {
61
+ "sitecore-lint": "./dist/index.js"
62
+ },
63
+ "scripts": {
64
+ "prebuild": "node scripts/generate-version.js",
65
+ "build": "tsc",
66
+ "prelint": "node scripts/generate-version.js",
67
+ "lint": "tsc --noEmit",
68
+ "test": "node --test tests/*.test.js",
69
+ "test:e2e": "node dist/index.js --config examples/helix-violations/.sitecore-lint.yaml",
70
+ "test:integration": "node packages/cli/tests/integration.js"
71
+ },
72
+ "dependencies": {
73
+ "@sitecore-lint/engine": "*",
74
+ "commander": "^12",
75
+ "js-yaml": "^4"
76
+ },
77
+ "devDependencies": {
78
+ "@types/js-yaml": "^4",
79
+ "@types/node": "^22",
80
+ "typescript": "^5"
81
+ }
82
+ }