Skip to content

✨ feat(mq-lint): add mq-lint crate with LintRule trait#1913

Merged
harehare merged 7 commits into
mainfrom
feat/mq-lint
Jun 27, 2026
Merged

✨ feat(mq-lint): add mq-lint crate with LintRule trait#1913
harehare merged 7 commits into
mainfrom
feat/mq-lint

Conversation

@harehare

Copy link
Copy Markdown
Owner

No description provided.

@harehare harehare marked this pull request as ready for review June 23, 2026 12:53
@codspeed-hq

codspeed-hq Bot commented Jun 23, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing feat/mq-lint (4cf3726) with main (a7faa84)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (7a2ed1d) during the generation of this report, so a7faa84 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@harehare harehare force-pushed the feat/mq-lint branch 2 times, most recently from 473348d to a8ec171 Compare June 25, 2026 13:22
harehare added 6 commits June 26, 2026 21:27
Add new mq-lint crate providing the linting infrastructure and empty
rule implementations for all 28 rules defined in mq-lint-rules.md.

- LintRule trait with id(), severity(), check()
- Diagnostic, LintContext, Linter, Severity types in lib.rs
- LintConfig with per-rule enable/disable and complexity thresholds
- Rule stubs organized into 5 categories (no mod.rs):
  correctness/ (10 rules), style/ (9 rules), complexity/ (5 rules),
  selector/ (5 rules), module/ (4 rules)
Implement 15 lint rules across correctness, style, complexity, and
selector categories:

Correctness:
- unused_variable, unused_function, unused_import
- unreachable_code, infinite_loop, duplicate_match_arm
- shadow_variable, missing_else_in_expr, always_true_condition

Style:
- prefer_let_over_var, naming_convention, boolean_comparison
- redundant_boolean_literal, prefer_specific_heading

Complexity:
- function_too_long, too_many_params, deeply_nested
- too_many_match_arms, complex_interpolation

Selector:
- inefficient_selector, missing_depth_guard

Also fix mq-hir selector_from_cst_node to map DoubleDot tokens to
Selector::Recursive so that `..` creates a proper HIR symbol.

Add LintContext::all_symbols() helper to cover symbols registered via
insert_symbol (Variable, Selector, Ref, Keyword) that are not visible
through symbols_for_source().

Add README.md for the mq-lint crate with usage examples, rule tables,
and architecture overview.

✨ feat(mq-lint): implement remaining rules and wire lint into mq-lsp

Implements check() logic for the rules that were previously stubs
(ambiguous_qualified_access, missing_module_doc, selector_always_empty,
prefer_coalesce, prefer_pipe_style, redundant_try) and drops rules that
were out of scope for this pass (unused_catch_binding, circular_import,
reexport_private, deprecated_selector, env_var_in_selector,
unnecessary_parens). Packages mq-lint as a standalone CLI binary and
adds --enable-lint/--disable-lint-rule support to mq-lsp, surfaced in
the VS Code, Neovim, and Zed clients.
… enums

Introduce RuleId (unit enum) and LintMessage (data-carrying enum) in
mq-lint/src/message.rs so every rule has a compile-time-checked id and
message/help text, instead of scattered string literals and format!
calls across 27 rule files. Diagnostic now derives rule_id()/message()/
help() from a single LintMessage value.

Update mq-lsp accordingly: Diagnostic::new(...) calls, rule_id
comparisons, and disable_rule/is_rule_enabled now use RuleId instead of
&str.
Configuration list referenced the stale mq-lsp.* prefix and omitted
typeCheck/lint/enableCodeLens settings already present in package.json.
@harehare harehare merged commit a3e11d6 into main Jun 27, 2026
9 checks passed
@harehare harehare deleted the feat/mq-lint branch June 27, 2026 12:55
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.

1 participant