refactor(linter/plugins): remove deprecated exports from index entry point#18828
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. |
There was a problem hiding this comment.
Pull request overview
This PR removes deprecated re-exports of definePlugin, defineRule, and RuleTester from the main oxlint package entry point (index.ts). The goal is to make importing defineConfig from the main entry point lightweight, avoiding the eager loading of approximately 20,000 lines of plugins-related JavaScript code.
Changes:
- Removed deprecated exports from
apps/oxlint/src-js/index.tsthat redirected to plugin-specific modules - These functions remain available from their proper locations:
definePluginanddefineRulefromoxlint/plugins(or@oxlint/plugins), andRuleTesterfromoxlint/plugins-dev
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5504055 to
74ad0f7
Compare
3d8c84d to
c0d26c7
Compare
74ad0f7 to
76d5efd
Compare
76d5efd to
96372ff
Compare
Merge activity
|
…y point (#18828) Remove re-exports of `definePlugin`, `defineRule` and `RuleTester` from main `index` entry point of `oxlint` package. We want this to be cheap: ```js import { defineConfig } from "oxlint"; ``` But with the deprecated exports, this would eagerly load ~20,000 lines of JS plugins-related code. See `index.js` in `dist` directory before and after this PR in release build. It was the import from `./lint.js` which was massive. Personally, I don't think we need to keep the deprecated exports, for 3 reasons: 1. We have very clearly said that JS plugins are experimental and that breaking changes are very possible. 2. Given how broken our types are at present, probably few people were using `definePlugin` and `defineRule` anyway! 3. The fix for users who do get broken is trivial: ```diff - import { definePlugin } from "oxlint"; + import { definePlugin } from "@oxlint/plugins"; ```
96372ff to
b7416d0
Compare
Continuation of #18824, #18828, #18903. Remove the `oxlint/plugins` export and the `plugins.ts` entry point. These are now only used in tests, where the files can be loaded from `dist-pkg-plugins` instead. We don't want to encourage people to use `oxlint/plugins` in their plugins - they should be using `@oxlint/plugins` package instead to avoid their plugin having a dependency on `oxlint`. Due to less shared dependencies between files, this results in 5 less files in `dist` directory in release build. This also allows re-enabling the debug assertions in this code in tests.

Remove re-exports of
definePlugin,defineRuleandRuleTesterfrom mainindexentry point ofoxlintpackage.We want this to be cheap:
But with the deprecated exports, this would eagerly load ~20,000 lines of JS plugins-related code. See
index.jsindistdirectory before and after this PR in release build. It was the import from./lint.jswhich was massive.Personally, I don't think we need to keep the deprecated exports, for 3 reasons:
definePluginanddefineRuleanyway!