Skip to content

Fix sort_requires not recognizing const imports in luau - #1123

Merged
JohnnyMorganz merged 4 commits into
JohnnyMorganz:mainfrom
ddashdev:const_sort_requires
Oct 3, 2026
Merged

JohnnyMorganz merged 4 commits into
JohnnyMorganz:mainfrom
ddashdev:const_sort_requires

Conversation

@ddashdev

Copy link
Copy Markdown
Contributor

Problem

sort_requires only recognized imports parsed as Stmt::LocalAssignment, so Luau imports declared with the new const keyword were ignored.

For example, this stayed unsorted:

const Zebra = require("Zebra")
const Apple = require("Apple")

Summary

  • Adds Luau-only handling for Stmt::ConstAssignment in sort-requires
  • Reuses the same require-matching logic for local and const assignments
  • Preserves existing grouping, blank-line splitting, ignored-node behavior, and game:GetService sorting
  • Adds tests for const requires, mixed local/const blocks, type assertions, and services
  • Updates docs and changelog

@riptscripts

Copy link
Copy Markdown

Plss

@JohnnyMorganz JohnnyMorganz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you!

@JohnnyMorganz
JohnnyMorganz enabled auto-merge (squash) October 3, 2026 16:51
@JohnnyMorganz
JohnnyMorganz merged commit 7119cdb into JohnnyMorganz:main Oct 3, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants