codelaw 0.1.0 → 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.
Files changed (2) hide show
  1. package/README.md +21 -3
  2. package/package.json +9 -9
package/README.md CHANGED
@@ -16,8 +16,16 @@ as `codelaw` on npm and on PyPI; neither needs the other.
16
16
  `codelaw` installed alone lints nothing until a rule pack is installed — it
17
17
  says so (`codelaw/no-rules`).
18
18
 
19
- **Rule packs:** `js` · `html` · `css` · `python` · `data` — on npm as
20
- `@codelaw/rules-<name>`, on PyPI as `codelaw-rules-<name>`.
19
+ **Rule packs** — each registry carries the packs its users install:
20
+
21
+ <!-- docs-sync:registries -->
22
+
23
+ | registry | named | packs |
24
+ |---|---|---|
25
+ | npm | `@codelaw/rules-<name>` | `js` · `ts` · `react` · `node` · `stencil` · `html` · `css` · `data` · `tanstack-query` · `redux-toolkit` |
26
+ | PyPI | `codelaw-rules-<name>` | `js` · `react` · `html` · `css` · `python` · `data` |
27
+
28
+ <!-- /docs-sync:registries -->
21
29
 
22
30
  ## Use
23
31
 
@@ -30,15 +38,25 @@ codelaw check --format json
30
38
  **Programmatic API** — runs the bundled binary and returns its JSON report:
31
39
 
32
40
  ```js
33
- import { check, fix } from "codelaw";
41
+ import { check, fix, format, rulesFor } from "codelaw";
34
42
  const report = check(["src"]);
43
+ const rules = rulesFor("src/app.ts");
35
44
  ```
36
45
 
37
46
  ```python
38
47
  import codelaw
39
48
  report = codelaw.check(["src"])
49
+ rules = codelaw.rules_for("app/main.py")
40
50
  ```
41
51
 
52
+ | npm | Python | what it returns |
53
+ |---|---|---|
54
+ | `check(paths, options)` | `check(paths, …)` | `codelaw check --format json` |
55
+ | `fix(paths, options)` | `fix(paths, …)` | `codelaw fix --format json`; `unsafe`, `dryRun` / `dry_run` |
56
+ | `format(paths, options)` | `format(paths, …)` | `codelaw format --format json`; `check` writes nothing |
57
+ | `rulesFor(path)` | `rules_for(path)` | the rules that apply to one file, as `codelaw rules --for` lists them |
58
+ | `binaryPath()`, `platformKey()` | `binary_path()` | the bundled binary, and the platform key it was chosen by |
59
+
42
60
  ## Platforms
43
61
 
44
62
  macOS arm64 and x64 · Linux x64 and arm64, glibc and musl · Windows x64 and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codelaw",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A linter and formatter whose rules are Markdown files",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -40,13 +40,13 @@
40
40
  "prettier"
41
41
  ],
42
42
  "optionalDependencies": {
43
- "@codelaw/cli-darwin-arm64": "0.1.0",
44
- "@codelaw/cli-darwin-x64": "0.1.0",
45
- "@codelaw/cli-linux-x64-gnu": "0.1.0",
46
- "@codelaw/cli-linux-arm64-gnu": "0.1.0",
47
- "@codelaw/cli-linux-x64-musl": "0.1.0",
48
- "@codelaw/cli-linux-arm64-musl": "0.1.0",
49
- "@codelaw/cli-win32-x64": "0.1.0",
50
- "@codelaw/cli-win32-arm64": "0.1.0"
43
+ "@codelaw/cli-darwin-arm64": "0.2.0",
44
+ "@codelaw/cli-darwin-x64": "0.2.0",
45
+ "@codelaw/cli-linux-x64-gnu": "0.2.0",
46
+ "@codelaw/cli-linux-arm64-gnu": "0.2.0",
47
+ "@codelaw/cli-linux-x64-musl": "0.2.0",
48
+ "@codelaw/cli-linux-arm64-musl": "0.2.0",
49
+ "@codelaw/cli-win32-x64": "0.2.0",
50
+ "@codelaw/cli-win32-arm64": "0.2.0"
51
51
  }
52
52
  }