Skip to content

Linter to create federation with Fedify#494

Merged
dahlia merged 41 commits intofedify-dev:nextfrom
2chanhaeng:linter
Dec 23, 2025
Merged

Linter to create federation with Fedify#494
dahlia merged 41 commits intofedify-dev:nextfrom
2chanhaeng:linter

Conversation

@2chanhaeng
Copy link
Contributor

@2chanhaeng 2chanhaeng commented Dec 15, 2025

Summary

Linter to create federation with Fedify.

Related Issue

Reference the related issue(s) by number, e.g.:

Changes

  • Add packages/lint

Benefits

Now the users can more easily identify basic issues when create federation instance.
See the example video:

fedify-lint-example

Checklist

  • Did you add a changelog entry to the CHANGES.md?
  • Did you write some relevant docs about this change (if it's a new feature)?
  • Did you write a regression test to reproduce the bug (if it's a bug fix)?
  • Did you write some tests for this change (if it's a new feature)?
  • Did you run deno task test-all on your machine?

@2chanhaeng 2chanhaeng changed the base branch from main to next December 15, 2025 10:29
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @2chanhaeng, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces Fedify v2.0.0, a major release focused on improving modularity, developer experience, and runtime compatibility. The core Fedify library has been refactored to separate concerns, leading to the creation of new packages for vocabulary runtime and code generation. The CLI tool has been overhauled for native Node.js and Bun support, and deprecated integration modules have been removed in favor of dedicated packages. These changes streamline development, enhance maintainability, and align the framework more closely with modern JavaScript ecosystems and ActivityPub standards.

Highlights

  • New Linting Package: Introduced the @fedify/lint package to provide ESLint rules for validating Fedify federation code, helping users identify common issues early.
  • Core Library Modularization: The @fedify/fedify core library has undergone significant refactoring, separating ActivityPub vocabulary runtime utilities into a new @fedify/vocab-runtime package and code generation tools into @fedify/vocab-tools.
  • CLI Overhaul: The @fedify/cli tool has been substantially refactored to support native execution on Node.js and Bun, enhancing cross-runtime compatibility. A new generate-vocab command has also been added.
  • Deprecation Cleanup: Deprecated src/x/* modules within @fedify/fedify (e.g., for Cloudflare Workers, Hono, SvelteKit, Deno KV) have been removed, with users now directed to dedicated @fedify/* packages for these integrations.
  • Idempotency Strategy Update: The default activity idempotency strategy in @fedify/fedify has been changed from "per-origin" to "per-inbox" to better align with standard ActivityPub behavior.
  • Language Tag Migration: Migrated from the @phensley/language-tag package to the standardized Intl.Locale class for representing language tags, improving compatibility and adherence to web standards.
  • NodeInfo Version Type Change: The software.version field type in NodeInfo has been updated from a SemVer object to a string to accommodate non-Semantic Versioning strings as per the NodeInfo specification.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/build.yaml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new ESLint plugin package, @fedify/lint, to help developers identify common issues when implementing Fedify federation. The package is well-structured, leveraging rule factories and helper utilities to create a maintainable and extensible set of linting rules. The initial set of rules covers many important validation cases for actor properties.

However, I've identified a critical issue in the AST traversal logic that leads to false negatives in both *-required and *-mismatch rules, as it doesn't correctly analyze all control flow paths. Additionally, there are a few medium-severity issues, including a misleading error message, unhandled parameter destructuring, and some dead code.

Addressing the critical issue is essential for the linter to be reliable. The other suggestions aim to improve clarity, robustness, and code hygiene. Overall, this is a fantastic addition to the project, and with these improvements, it will be a very valuable tool for Fedify developers.

@issues-auto-labeler issues-auto-labeler bot added component/cli CLI tools related component/federation Federation object related examples Example code related good first issue Good for newcomers labels Dec 16, 2025
@2chanhaeng 2chanhaeng closed this Dec 18, 2025
@2chanhaeng 2chanhaeng deleted the linter branch December 18, 2025 11:30
@2chanhaeng 2chanhaeng restored the linter branch December 18, 2025 11:30
@2chanhaeng 2chanhaeng reopened this Dec 18, 2025
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 95.41790% with 108 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/lint/src/lib/property-checker.ts 76.47% 40 Missing ⚠️
.../src/rules/collection-filtering-not-implemented.ts 71.64% 18 Missing and 1 partial ⚠️
packages/lint/src/lib/utils.ts 53.33% 14 Missing ⚠️
packages/lint/src/lib/mismatch.ts 90.98% 9 Missing and 2 partials ⚠️
packages/lint/src/lib/tracker.ts 73.17% 11 Missing ⚠️
packages/lint/src/lib/test-templates.ts 99.42% 7 Missing ⚠️
packages/lint/src/lib/pred.ts 90.62% 6 Missing ⚠️
Files with missing lines Coverage Δ
packages/lint/src/index.ts 100.00% <100.00%> (ø)
packages/lint/src/lib/const.ts 100.00% <100.00%> (ø)
packages/lint/src/lib/messages.ts 100.00% <100.00%> (ø)
packages/lint/src/lib/required.ts 100.00% <100.00%> (ø)
packages/lint/src/mod.ts 100.00% <100.00%> (ø)
.../lint/src/rules/actor-assertion-method-required.ts 100.00% <100.00%> (ø)
...lint/src/rules/actor-featured-property-mismatch.ts 100.00% <100.00%> (ø)
...lint/src/rules/actor-featured-property-required.ts 100.00% <100.00%> (ø)
...src/rules/actor-featured-tags-property-mismatch.ts 100.00% <100.00%> (ø)
...src/rules/actor-featured-tags-property-required.ts 100.00% <100.00%> (ø)
... and 22 more
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@2chanhaeng 2chanhaeng force-pushed the linter branch 3 times, most recently from e16352c to f320682 Compare December 19, 2025 18:08
2chanhaeng

This comment was marked as off-topic.

2chanhaeng

This comment was marked as off-topic.

2chanhaeng

This comment was marked as off-topic.

2chanhaeng

This comment was marked as off-topic.

2chanhaeng

This comment was marked as off-topic.

Copy link
Member

@dahlia dahlia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this great contribution! I have a few comments and suggestions below. One is a minor typo fix, and one is a larger suggestion about documentation that could be addressed in a follow-up PR if you prefer:

Documentation suggestion

Currently, the lint documentation consists of:

  • A section in docs/tutorial/basics.md (“Linting your federation code”)
  • The detailed packages/lint/README.md

I think it would be beneficial to add a dedicated manual page at docs/manual/lint.md, similar to other feature documentation like log.md, test.md, opentelemetry.md, etc. This would:

  1. Maintain consistency with the existing documentation structure
  2. Provide a proper reference for all 21 lint rules with detailed explanations
  3. Allow the tutorial section to remain concise (quick intro + link to manual)

The content could largely be based on the existing README.md.

This doesn't need to block this PR—it could be done as a follow-up if you prefer. What do you think?

Copy link
Member

@dahlia dahlia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

@dahlia dahlia merged commit b8f2138 into fedify-dev:next Dec 23, 2025
9 checks passed
@dahlia dahlia removed good first issue Good for newcomers examples Example code related labels Dec 31, 2025
@2chanhaeng 2chanhaeng deleted the linter branch January 14, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/cli CLI tools related component/federation Federation object related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ActivityPub implementation validator (CLI + lint plugin)

2 participants