Fix DisallowModule rule missing Pexp_ident — pipe calls with no extra args (#15) - #16
Merged
Merged
Conversation
… args now caught (#15) Replace Pexp_apply-only matching with Pexp_ident matching in lintExpression so bare module references (e.g. x->Belt.List.toArray) are detected. Adds tests for the bug case and verifies all existing Pexp_apply scenarios still pass. Bump version to 0.4.3.
shulhi
approved these changes
Feb 27, 2026
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.
Summary
Fixes #15 —
DisallowModulerule now catches disallowed module usage in pipe calls with no extra arguments (e.g.x->Belt.List.toArray).Root Cause
The linter's
lintExpressiononly matchedPexp_applynodes (function calls with arguments). Whenx->fhas no extra args, the bundled parser representsfas a barePexp_identargument to the pipe operator — not asPexp_applyoff— so it was invisible to the rule.Fix
Replaced the
Pexp_apply-only pattern with aPexp_identpattern inDisallowModuleRule.ml. Since the AST iterator visits every expression node,Pexp_identnaturally catches the disallowed module identifier whether it appears in a direct call, a pipe with args, or a pipe with no extra args. No double-counting occurs because thePexp_applycase was removed.Tests
disallow_module_test_6.res— TDD red-to-green test for the bug: direct call, pipe+args, pipe no-args (toArray,length)disallow_module_test_7.res— Verifies allPexp_applyscenarios still work: single arg, multiple args, pipe+args, pipe no-args, chained pipes, nested callsVersion
Bumped to
v0.4.3