Skip to content

Commit 5257335

Browse files
committed
Merge branch 'main' of github.com:54GradSoftware/fedify
2 parents 7a60ad2 + f691359 commit 5257335

24 files changed

Lines changed: 1203 additions & 30 deletions

.hongdown.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ proper_nouns = [
9090
"Object Integrity Proofs",
9191
"OpenTelemetry",
9292
"OpenTelemetry Collector",
93+
"Oxlint",
9394
"Piefed",
9495
"Pixelfed",
9596
"Pleroma",

CHANGES.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,20 @@ To be released.
390390
root, or when you want to inspect the generated files before
391391
installing. [[#720], [#776] by fru1tworld]
392392

393+
### @fedify/lint
394+
395+
- Added official Oxlint support through a new `@fedify/lint/oxlint` subpath
396+
export, which exposes Fedify's lint rules in the shape Oxlint's JS plugin
397+
API expects. Previously, using `@fedify/lint` from Oxlint required a local
398+
wrapper module to re-export the plugin object as the default export; the new
399+
entrypoint removes that friction. The rules are reused verbatim from the
400+
ESLint plugin, and the existing Deno and ESLint root exports are unchanged.
401+
Note that Oxlint's JS plugin support is still alpha upstream.
402+
[[#702], [#760] by NyanRus]
403+
404+
[#702]: https://github.com/fedify-dev/fedify/issues/702
405+
[#760]: https://github.com/fedify-dev/fedify/pull/760
406+
393407
### @fedify/vocab-runtime
394408

395409
- Added `PropertyPreprocessor`, `PropertyPreprocessorContext`, and `Json`

cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383
"nuxt",
8484
"operatables",
8585
"optique",
86+
"oxlint",
87+
"oxlintrc",
8688
"phensley",
8789
"Pico",
8890
"Pixelfed",

deno.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"./examples/astro",
3434
"./examples/fresh",
3535
"./examples/hono-sample",
36+
"./examples/lint/oxlint",
3637
"./examples/monitoring",
3738
"./examples/rfc-9421-test",
3839
"./test/smoke/harness"

deno.lock

Lines changed: 124 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/manual/lint.md

Lines changed: 117 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
description: >-
3-
Fedify provides linting plugins for Deno Lint and ESLint to help you catch
4-
common mistakes and enforce best practices when building federated server
5-
apps.
3+
Fedify provides linting plugins for Deno Lint, ESLint, and Oxlint to help you
4+
catch common mistakes and enforce best practices when building federated
5+
server apps.
66
---
77

88
Linting
@@ -15,8 +15,9 @@ _This package is available since Fedify 2.0.0._
1515
> app to catch common mistakes early and enforce best practices.
1616
1717
Fedify provides the [`@fedify/lint`] package, which includes lint rules
18-
specifically designed for Fedify applications. It supports both [Deno Lint] and
19-
[ESLint], so you can use it regardless of your JavaScript/TypeScript runtime.
18+
specifically designed for Fedify applications. It supports [Deno Lint],
19+
[ESLint], and [Oxlint], so you can use it regardless of your
20+
JavaScript/TypeScript runtime.
2021

2122
The plugin includes rules that check for:
2223

@@ -29,6 +30,7 @@ The plugin includes rules that check for:
2930
[`@fedify/lint`]: https://jsr.io/@fedify/lint
3031
[Deno Lint]: https://docs.deno.com/runtime/reference/lint_plugins/
3132
[ESLint]: https://eslint.org/
33+
[Oxlint]: https://oxc.rs/docs/guide/usage/linter/
3234

3335

3436
Installation
@@ -262,6 +264,114 @@ bunx eslint .
262264
:::
263265

264266

267+
Oxlint
268+
------
269+
270+
[Oxlint] is a fast Rust-based linter that supports ESLint-compatible JS
271+
plugins. `@fedify/lint` exposes its rules through Oxlint's [JS plugin API]
272+
via the `@fedify/lint/oxlint` subpath export.
273+
274+
> [!NOTE]
275+
> Oxlint's JS plugin API is currently in alpha and not subject to semver.
276+
277+
[JS plugin API]: https://oxc.rs/docs/guide/usage/linter/writing-js-plugins.html
278+
279+
### Basic setup
280+
281+
Add the plugin to your _.oxlintrc.json_ via the `jsPlugins` field, then enable
282+
the rules you want:
283+
284+
~~~~ json
285+
{
286+
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
287+
"jsPlugins": ["@fedify/lint/oxlint"],
288+
"rules": {
289+
"@fedify/lint/actor-id-required": "error",
290+
"@fedify/lint/actor-id-mismatch": "error"
291+
}
292+
}
293+
~~~~
294+
295+
Rule IDs are namespaced under `@fedify/lint/`, matching the ESLint preset.
296+
297+
### Custom configuration
298+
299+
Each rule accepts `"error"`, `"warn"`, or `"off"`. Enable any subset listed in
300+
the [*Rules* section](#rules) below:
301+
302+
~~~~ json
303+
{
304+
"jsPlugins": ["@fedify/lint/oxlint"],
305+
"rules": {
306+
"@fedify/lint/actor-id-required": "error",
307+
"@fedify/lint/actor-id-mismatch": "error",
308+
"@fedify/lint/actor-inbox-property-required": "warn",
309+
"@fedify/lint/actor-outbox-property-required": "warn",
310+
"@fedify/lint/actor-followers-property-required": "warn",
311+
"@fedify/lint/actor-public-key-required": "warn",
312+
"@fedify/lint/actor-assertion-method-required": "warn",
313+
"@fedify/lint/collection-filtering-not-implemented": "warn"
314+
}
315+
}
316+
~~~~
317+
318+
### Running Oxlint
319+
320+
Add a script to _package.json_:
321+
322+
~~~~ jsonc
323+
{
324+
"scripts": {
325+
"lint": "oxlint ."
326+
}
327+
}
328+
~~~~
329+
330+
Then run the linter:
331+
332+
::: code-group
333+
334+
~~~~ sh [npm]
335+
npm run lint
336+
~~~~
337+
338+
~~~~ sh [pnpm]
339+
pnpm lint
340+
~~~~
341+
342+
~~~~ sh [Yarn]
343+
yarn lint
344+
~~~~
345+
346+
~~~~ sh [Bun]
347+
bun lint
348+
~~~~
349+
350+
:::
351+
352+
Or invoke Oxlint directly:
353+
354+
::: code-group
355+
356+
~~~~ sh [npm]
357+
npx oxlint .
358+
~~~~
359+
360+
~~~~ sh [pnpm]
361+
pnpx oxlint .
362+
~~~~
363+
364+
~~~~ sh [Yarn]
365+
yarn oxlint .
366+
~~~~
367+
368+
~~~~ sh [Bun]
369+
bunx oxlint .
370+
~~~~
371+
372+
:::
373+
374+
265375
Rules
266376
-----
267377

@@ -1217,10 +1327,12 @@ See also
12171327
- [`@fedify/lint` on npm]
12181328
- [Deno Lint plugins documentation]
12191329
- [ESLint documentation]
1330+
- [Oxlint documentation]
12201331
- [Example project]
12211332

12221333
[`@fedify/lint` on JSR]: https://jsr.io/@fedify/lint
12231334
[`@fedify/lint` on npm]: https://www.npmjs.com/package/@fedify/lint
12241335
[Deno Lint plugins documentation]: https://docs.deno.com/runtime/reference/lint_plugins/
12251336
[ESLint documentation]: https://eslint.org/
1337+
[Oxlint documentation]: https://oxc.rs/docs/guide/usage/linter/
12261338
[Example project]: https://github.com/fedify-dev/fedify/tree/main/examples/lint
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
3+
"jsPlugins": ["@fedify/lint/oxlint"],
4+
"rules": {
5+
"@fedify/lint/actor-id-required": "error",
6+
"@fedify/lint/actor-id-mismatch": "error",
7+
"@fedify/lint/actor-inbox-property-required": "warn",
8+
"@fedify/lint/actor-outbox-property-required": "warn",
9+
"@fedify/lint/actor-followers-property-required": "warn"
10+
}
11+
}

0 commit comments

Comments
 (0)