@lintel/lintel 0.0.8
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.
- package/README.md +165 -0
- package/bin/lintel +51 -0
- package/package.json +35 -0
package/README.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/lintel-rs/lintel/master/assets/logo.png">
|
|
5
|
+
<img src="https://raw.githubusercontent.com/lintel-rs/lintel/master/assets/logo.png" alt="Lintel" width="300">
|
|
6
|
+
</picture>
|
|
7
|
+
|
|
8
|
+
**Fast, multi-format JSON Schema linter for all your config files.**
|
|
9
|
+
|
|
10
|
+
[![CI][ci-badge]][ci-url]
|
|
11
|
+
[![crates.io][crates-badge]][crates-url]
|
|
12
|
+
|
|
13
|
+
[ci-badge]: https://github.com/lintel-rs/lintel/actions/workflows/ci.yml/badge.svg
|
|
14
|
+
[ci-url]: https://github.com/lintel-rs/lintel/actions/workflows/ci.yml
|
|
15
|
+
[crates-badge]: https://img.shields.io/crates/v/lintel?color=60a5fa
|
|
16
|
+
[crates-url]: https://crates.io/crates/lintel
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
**Lintel** validates JSON, YAML, TOML, JSON5, and JSONC files against [JSON Schema](https://json-schema.org/) in a single command. It auto-discovers schemas via [SchemaStore](https://www.schemastore.org/), the [Lintel catalog](https://catalog.lintel.tools/), inline `$schema` properties, and YAML modelines — zero config required.
|
|
21
|
+
|
|
22
|
+
**Fast.** Written in Rust with no async runtime, deterministic schema caching, and pre-compiled SchemaStore catalog matching. Warm runs are pure computation.
|
|
23
|
+
|
|
24
|
+
**Drop-in CI check.** Machine-parseable output, nonzero exit codes on failure, `.gitignore`-aware file walking. Add one line to your pipeline and catch config mistakes before they ship.
|
|
25
|
+
|
|
26
|
+
**Zero config.** Point it at your repo and go. Lintel figures out which schemas to use.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```shell
|
|
31
|
+
cargo install lintel
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or with npm:
|
|
35
|
+
|
|
36
|
+
```shell
|
|
37
|
+
npx lintel check
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Or with Nix:
|
|
41
|
+
|
|
42
|
+
```shell
|
|
43
|
+
nix run github:lintel-rs/lintel
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
# validate with rich terminal output
|
|
50
|
+
lintel check
|
|
51
|
+
|
|
52
|
+
# validate with CI-friendly one-error-per-line output
|
|
53
|
+
lintel ci
|
|
54
|
+
|
|
55
|
+
# generate a lintel.toml with auto-detected schemas
|
|
56
|
+
lintel init
|
|
57
|
+
|
|
58
|
+
# convert between formats
|
|
59
|
+
lintel convert config.yaml --to toml
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Schema Discovery
|
|
63
|
+
|
|
64
|
+
Lintel auto-discovers schemas in priority order:
|
|
65
|
+
|
|
66
|
+
1. **YAML modeline** — `# yaml-language-server: $schema=...`
|
|
67
|
+
2. **Inline `$schema` property** — in the document itself
|
|
68
|
+
3. **`lintel.toml` mappings** — custom `[schemas]` table entries
|
|
69
|
+
4. **Custom registries** — additional catalogs from `lintel.toml`
|
|
70
|
+
5. **[Lintel catalog](https://catalog.lintel.tools/)** — aggregates SchemaStore with additional schemas (Cargo.toml, Claude Code, devenv.yaml, and more)
|
|
71
|
+
|
|
72
|
+
Files without a matching schema are silently skipped. Lintel respects `.gitignore` — `node_modules`, `target/`, and build artifacts are skipped automatically.
|
|
73
|
+
|
|
74
|
+
## The Lintel Catalog
|
|
75
|
+
|
|
76
|
+
The [Lintel catalog](https://catalog.lintel.tools/) is an aggregate of [SchemaStore](https://www.schemastore.org/) and additional schemas for tools that don't have SchemaStore entries. When both catalogs have a match, the Lintel catalog takes precedence.
|
|
77
|
+
|
|
78
|
+
See the [lintel-rs/catalog](https://github.com/lintel-rs/catalog) repository for more information.
|
|
79
|
+
|
|
80
|
+
Currently includes additional schemas for:
|
|
81
|
+
|
|
82
|
+
- **Cargo.toml** — Rust package manifests
|
|
83
|
+
- **Claude Code** — agent, skill, and command definitions
|
|
84
|
+
- **devenv.yaml** — devenv configuration
|
|
85
|
+
|
|
86
|
+
To add your own catalogs, use `registries` in `lintel.toml`:
|
|
87
|
+
|
|
88
|
+
```toml
|
|
89
|
+
registries = ["github:my-org/my-schemas"]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The `github:org/repo` shorthand resolves to `https://raw.githubusercontent.com/org/repo/master/catalog.json`.
|
|
93
|
+
|
|
94
|
+
## Configuration
|
|
95
|
+
|
|
96
|
+
Lintel supports project configuration via `lintel.toml`:
|
|
97
|
+
|
|
98
|
+
```toml
|
|
99
|
+
# stop walking up the directory tree
|
|
100
|
+
root = true
|
|
101
|
+
|
|
102
|
+
# exclude files from validation
|
|
103
|
+
exclude = ["vendor/**", "testdata/**"]
|
|
104
|
+
|
|
105
|
+
# map file patterns to schema URLs
|
|
106
|
+
[schemas]
|
|
107
|
+
"my-config.yaml" = "https://example.com/my-schema.json"
|
|
108
|
+
".ci/*.yml" = "//schemas/ci.json" # // resolves relative to lintel.toml
|
|
109
|
+
|
|
110
|
+
# additional schema catalogs
|
|
111
|
+
registries = ["github:my-org/my-schemas"]
|
|
112
|
+
|
|
113
|
+
# rewrite schema URLs (e.g. for local development)
|
|
114
|
+
[rewrite]
|
|
115
|
+
"http://localhost:8000/" = "//schemas/"
|
|
116
|
+
|
|
117
|
+
# per-file overrides
|
|
118
|
+
[[override]]
|
|
119
|
+
files = ["schemas/vector.json"]
|
|
120
|
+
validate_formats = false
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Adding Lintel to devenv
|
|
124
|
+
|
|
125
|
+
Add Lintel as an input in `devenv.yaml`:
|
|
126
|
+
|
|
127
|
+
```yaml
|
|
128
|
+
inputs:
|
|
129
|
+
lintel:
|
|
130
|
+
url: github:lintel-rs/lintel
|
|
131
|
+
flake: true
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Then use it in `devenv.nix`:
|
|
135
|
+
|
|
136
|
+
```nix
|
|
137
|
+
{ pkgs, inputs, ... }:
|
|
138
|
+
|
|
139
|
+
let
|
|
140
|
+
lintel = inputs.lintel.packages.${pkgs.system}.default;
|
|
141
|
+
in
|
|
142
|
+
{
|
|
143
|
+
packages = [ lintel ];
|
|
144
|
+
|
|
145
|
+
# optional: run lintel as a pre-commit hook
|
|
146
|
+
git-hooks.hooks.lintel = {
|
|
147
|
+
enable = true;
|
|
148
|
+
name = "lintel";
|
|
149
|
+
entry = "${lintel}/bin/lintel check";
|
|
150
|
+
types_or = [ "json" "yaml" ];
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## GitHub Action
|
|
156
|
+
|
|
157
|
+
Use the official [lintel-rs/action](https://github.com/lintel-rs/action):
|
|
158
|
+
|
|
159
|
+
```yaml
|
|
160
|
+
- uses: lintel-rs/action@v1
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
Copyright Ian Macalinao. Licensed under the [Apache License, Version 2.0](LICENSE).
|
package/bin/lintel
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
const PLATFORMS = {
|
|
6
|
+
"darwin-arm64": "@lintel/cli-darwin-arm64/lintel",
|
|
7
|
+
"darwin-x64": "@lintel/cli-darwin-x64/lintel",
|
|
8
|
+
"linux-arm64": "@lintel/cli-linux-arm64/lintel",
|
|
9
|
+
"linux-x64": "@lintel/cli-linux-x64/lintel",
|
|
10
|
+
"win32-x64": "@lintel/cli-win32-x64/lintel.exe",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function getBinaryPath() {
|
|
14
|
+
const key = `${process.platform}-${process.arch}`;
|
|
15
|
+
const pkg = PLATFORMS[key];
|
|
16
|
+
if (!pkg) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
`@lintel/lintel doesn't ship with prebuilt binaries for your platform yet (${key}). ` +
|
|
19
|
+
`You can still use it by cloning the repo from https://github.com/lintel-rs/lintel ` +
|
|
20
|
+
`and following the instructions there to build from source.`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
return require.resolve(pkg);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`Could not find package for ${key}. Make sure optional dependencies are installed.\n` +
|
|
28
|
+
`Expected package: ${pkg}\n` +
|
|
29
|
+
`Try: npm install @lintel/lintel`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let binPath;
|
|
35
|
+
try {
|
|
36
|
+
binPath = getBinaryPath();
|
|
37
|
+
} catch (e) {
|
|
38
|
+
console.error(e.message);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const result = require("child_process").spawnSync(binPath, process.argv.slice(2), {
|
|
43
|
+
stdio: "inherit",
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (result.error) {
|
|
47
|
+
console.error(`Failed to run lintel: ${result.error.message}`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lintel/lintel",
|
|
3
|
+
"version": "0.0.8",
|
|
4
|
+
"description": "Schema validation for your entire repo",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/lintel-rs/lintel"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=14.21.3"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/lintel-rs/lintel",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"json-schema",
|
|
16
|
+
"validation",
|
|
17
|
+
"yaml",
|
|
18
|
+
"linter",
|
|
19
|
+
"cli"
|
|
20
|
+
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"lintel": "bin/lintel"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"bin/",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"optionalDependencies": {
|
|
29
|
+
"@lintel/cli-darwin-arm64": "0.0.8",
|
|
30
|
+
"@lintel/cli-darwin-x64": "0.0.8",
|
|
31
|
+
"@lintel/cli-linux-arm64": "0.0.8",
|
|
32
|
+
"@lintel/cli-linux-x64": "0.0.8",
|
|
33
|
+
"@lintel/cli-win32-x64": "0.0.8"
|
|
34
|
+
}
|
|
35
|
+
}
|