chore(cli): add migration-self-contained lintoko example rule#594
Merged
Conversation
Enhanced migration files should not import sibling .mo modules — only package/canister URLs. Add an example lint rule matching the compiler's Url.Relative classification (paths without a colon). Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Cursor AI review👍 APPROVE — looks safe to merge
VerdictDecision: APPROVE Generated for commit b042819 |
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Kamirus
added a commit
that referenced
this pull request
Jun 26, 2026
…tions/*.mo (#599) Follow-up to [#594](#594). The `migration-self-contained` example rule used `**/migrations/**` for both lintoko `includes` and `[lint.extra]`, which could match any `migrations` directory anywhere in the tree and recurse into subfolders. Projects using enhanced migrations keep a flat `migrations/*.mo` chain (as configured via `chain = "migrations"` in `mops.toml`), so the example should mirror that layout. **Before** ```toml # migration-self-contained.toml includes = ["**/migrations/**"] # mops.toml [lint.extra] "migrations/**" = ["lint/migration-self-contained"] ``` **After** ```toml # migration-self-contained.toml includes = ["migrations/*.mo"] # mops.toml [lint.extra] "migrations/*.mo" = ["lint/migration-self-contained"] ``` If your chain path differs (e.g. `backend/migrations`), set both `includes` and `[lint.extra]` to that path with `/*.mo`. ## What is unchanged No CLI behavior change — only the `lint-extra-example-rules` test fixture. No CHANGELOG entry. Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhanced migration chains stay maintainable when each file is self-contained — importing packages (
mo:…), canisters (canister:…), etc., but not sibling.momodules. This adds a copyablemigration-self-containedlintoko example rule that flags relative module imports inmigrations/, aligned with the Motoko compiler'sUrl.Relativeclassification (import paths without:).Before: no example rule for local imports in migration files.
After: with
[lint.extra]configured:The rule uses
#match? @path "^\"[^:]*\"$"so any new compiler URL scheme (with:) is allowed without updating the rule.blob:file:imports are out of scope — the compiler classifies those asFileValue, notRelative.Made with Cursor