feat(linter): implement unicorn/prefer-module#19603
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merging this PR will not alter performance
Comparing Footnotes
|
40d71ff to
57ce894
Compare
755e69a to
038a28d
Compare
57ce894 to
a52d51a
Compare
038a28d to
15a969f
Compare
a315cd5 to
4350365
Compare
9136296 to
c0562c7
Compare
4350365 to
52f4221
Compare
c0562c7 to
79fe3b4
Compare
52f4221 to
4ff8936
Compare
4ff8936 to
c9f1e32
Compare
There was a problem hiding this comment.
Pull request overview
Implements the eslint-plugin-unicorn(prefer-module) lint rule in oxc_linter, adding diagnostics to discourage CommonJS globals / patterns (and related strict-mode artifacts) to encourage ES module usage.
Changes:
- Added a new
unicorn/prefer-modulerule that reports on"use strict"directives, top-levelreturn, and CommonJS globals (require,module,exports,__filename,__dirname) when referenced as globals. - Added rule tests and a corresponding snapshot.
- Registered the new rule in the unicorn module list and generated rule enum/runner plumbing.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
crates/oxc_linter/src/rules/unicorn/prefer_module.rs |
New rule implementation + test cases for expected pass/fail behavior. |
crates/oxc_linter/src/snapshots/unicorn_prefer_module.snap |
Snapshot output for the new rule’s test suite. |
crates/oxc_linter/src/rules.rs |
Exposes the new rule module under unicorn. |
crates/oxc_linter/src/generated/rules_enum.rs |
Registers the rule in the generated enum and metadata dispatch. |
crates/oxc_linter/src/generated/rule_runner_impls.rs |
Adds the rule’s AST node type registration for runner dispatch. |
c9f1e32 to
d9461a6
Compare
Merge activity
|
d9461a6 to
46177dd
Compare
# Oxlint ### 🚀 Features - 46177dd linter: Implement unicorn/prefer-module (#19603) (camc314) - 42f78bb linter: Implement unicorn/prefer-ternary (#19605) (camc314) ### 🐛 Bug Fixes - 43df857 react/exhaustive-deps: Normalize .current callback deps (#19610) (camc314) - 574f48f linter/no-throw-literal: Close warning block (#19612) (camc314) - 79fe3b4 linter/prefer-mock-return-shorthand: Avoid unsafe autofixes for call-like returns (#19581) (camc314) - 85045e8 linter: Check protected members in explicit-module-boundary-types (#19594) (camc314) - e38115e linter: Catch missing return type on exported arrow/function expressions (#19587) (Peter Wagenet) - 419d3fd linter: Fix false negatives in typescript/no-require-imports (#19589) (Peter Wagenet) - 7958b56 linter: Fix syntax error reporting in some output formatters. (#19590) (connorshea) - 024f51c linter: Add help text to more eslint diagnostics (#19591) (Anthony Amaro) - a8489a1 linter: Warning `eslint/no-throw-literal` rule to be deprecated, better use `typescript/only-throw-error` (#19593) (Said Atrahouch) - 50fc70d linter/type-aware: Use correct span for disable directives (#19576) (camc314) - 421a99c linter: Add help guidance to eslint diagnostic messages (#19562) (Anthony Amaro) - e81364a linter: Add help text to eslint rule diagnostics (#19560) (Anthony Amaro) - 89b58d0 linter: Add help text to more eslint rule diagnostics (#19561) (Anthony Amaro) - 74f7833 linter/jest/prefer-mock-return-shorthand: Preserve typed arrow returns (#19556) (camc314) - bdd6f34 linter: Restrict prefer-import-in-mock to mock calls (#19555) (camc314) ### 📚 Documentation - a331993 linter: Improve docs for `eslint/radix` rule. (#19611) (connorshea) ### 🛡️ Security - c67f9dc linter: Update ajv version. (#19613) (connorshea) # Oxfmt ### 🚀 Features - 984dc07 oxfmt: Strip `"experimental"SortXxx` prefix (#19567) (leaysgur) ### 🐛 Bug Fixes - d7b63a4 oxfmt: Update API types for `sortPackageJsonOptions` (#19569) (leaysgur) Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>

No description provided.