bend-lint 0.1.1 → 0.2.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.
package/README.md CHANGED
@@ -10,8 +10,8 @@ Install bend-lint in each project, never globally:
10
10
  bun add -D --trust bend-lint
11
11
  ```
12
12
 
13
- The install writes `bend-lint.json` and `bend-lint-rules/format.bend`, which turns on the formatter,
14
- and downloads Bend. Without `--trust`, Bun skips that: run `bunx bend-lint init`.
13
+ The install writes a `bend-lint.json` that turns on the formatter, downloads Bend, and builds your
14
+ rules. Without `--trust`, Bun skips that: run `bunx bend-lint init`, then `bunx bend-lint prepare`.
15
15
 
16
16
  > **Why per project:** a Bend limitation. Bend imports a file only by a relative path of plain names
17
17
  > (or from BendHub), so bend-lint can reach your rules only inside your project. bend-lint refuses
@@ -29,7 +29,7 @@ and says so on each run.
29
29
 
30
30
  ```sh
31
31
  bunx bend-lint [<file or glob>...] [--fix | --fix-dangerously] [--show-suppressed] [--json]
32
- [--jobs <number or max>]
32
+ [--jobs <number or max>] [--overlays] [--report <file>]
33
33
  ```
34
34
 
35
35
  | Flag | Does |
@@ -39,16 +39,29 @@ bunx bend-lint [<file or glob>...] [--fix | --fix-dangerously] [--show-suppresse
39
39
  | `--show-suppressed` | also prints the findings that a directive covers |
40
40
  | `--json` | prints one JSON object on stdout, with every fix. The summary goes to stderr |
41
41
  | `--jobs` | how many files to lint at once: a number, or `max` (default: half the CPU threads) |
42
+ | `--overlays` | reads a JSON object of paths to texts on stdin, which stand for those files |
43
+ | `--report` | writes a JSON report to the file: versions, backend, build, caches and timings |
42
44
 
43
45
  - With no files, it lints the `.bend` files in the folder you run it in: those git lists (so none
44
46
  that `.gitignore` lists), and none in `node_modules` or a hidden folder.
45
47
  - Quote globs, and use `/` in paths.
48
+ - With `--overlays`, the checker and the rules read each overlay in place of its file, also when a
49
+ file imports it, and the file need not be on disk; name such a file to lint it. An editor gives
50
+ its unsaved buffers so. It does not go with `--fix-dangerously`, which writes files on disk.
46
51
  - bend-lint builds your rules on its first run (about 40 s), and keeps the build until a rule or
47
- Bend changes.
52
+ Bend changes. `bunx bend-lint prepare` builds them, and lints nothing: an editor runs it at start.
53
+ If each rule you turn on is one of bend-lint's own, from `bend-lint-rules`, the build holds all of
54
+ them, so you can turn them on and off without a new build.
48
55
  - A fix that touches an earlier fix's edits waits for the next run.
49
56
  - bend-lint runs at low priority: a long run slows down, not your computer.
50
57
  - bend-lint does not report Bend's own errors: `bend <file> --check-only` does. If Bend's check of a
51
58
  file fails, the rules that need its types do not run on it, and bend-lint names them on stderr.
59
+ - With `--json`, a finding of one of bend-lint's own rules has `docs`: the link to its rule's file,
60
+ whose header explains it.
61
+ - With `--json`, `skipped` gives each file that rules did not run on: its `path`, the `reason`
62
+ (`unloaded`, `unchecked` or `unentered`), the `rules`, the `entry` (for `unentered`), and the
63
+ `message` stderr gets. An error that ends the run prints `{"ok": false, "errors": [...]}` instead,
64
+ each error with its `message`, and the `path` of the file it is about, if one.
52
65
  - Exit code: 0 no errors (warnings do not count), 1 an error, 2 a usage or config error.
53
66
  - The downloaded Bend, builds and cached checks go to `~/.cache/bend-lint/`. You can delete it at
54
67
  any time.
@@ -115,7 +128,7 @@ A rule is a file in `bend-lint-rules/`. It imports bend-lint's rule API from Ben
115
128
 
116
129
  ```
117
130
  import Base
118
- import bend-lint-api@0.1.1.0/linter/lint.bend as Lint
131
+ import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
119
132
 
120
133
  def rule() -> Lint.Rule:
121
134
  ...
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bend-lint",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Diagnostics for Bend 2 from rules outside the language: source text, and the checker's types",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -8,10 +8,10 @@
8
8
  },
9
9
  "type": "module",
10
10
  "engines": {
11
- "bun": "1.4.3"
11
+ "bun": "1.4.4"
12
12
  },
13
- "bendRelease": "bendlang/bend/v2.0.37",
14
- "bendWindows": "MattCozendey/bend/8621b563d53ab015dad5af3b07e679643931d780",
13
+ "bendRelease": "bendlang/bend/v2.0.39",
14
+ "bendWindows": "MattCozendey/bend/126afd6cbded7e392302b41d2504083ad26b40c1",
15
15
  "scripts": {
16
16
  "postinstall": "bun ./src/linter/seam.ts postinstall"
17
17
  }
@@ -1,6 +1,6 @@
1
1
  import Base
2
- import bend-lint-api@0.1.1.0/shared/lists.bend as Lists
3
- import bend-lint-api@0.1.1.0/shared/strings.bend as Strings
2
+ import bend-lint-api@0.2.0.0/shared/lists.bend as Lists
3
+ import bend-lint-api@0.2.0.0/shared/strings.bend as Strings
4
4
 
5
5
  # Types
6
6
  # =====
@@ -1,6 +1,6 @@
1
1
  import Base
2
- import bend-lint-api@0.1.1.0/shared/names.bend as Names
3
- import bend-lint-api@0.1.1.0/shared/strings.bend as Strings
2
+ import bend-lint-api@0.2.0.0/shared/names.bend as Names
3
+ import bend-lint-api@0.2.0.0/shared/strings.bend as Strings
4
4
 
5
5
  # Types
6
6
  # =====