Skip to content

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

Draft
fansenze wants to merge 3 commits into
mainfrom
feat/port-rule-no-deprecated-api-20260602
Draft

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

Conversation

@fansenze

@fansenze fansenze commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

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
…recated-api-20260602

# Conflicts:
#	scripts/dictionary.txt
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 2, 2026

Copy link
Copy Markdown

Deploying rslint with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1094dfc
Status: ✅  Deploy successful!
Preview URL: https://4245b04d.rslint.pages.dev
Branch Preview URL: https://feat-port-rule-no-deprecated.rslint.pages.dev

View logs

@fansenze
fansenze marked this pull request as draft August 24, 2026 03:34
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