@fedify/lint 2.4.5-dev.2462 → 2.4.6-dev.2628

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
@@ -9,7 +9,7 @@
9
9
 
10
10
  *This package is available since Fedify 2.0.0.*
11
11
 
12
- This package provides [Deno Lint], [ESLint], and [Oxlint] plugins with lint
12
+ This package provides [ESLint], [Oxlint], and [Deno Lint] plugins with lint
13
13
  rules specifically designed for [Fedify] applications. It helps you catch
14
14
  common mistakes and enforce best practices when building federated server apps
15
15
  with Fedify.
@@ -28,31 +28,11 @@ The plugin includes rules that check for:
28
28
  [npm]: https://www.npmjs.com/package/@fedify/lint
29
29
  [@fedify@hackers.pub badge]: https://fedi-badge.minhee.org/@fedify@hackers.pub/followers.svg
30
30
  [@fedify@hackers.pub]: https://hackers.pub/@fedify
31
- [Deno Lint]: https://docs.deno.com/runtime/reference/lint_plugins/
32
31
  [ESLint]: https://eslint.org/
33
32
  [Oxlint]: https://oxc.rs/docs/guide/usage/linter/
33
+ [Deno Lint]: https://docs.deno.com/runtime/reference/lint_plugins/
34
34
  [Fedify]: https://fedify.dev/
35
35
 
36
- ### Deno Lint configuration example
37
-
38
- ~~~~ typescript
39
- // deno.json
40
-
41
- {
42
- "lint": {
43
- "plugins": {
44
- "@fedify/lint": "jsr:@fedify/lint"
45
- },
46
- "rules": {
47
- "@fedify/lint/actor-id-required": "error",
48
- "@fedify/lint/actor-id-mismatch": "error",
49
- "@fedify/lint/actor-inbox-property-required": "warn"
50
- // ... other rules
51
- }
52
- }
53
- }
54
- ~~~~
55
-
56
36
  ### ESLint configuration example
57
37
 
58
38
  ~~~~ typescript
@@ -78,6 +58,18 @@ export default fedifyLint;
78
58
  }
79
59
  ~~~~
80
60
 
61
+ ### Deno Lint configuration example
62
+
63
+ ~~~~ jsonc
64
+ // deno.json
65
+
66
+ {
67
+ "lint": {
68
+ "plugins": ["jsr:@fedify/lint"]
69
+ }
70
+ }
71
+ ~~~~
72
+
81
73
 
82
74
  Features
83
75
  --------
@@ -179,61 +171,6 @@ bun add -D @fedify/lint
179
171
  :::
180
172
 
181
173
 
182
- Usage (Deno Lint)
183
- -----------------
184
-
185
- ### Basic setup
186
-
187
- Add the plugin to your *deno.json* configuration file:
188
-
189
- ~~~~ json
190
- {
191
- "lint": {
192
- "plugins": ["jsr:@fedify/lint"]
193
- }
194
- }
195
- ~~~~
196
-
197
- By default, this enables all recommended rules.
198
-
199
- ### Custom configuration
200
-
201
- You can customize which rules to enable and their severity levels:
202
-
203
- ~~~~ json
204
- {
205
- "lint": {
206
- "plugins": ["jsr:@fedify/lint"],
207
- "rules": {
208
- "tags": ["recommended"],
209
- "include": [
210
- "@fedify/lint/actor-id-required",
211
- "@fedify/lint/actor-id-mismatch"
212
- ],
213
- "exclude": [
214
- "@fedify/lint/actor-featured-property-required"
215
- ]
216
- }
217
- }
218
- }
219
- ~~~~
220
-
221
- ### Running Deno Lint
222
-
223
- After setting up the configuration, run Deno's linter:
224
-
225
- ~~~~ sh
226
- deno lint
227
- ~~~~
228
-
229
- You can also specify which files to lint:
230
-
231
- ~~~~ sh
232
- deno lint federation.ts
233
- deno lint src/federation/
234
- ~~~~
235
-
236
-
237
174
  Usage (ESLint)
238
175
  --------------
239
176
 
@@ -314,84 +251,70 @@ export default [{
314
251
  ~~~~
315
252
 
316
253
 
317
- Example
318
- -------
319
-
320
- Here's an example of code that would trigger lint errors:
321
-
322
- ~~~~ typescript
323
- // ❌ Wrong: Using relative URL for actor ID
324
- import { createFederation, Person } from "@fedify/fedify";
254
+ Usage (Oxlint)
255
+ --------------
325
256
 
326
- const federation = createFederation({ /* ... */ });
257
+ [Oxlint] is a fast Rust-based linter that supports ESLint-compatible JS plugins.
258
+ The `@fedify/lint/oxlint` subpath export plugs the Fedify rules into Oxlint's
259
+ [JS plugin API].
327
260
 
328
- federation.setActorDispatcher(
329
- "/{identifier}",
330
- (_ctx, identifier) => {
331
- return new Person({
332
- id: new URL(`/${identifier}`), // ❌ Should use ctx.getActorUri()
333
- name: "Example User",
334
- });
335
- },
336
- );
337
- ~~~~
261
+ > [!NOTE]
262
+ > Oxlint's JS plugin API is currently in alpha and not subject to semver.
338
263
 
339
- Corrected version:
264
+ [JS plugin API]: https://oxc.rs/docs/guide/usage/linter/writing-js-plugins.html
340
265
 
341
- ~~~~ typescript
342
- // ✅ Correct: Using Context.getActorUri() for actor ID
343
- import { createFederation, Person } from "@fedify/fedify";
266
+ ### Basic setup
344
267
 
345
- const federation = createFederation({ /* ... */ });
268
+ Add the plugin and the rules you want to enable to your *.oxlintrc.json*:
346
269
 
347
- federation.setActorDispatcher(
348
- "/{identifier}",
349
- (ctx, identifier) => {
350
- return new Person({
351
- id: ctx.getActorUri(identifier), // ✅ Correct
352
- name: "Example User",
353
- inbox: ctx.getInboxUri(identifier),
354
- outbox: ctx.getOutboxUri(identifier),
355
- followers: ctx.getFollowersUri(identifier),
356
- // ... other required properties
357
- });
358
- },
359
- );
270
+ ~~~~ json
271
+ {
272
+ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
273
+ "jsPlugins": ["@fedify/lint/oxlint"],
274
+ "rules": {
275
+ "@fedify/lint/actor-id-required": "error",
276
+ "@fedify/lint/actor-id-mismatch": "error"
277
+ }
278
+ }
360
279
  ~~~~
361
280
 
281
+ Rule IDs are namespaced under `@fedify/lint/`, matching the ESLint
282
+ configuration above.
362
283
 
363
- Running the linter
364
- ------------------
365
-
366
- ### Deno Lint
367
-
368
- Run Deno's linter with the plugin enabled:
369
-
370
- ~~~~ sh
371
- deno lint
372
- ~~~~
284
+ ### Custom configuration
373
285
 
374
- You can also specify which files or directories to lint:
286
+ Enable any subset of the rules listed in the *Features* section above. Each
287
+ rule can be set to `"error"`, `"warn"`, or `"off"`:
375
288
 
376
- ~~~~ sh
377
- deno lint federation.ts
378
- deno lint src/federation/
289
+ ~~~~ json
290
+ {
291
+ "jsPlugins": ["@fedify/lint/oxlint"],
292
+ "rules": {
293
+ "@fedify/lint/actor-id-required": "error",
294
+ "@fedify/lint/actor-id-mismatch": "error",
295
+ "@fedify/lint/actor-inbox-property-required": "warn",
296
+ "@fedify/lint/actor-outbox-property-required": "warn",
297
+ "@fedify/lint/actor-followers-property-required": "warn",
298
+ "@fedify/lint/actor-public-key-required": "warn",
299
+ "@fedify/lint/actor-assertion-method-required": "warn",
300
+ "@fedify/lint/collection-filtering-not-implemented": "warn"
301
+ }
302
+ }
379
303
  ~~~~
380
304
 
381
- ### ESLint
305
+ ### Running Oxlint
382
306
 
383
- Set up your ESLint configuration as shown above and add a follwing script on
384
- `package.json`:
307
+ Add a script to *package.json*:
385
308
 
386
309
  ~~~~ jsonc
387
310
  {
388
311
  "scripts": {
389
- "lint": "eslint ."
312
+ "lint": "oxlint ."
390
313
  }
391
314
  }
392
315
  ~~~~
393
316
 
394
- After setting up the configuration, run ESLint on your codebase:
317
+ Then run:
395
318
 
396
319
  ::: code-group
397
320
 
@@ -413,93 +336,150 @@ bun lint
413
336
 
414
337
  :::
415
338
 
416
- or run the linter directly via command line:
339
+ Or invoke Oxlint directly:
417
340
 
418
341
  ::: code-group
419
342
 
420
343
  ~~~~ sh [npm]
421
- npx eslint .
344
+ npx oxlint .
422
345
  ~~~~
423
346
 
424
347
  ~~~~ sh [pnpm]
425
- pnpx eslint .
348
+ pnpx oxlint .
426
349
  ~~~~
427
350
 
428
351
  ~~~~ sh [Yarn]
429
- yarn eslint .
352
+ yarn oxlint .
430
353
  ~~~~
431
354
 
432
355
  ~~~~ sh [Bun]
433
- bunx eslint .
356
+ bunx oxlint .
434
357
  ~~~~
435
358
 
436
359
  :::
437
360
 
438
361
 
439
- Usage (Oxlint)
440
- --------------
441
-
442
- [Oxlint] is a fast Rust-based linter that supports ESLint-compatible JS plugins.
443
- The `@fedify/lint/oxlint` subpath export plugs the Fedify rules into Oxlint's
444
- [JS plugin API].
445
-
446
- > [!NOTE]
447
- > Oxlint's JS plugin API is currently in alpha and not subject to semver.
448
-
449
- [JS plugin API]: https://oxc.rs/docs/guide/usage/linter/writing-js-plugins.html
362
+ Usage (Deno Lint)
363
+ -----------------
450
364
 
451
365
  ### Basic setup
452
366
 
453
- Add the plugin and the rules you want to enable to your *.oxlintrc.json*:
367
+ Add the plugin to your *deno.json* configuration file:
454
368
 
455
369
  ~~~~ json
456
370
  {
457
- "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
458
- "jsPlugins": ["@fedify/lint/oxlint"],
459
- "rules": {
460
- "@fedify/lint/actor-id-required": "error",
461
- "@fedify/lint/actor-id-mismatch": "error"
371
+ "lint": {
372
+ "plugins": ["jsr:@fedify/lint"]
462
373
  }
463
374
  }
464
375
  ~~~~
465
376
 
466
- Rule IDs are namespaced under `@fedify/lint/`, matching the ESLint
467
- configuration above.
377
+ This enables every rule provided by the plugin. Deno reports plugin rules
378
+ as errors; it does not support a recommended subset or configurable severity
379
+ levels for plugin rules.
468
380
 
469
381
  ### Custom configuration
470
382
 
471
- Enable any subset of the rules listed in the *Features* section above. Each
472
- rule can be set to `"error"`, `"warn"`, or `"off"`:
383
+ Disable individual plugin rules through `lint.rules.exclude`, using the
384
+ plugin name `fedify-lint` as the prefix:
473
385
 
474
386
  ~~~~ json
475
387
  {
476
- "jsPlugins": ["@fedify/lint/oxlint"],
477
- "rules": {
478
- "@fedify/lint/actor-id-required": "error",
479
- "@fedify/lint/actor-id-mismatch": "error",
480
- "@fedify/lint/actor-inbox-property-required": "warn",
481
- "@fedify/lint/actor-outbox-property-required": "warn",
482
- "@fedify/lint/actor-followers-property-required": "warn",
483
- "@fedify/lint/actor-public-key-required": "warn",
484
- "@fedify/lint/actor-assertion-method-required": "warn",
485
- "@fedify/lint/collection-filtering-not-implemented": "warn"
388
+ "lint": {
389
+ "plugins": ["jsr:@fedify/lint"],
390
+ "rules": {
391
+ "exclude": [
392
+ "fedify-lint/actor-featured-property-required"
393
+ ]
394
+ }
486
395
  }
487
396
  }
488
397
  ~~~~
489
398
 
490
- ### Running Oxlint
399
+ `rules.tags` and `rules.include` apply to Deno's built-in rules, not plugin
400
+ rules. See the [linting manual] for more details.
491
401
 
492
- Add a script to *package.json*:
402
+ [linting manual]: https://fedify.dev/manual/lint#turning-rules-off
403
+
404
+ ### Running Deno Lint
405
+
406
+ After setting up the configuration, run Deno's linter:
407
+
408
+ ~~~~ sh
409
+ deno lint
410
+ ~~~~
411
+
412
+ You can also specify which files to lint:
413
+
414
+ ~~~~ sh
415
+ deno lint federation.ts
416
+ deno lint src/federation/
417
+ ~~~~
418
+
419
+
420
+ Example
421
+ -------
422
+
423
+ Here's an example of code that would trigger lint errors:
424
+
425
+ ~~~~ typescript
426
+ // ❌ Wrong: Using relative URL for actor ID
427
+ import { createFederation, Person } from "@fedify/fedify";
428
+
429
+ const federation = createFederation({ /* ... */ });
430
+
431
+ federation.setActorDispatcher(
432
+ "/{identifier}",
433
+ (_ctx, identifier) => {
434
+ return new Person({
435
+ id: new URL(`/${identifier}`), // ❌ Should use ctx.getActorUri()
436
+ name: "Example User",
437
+ });
438
+ },
439
+ );
440
+ ~~~~
441
+
442
+ Corrected version:
443
+
444
+ ~~~~ typescript
445
+ // ✅ Correct: Using Context.getActorUri() for actor ID
446
+ import { createFederation, Person } from "@fedify/fedify";
447
+
448
+ const federation = createFederation({ /* ... */ });
449
+
450
+ federation.setActorDispatcher(
451
+ "/{identifier}",
452
+ (ctx, identifier) => {
453
+ return new Person({
454
+ id: ctx.getActorUri(identifier), // ✅ Correct
455
+ name: "Example User",
456
+ inbox: ctx.getInboxUri(identifier),
457
+ outbox: ctx.getOutboxUri(identifier),
458
+ followers: ctx.getFollowersUri(identifier),
459
+ // ... other required properties
460
+ });
461
+ },
462
+ );
463
+ ~~~~
464
+
465
+
466
+ Running the linter
467
+ ------------------
468
+
469
+ ### ESLint
470
+
471
+ Set up your ESLint configuration as shown above and add a follwing script on
472
+ `package.json`:
493
473
 
494
474
  ~~~~ jsonc
495
475
  {
496
476
  "scripts": {
497
- "lint": "oxlint ."
477
+ "lint": "eslint ."
498
478
  }
499
479
  }
500
480
  ~~~~
501
481
 
502
- Then run:
482
+ After setting up the configuration, run ESLint on your codebase:
503
483
 
504
484
  ::: code-group
505
485
 
@@ -521,28 +501,43 @@ bun lint
521
501
 
522
502
  :::
523
503
 
524
- Or invoke Oxlint directly:
504
+ or run the linter directly via command line:
525
505
 
526
506
  ::: code-group
527
507
 
528
508
  ~~~~ sh [npm]
529
- npx oxlint .
509
+ npx eslint .
530
510
  ~~~~
531
511
 
532
512
  ~~~~ sh [pnpm]
533
- pnpx oxlint .
513
+ pnpx eslint .
534
514
  ~~~~
535
515
 
536
516
  ~~~~ sh [Yarn]
537
- yarn oxlint .
517
+ yarn eslint .
538
518
  ~~~~
539
519
 
540
520
  ~~~~ sh [Bun]
541
- bunx oxlint .
521
+ bunx eslint .
542
522
  ~~~~
543
523
 
544
524
  :::
545
525
 
526
+ ### Deno Lint
527
+
528
+ Run Deno's linter with the plugin enabled:
529
+
530
+ ~~~~ sh
531
+ deno lint
532
+ ~~~~
533
+
534
+ You can also specify which files or directories to lint:
535
+
536
+ ~~~~ sh
537
+ deno lint federation.ts
538
+ deno lint src/federation/
539
+ ~~~~
540
+
546
541
 
547
542
  See also
548
543
  --------
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/lint",
3
- "version": "2.4.5-dev.2462+46a3f2c5",
3
+ "version": "2.4.6-dev.2628+2a78382f",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts",
package/dist/index.cjs CHANGED
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  enumerable: true
25
25
  }) : target, mod));
26
26
  //#endregion
27
- const require_outbox_listener_delivery_required = require("./outbox-listener-delivery-required-HzMZRVjC.cjs");
27
+ const require_outbox_listener_delivery_required = require("./outbox-listener-delivery-required-BvVt8uQ4.cjs");
28
28
  let _fxts_core = require("@fxts/core");
29
29
  let _typescript_eslint_parser = require("@typescript-eslint/parser");
30
30
  _typescript_eslint_parser = __toESM(_typescript_eslint_parser, 1);
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as name, C as eslint$5, D as eslint$11, E as eslint$10, O as eslint$21, S as eslint$4, T as eslint$13, _ as eslint$15, a as eslint$23, b as eslint$2, c as eslint$16, d as eslint$22, f as eslint$6, g as eslint$14, h as eslint$9, i as eslint$27, j as version, k as RULE_IDS, l as eslint$17, m as eslint$8, n as eslint$25, o as eslint$18, p as eslint$7, r as eslint$26, s as eslint$19, t as eslint$24, u as eslint$20, v as eslint$1, w as eslint$12, x as eslint$3, y as eslint } from "./outbox-listener-delivery-required-DB9LHwig.js";
1
+ import { A as name, C as eslint$5, D as eslint$11, E as eslint$10, O as eslint$21, S as eslint$4, T as eslint$13, _ as eslint$15, a as eslint$23, b as eslint$2, c as eslint$16, d as eslint$22, f as eslint$6, g as eslint$14, h as eslint$9, i as eslint$27, j as version, k as RULE_IDS, l as eslint$17, m as eslint$8, n as eslint$25, o as eslint$18, p as eslint$7, r as eslint$26, s as eslint$19, t as eslint$24, u as eslint$20, v as eslint$1, w as eslint$12, x as eslint$3, y as eslint } from "./outbox-listener-delivery-required-BAABhZDs.js";
2
2
  import { fromEntries, keys, map, pipe } from "@fxts/core";
3
3
  import parser from "@typescript-eslint/parser";
4
4
  //#region src/index.ts
@@ -1,7 +1,7 @@
1
1
  import { always, every, head, isEmpty, isObject, negate, pipe, pipeLazy, prop, some, toArray, unless, when } from "@fxts/core";
2
2
  //#region deno.json
3
3
  var name = "@fedify/lint";
4
- var version = "2.4.5-dev.2462+46a3f2c5";
4
+ var version = "2.4.6-dev.2628+2a78382f";
5
5
  //#endregion
6
6
  //#region src/lib/const.ts
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  let _fxts_core = require("@fxts/core");
2
2
  //#region deno.json
3
3
  var name = "@fedify/lint";
4
- var version = "2.4.5-dev.2462+46a3f2c5";
4
+ var version = "2.4.6-dev.2628+2a78382f";
5
5
  //#endregion
6
6
  //#region src/lib/const.ts
7
7
  /**
package/dist/oxlint.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_outbox_listener_delivery_required = require("./outbox-listener-delivery-required-HzMZRVjC.cjs");
1
+ const require_outbox_listener_delivery_required = require("./outbox-listener-delivery-required-BvVt8uQ4.cjs");
2
2
  //#region src/oxlint.ts
3
3
  const rules = {
4
4
  [require_outbox_listener_delivery_required.RULE_IDS.actorIdMismatch]: require_outbox_listener_delivery_required.eslint$18,
package/dist/oxlint.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as name, C as eslint$5, D as eslint$11, E as eslint$10, O as eslint$21, S as eslint$4, T as eslint$13, _ as eslint$15, a as eslint$23, b as eslint$2, c as eslint$16, d as eslint$22, f as eslint$6, g as eslint$14, h as eslint$9, i as eslint$27, j as version, k as RULE_IDS, l as eslint$17, m as eslint$8, n as eslint$25, o as eslint$18, p as eslint$7, r as eslint$26, s as eslint$19, t as eslint$24, u as eslint$20, v as eslint$1, w as eslint$12, x as eslint$3, y as eslint } from "./outbox-listener-delivery-required-DB9LHwig.js";
1
+ import { A as name, C as eslint$5, D as eslint$11, E as eslint$10, O as eslint$21, S as eslint$4, T as eslint$13, _ as eslint$15, a as eslint$23, b as eslint$2, c as eslint$16, d as eslint$22, f as eslint$6, g as eslint$14, h as eslint$9, i as eslint$27, j as version, k as RULE_IDS, l as eslint$17, m as eslint$8, n as eslint$25, o as eslint$18, p as eslint$7, r as eslint$26, s as eslint$19, t as eslint$24, u as eslint$20, v as eslint$1, w as eslint$12, x as eslint$3, y as eslint } from "./outbox-listener-delivery-required-BAABhZDs.js";
2
2
  //#region src/oxlint.ts
3
3
  const rules = {
4
4
  [RULE_IDS.actorIdMismatch]: eslint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/lint",
3
- "version": "2.4.5-dev.2462+46a3f2c5",
3
+ "version": "2.4.6-dev.2628+2a78382f",
4
4
  "description": "Fedify linting rules and plugins",
5
5
  "keywords": [
6
6
  "Fedify",
@@ -51,7 +51,7 @@
51
51
  ],
52
52
  "peerDependencies": {
53
53
  "eslint": ">=9.0.0",
54
- "@fedify/fedify": "^2.4.5-dev.2462+46a3f2c5"
54
+ "@fedify/fedify": "^2.4.6-dev.2628+2a78382f"
55
55
  },
56
56
  "peerDependenciesMeta": {
57
57
  "eslint": {
@@ -70,8 +70,8 @@
70
70
  "oxlint": "^1.66.0",
71
71
  "tsdown": "^0.22.0",
72
72
  "typescript": "^6.0.0",
73
- "@fedify/vocab": "2.4.5-dev.2462+46a3f2c5",
74
- "@fedify/fixture": "2.0.0"
73
+ "@fedify/fixture": "2.0.0",
74
+ "@fedify/vocab": "2.4.6-dev.2628+2a78382f"
75
75
  },
76
76
  "scripts": {
77
77
  "build:self": "tsdown",