feat(cli): enforce vite-plus import lint rule#1408
feat(cli): enforce vite-plus import lint rule#1408Han5991 wants to merge 10 commits intovoidzero-dev:mainfrom
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
1fe3184 to
3a43e6d
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7eceea6afe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Awesome, the import rewrite logic can be completely replaced with the oxlint plugin. |
Makes sense. I focused this PR on the unsafe rewrite fix first, and I can move the remaining import rewrite logic into the oxlint plugin in a follow-up. |
| preferVitePlusImports: "Use '{{to}}' instead of '{{from}}' in Vite+ projects.", | ||
| }, | ||
| }, | ||
| create(context: any) { |
There was a problem hiding this comment.
it would be ideal to use createOnce over create due to its perf advantages
There was a problem hiding this comment.
BTW: @camc314 We need an oxlint plugin rule to guide us on how to write good oxlint plugins 😃
| }, | ||
| }; | ||
|
|
||
| const plugin = { |
There was a problem hiding this comment.
same, this should probably use definePlugin and defineRule from oxlint
There was a problem hiding this comment.
definePlugin / defineRule don't appear to be publicly available in the oxlint@1.60.0 version used here, so I don't think we can switch this to those helpers yet.
There was a problem hiding this comment.
Ah we'll need to use https://npmx.dev/package-code/@oxlint/plugins/v/1.60.0/index.js
There was a problem hiding this comment.
@oxlint/plugins isn't installed in this repo right now, so we can't use eslintCompatPlugin here yet. If we want to switch to that API, we'd need to add it as a runtime dependency first.
camc314
left a comment
There was a problem hiding this comment.
This looks good! but we should definitely use oxlint's types rather than handrolling it, it duplicates code, and might cause issues in future!
Summary
vite/vitestimports tovite-pluslintconfigTesting
command-init-inline-configandlint-vite-plus-importsCloses #1301