Skip to content

feat: port rule n/no-deprecated-api#1042

Open
fansenze wants to merge 1 commit into
mainfrom
feat/port-rule-no-deprecated-api-20260602
Open

feat: port rule n/no-deprecated-api#1042
fansenze wants to merge 1 commit into
mainfrom
feat/port-rule-no-deprecated-api-20260602

Conversation

@fansenze
Copy link
Copy Markdown
Contributor

@fansenze fansenze commented Jun 2, 2026

Summary

Port the n/no-deprecated-api rule from eslint-plugin-n (v18.0.1) to rslint, adding a new n plugin with its first rule.

It flags deprecated Node.js APIs: deprecated builtin modules, deprecated members reached via require() / ESM import / process.getBuiltinModule() (including intermediate variables and destructuring), and deprecated globals (new Buffer(), Intl.v8BreakIterator, …). node: specifiers are normalized to the bare form.

Implementation notes

  • Reimplements @eslint-community/eslint-utils's ReferenceTracker on the tsgo AST (rslint has no ESLint scope manager). Binding-reference tracking prefers TypeChecker symbol identity and falls back to AST scope analysis when no type information is available.
  • The deprecated-API data table is a 1:1 port of upstream's rawModules + globals, verified by a full dump-diff (115 (path, type, since, removed, replacedBy) entries identical).
  • Constant folding of module specifiers / member keys reuses tsgo's own evaluator.
  • version option and settings.n|node.version are supported; package.json engines.node / devEngines inference is not (documented in the rule's .md).

Validation

  • Go suite: full upstream valid/invalid migration (*_upstream_test.go) plus edge-shape, branch lock-in, and real-user cases (*_extras_test.go).
  • JS suite mirrors the Layer-1 upstream cases over IPC.
  • Differential run vs eslint-plugin-n: rsbuild (1935 files, 0 reports — clean) and rspack (14250 files, 82 reports, each manually verified as correct).

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@fansenze fansenze force-pushed the feat/port-rule-no-deprecated-api-20260602 branch from 54a6d5a to 758de37 Compare June 2, 2026 07:55
@fansenze fansenze force-pushed the feat/port-rule-no-deprecated-api-20260602 branch from 758de37 to 639e353 Compare June 2, 2026 08:00
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