bend-lint 0.2.2 → 0.3.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 +14 -10
- package/package.json +2 -2
- package/src/linter/cli.bend +261 -185
- package/src/linter/{directives.bend → directives/impl.bend} +193 -153
- package/src/linter/directives/spec.bend +82 -0
- package/src/linter/seam.ts +387 -54
- package/src/{files → linter/shared/files}/effs/files.c +7 -0
- package/src/{files/main.bend → linter/shared/files/impl.bend} +24 -32
- package/src/linter/shared/files/spec.bend +39 -0
- package/src/linter/{fixes.bend → shared/fixes/impl.bend} +41 -45
- package/src/linter/shared/fixes/spec.bend +28 -0
- package/src/{json/main.bend → linter/shared/json/impl.bend} +39 -46
- package/src/linter/shared/json/spec.bend +24 -0
- package/src/{text/main.bend → linter/shared/text/impl.bend} +82 -73
- package/src/linter/shared/text/spec.bend +82 -0
- package/src/shared/bend2.ts +0 -171
- package/src/shared/result.ts +0 -57
- package/src/shared/utils.ts +0 -107
- /package/src/{files → linter/shared/files}/effs/files.js +0 -0
package/README.md
CHANGED
|
@@ -48,10 +48,12 @@ bunx bend-lint [<file or glob>...] [--fix | --fix-dangerously] [--show-suppresse
|
|
|
48
48
|
- With `--overlays`, the checker and the rules read each overlay in place of its file, also when a
|
|
49
49
|
file imports it, and the file need not be on disk; name such a file to lint it. An editor gives
|
|
50
50
|
its unsaved buffers so. It does not go with `--fix-dangerously`, which writes files on disk.
|
|
51
|
-
- bend-lint builds your rules
|
|
52
|
-
Bend changes.
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
- bend-lint builds your rules natively (about 40 s with clang), and keeps the build until a rule or
|
|
52
|
+
Bend changes. Until a native build is there, a run builds them to JavaScript (about 1 s), and
|
|
53
|
+
clang builds them in the background, for the runs after it: both find the same.
|
|
54
|
+
`bunx bend-lint prepare` waits for the native build, and lints nothing: an editor runs it at
|
|
55
|
+
start. If each rule you turn on is one of bend-lint's own, from `bend-lint-rules`, the build holds
|
|
56
|
+
all of them, so you can turn them on and off without a new build.
|
|
55
57
|
- A fix that touches an earlier fix's edits waits for the next run.
|
|
56
58
|
- bend-lint runs at low priority: a long run slows down, not your computer.
|
|
57
59
|
- bend-lint does not report Bend's own errors: `bend <file> --check-only` does. If Bend's check of a
|
|
@@ -69,7 +71,8 @@ bunx bend-lint [<file or glob>...] [--fix | --fix-dangerously] [--show-suppresse
|
|
|
69
71
|
## Config
|
|
70
72
|
|
|
71
73
|
`bend-lint.json` is the only place that picks the rules: a rule runs only if `rules` names it.
|
|
72
|
-
bend-lint reads the nearest `bend-lint.json`
|
|
74
|
+
bend-lint reads the nearest `bend-lint.json` up from the first file or folder it names (or, if it
|
|
75
|
+
names none, from the folder it runs in), and the nearest `bend-lint-rules/` up from that.
|
|
73
76
|
|
|
74
77
|
```json
|
|
75
78
|
{
|
|
@@ -97,8 +100,8 @@ bend-lint reads the nearest `bend-lint.json` above the folder it runs in.
|
|
|
97
100
|
|
|
98
101
|
bend-lint's own rules are on BendHub, as the package `bend-lint-rules` at bend-lint's version, with
|
|
99
102
|
`.0` added. Name it in `packages`, then turn a rule on by its id, like
|
|
100
|
-
`bend-lint-rules/layout/case`. Each file's header in [bend-lint-rules/](bend-lint-rules/)
|
|
101
|
-
the rule reports, what its fix does, and its options.
|
|
103
|
+
`bend-lint-rules/layout/case`. Each file's header in [src/bend-lint-rules/](src/bend-lint-rules/)
|
|
104
|
+
says what the rule reports, what its fix does, and its options.
|
|
102
105
|
|
|
103
106
|
## Suppress findings
|
|
104
107
|
|
|
@@ -123,12 +126,13 @@ Form: `# bend-lint: <disable|expect>-<scope> <rule>[@severity] -- <reason>`.
|
|
|
123
126
|
|
|
124
127
|
## Write a rule
|
|
125
128
|
|
|
126
|
-
A rule is a file in `bend-lint-rules/`. It imports bend-lint's rule API from BendHub,
|
|
127
|
-
[
|
|
129
|
+
A rule is a file in `bend-lint-rules/`. It imports bend-lint's rule API from BendHub, whose
|
|
130
|
+
[spec.bend](src/linter/api/spec.bend) says what a rule sees, and defines `rule()`:
|
|
128
131
|
|
|
129
132
|
```
|
|
130
133
|
import Base
|
|
131
|
-
import bend-lint-api@0.
|
|
134
|
+
import bend-lint-api@0.3.0.0/linter/api/impl.bend as LintImpl
|
|
135
|
+
import bend-lint-api@0.3.0.0/linter/api/spec.bend as Lint
|
|
132
136
|
|
|
133
137
|
def rule() -> Lint.Rule:
|
|
134
138
|
...
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bend-lint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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
|
"repository": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"bun": "1.4.4"
|
|
16
16
|
},
|
|
17
17
|
"bendRelease": "bendlang/bend/v2.0.39",
|
|
18
|
-
"bendWindows": "MattCozendey/bend/
|
|
18
|
+
"bendWindows": "MattCozendey/bend/d38038df4c456f5c8421f3630787f6de91d6c724",
|
|
19
19
|
"scripts": {
|
|
20
20
|
"postinstall": "bun ./src/linter/seam.ts postinstall"
|
|
21
21
|
}
|