@fedify/lint 2.3.0-pr.809.38 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  <!-- deno-fmt-ignore-file -->
2
2
 
3
- @fedify/lint: ESLint plugin for Fedify
4
- ======================================
3
+ @fedify/lint: Lint plugins for Fedify
4
+ =====================================
5
5
 
6
6
  [![JSR][JSR badge]][JSR]
7
7
  [![npm][npm badge]][npm]
@@ -9,10 +9,10 @@
9
9
 
10
10
  *This package is available since Fedify 2.0.0.*
11
11
 
12
- This package provides [Deno Lint] and [ESLint] plugin with lint rules
13
- specifically designed for [Fedify] applications. It helps you catch common
14
- mistakes and enforce best practices when building federated server apps with
15
- Fedify.
12
+ This package provides [Deno Lint], [ESLint], and [Oxlint] plugins with lint
13
+ rules specifically designed for [Fedify] applications. It helps you catch
14
+ common mistakes and enforce best practices when building federated server apps
15
+ with Fedify.
16
16
 
17
17
  The plugin includes rules that check for:
18
18
 
@@ -30,6 +30,7 @@ The plugin includes rules that check for:
30
30
  [@fedify@hollo.social]: https://hollo.social/@fedify
31
31
  [Deno Lint]: https://docs.deno.com/runtime/reference/lint_plugins/
32
32
  [ESLint]: https://eslint.org/
33
+ [Oxlint]: https://oxc.rs/docs/guide/usage/linter/
33
34
  [Fedify]: https://fedify.dev/
34
35
 
35
36
  ### Deno Lint configuration example
@@ -62,6 +63,21 @@ import fedifyLint from "@fedify/lint";
62
63
  export default fedifyLint;
63
64
  ~~~~
64
65
 
66
+ ### Oxlint configuration example
67
+
68
+ ~~~~ jsonc
69
+ // .oxlintrc.json
70
+
71
+ {
72
+ "jsPlugins": ["@fedify/lint/oxlint"],
73
+ "rules": {
74
+ "@fedify/lint/actor-id-required": "error",
75
+ "@fedify/lint/actor-id-mismatch": "error",
76
+ "@fedify/lint/actor-inbox-property-required": "warn"
77
+ }
78
+ }
79
+ ~~~~
80
+
65
81
 
66
82
  Features
67
83
  --------
@@ -403,6 +419,114 @@ bunx eslint .
403
419
  :::
404
420
 
405
421
 
422
+ Usage (Oxlint)
423
+ --------------
424
+
425
+ [Oxlint] is a fast Rust-based linter that supports ESLint-compatible JS plugins.
426
+ The `@fedify/lint/oxlint` subpath export plugs the Fedify rules into Oxlint's
427
+ [JS plugin API].
428
+
429
+ > [!NOTE]
430
+ > Oxlint's JS plugin API is currently in alpha and not subject to semver.
431
+
432
+ [JS plugin API]: https://oxc.rs/docs/guide/usage/linter/writing-js-plugins.html
433
+
434
+ ### Basic setup
435
+
436
+ Add the plugin and the rules you want to enable to your *.oxlintrc.json*:
437
+
438
+ ~~~~ json
439
+ {
440
+ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
441
+ "jsPlugins": ["@fedify/lint/oxlint"],
442
+ "rules": {
443
+ "@fedify/lint/actor-id-required": "error",
444
+ "@fedify/lint/actor-id-mismatch": "error"
445
+ }
446
+ }
447
+ ~~~~
448
+
449
+ Rule IDs are namespaced under `@fedify/lint/`, matching the ESLint
450
+ configuration above.
451
+
452
+ ### Custom configuration
453
+
454
+ Enable any subset of the rules listed in the *Features* section above. Each
455
+ rule can be set to `"error"`, `"warn"`, or `"off"`:
456
+
457
+ ~~~~ json
458
+ {
459
+ "jsPlugins": ["@fedify/lint/oxlint"],
460
+ "rules": {
461
+ "@fedify/lint/actor-id-required": "error",
462
+ "@fedify/lint/actor-id-mismatch": "error",
463
+ "@fedify/lint/actor-inbox-property-required": "warn",
464
+ "@fedify/lint/actor-outbox-property-required": "warn",
465
+ "@fedify/lint/actor-followers-property-required": "warn",
466
+ "@fedify/lint/actor-public-key-required": "warn",
467
+ "@fedify/lint/actor-assertion-method-required": "warn",
468
+ "@fedify/lint/collection-filtering-not-implemented": "warn"
469
+ }
470
+ }
471
+ ~~~~
472
+
473
+ ### Running Oxlint
474
+
475
+ Add a script to *package.json*:
476
+
477
+ ~~~~ jsonc
478
+ {
479
+ "scripts": {
480
+ "lint": "oxlint ."
481
+ }
482
+ }
483
+ ~~~~
484
+
485
+ Then run:
486
+
487
+ ::: code-group
488
+
489
+ ~~~~ sh [npm]
490
+ npm run lint
491
+ ~~~~
492
+
493
+ ~~~~ sh [pnpm]
494
+ pnpm lint
495
+ ~~~~
496
+
497
+ ~~~~ sh [Yarn]
498
+ yarn lint
499
+ ~~~~
500
+
501
+ ~~~~ sh [Bun]
502
+ bun lint
503
+ ~~~~
504
+
505
+ :::
506
+
507
+ Or invoke Oxlint directly:
508
+
509
+ ::: code-group
510
+
511
+ ~~~~ sh [npm]
512
+ npx oxlint .
513
+ ~~~~
514
+
515
+ ~~~~ sh [pnpm]
516
+ pnpx oxlint .
517
+ ~~~~
518
+
519
+ ~~~~ sh [Yarn]
520
+ yarn oxlint .
521
+ ~~~~
522
+
523
+ ~~~~ sh [Bun]
524
+ bunx oxlint .
525
+ ~~~~
526
+
527
+ :::
528
+
529
+
406
530
  See also
407
531
  --------
408
532
 
package/deno.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@fedify/lint",
3
- "version": "2.3.0-pr.809.38+ec739d40",
3
+ "version": "2.3.0",
4
4
  "license": "MIT",
5
5
  "exports": {
6
- ".": "./src/mod.ts"
6
+ ".": "./src/mod.ts",
7
+ "./oxlint": "./src/oxlint.ts"
7
8
  },
8
9
  "imports": {
9
10
  "eslint": "npm:eslint@^9.0.0",
10
- "estree": "npm:@types/estree@^1.0.8"
11
+ "estree": "npm:@types/estree@^1.0.8",
12
+ "oxlint": "npm:oxlint@^1.66.0"
11
13
  },
12
14
  "publish": {
13
15
  "exclude": [
@@ -16,6 +18,6 @@
16
18
  ]
17
19
  },
18
20
  "tasks": {
19
- "test": "deno test --allow-env"
21
+ "test": "deno test --allow-env --allow-read --allow-run --allow-sys --allow-write"
20
22
  }
21
23
  }