New place to share code for use in `src-js`, similar to how `crates/oxc_config` works.
Initially, I considered creating an `apps/oxc_cli` and moving `crates/oxc_config` there. However, it felt unnatural deps for `crates/oxc_linter` -> `apps/oxc_cli`, so I decided to keep the Rust code as is for now and share only the JS code.
Since `apps/shared` exports `.ts` files directly, each app is responsible for bundling them via `@oxapps/shared`. Tests still live in `apps/shared`, so separate CI is also added and hooked by each app.
To start, I've only shared the function that reports TS incompatibility errors. This is just for verification purposes and will be fixed in a later PR.
Fixes#20416 for Oxlint
- Same `VP_VERSION` gating for config discovery, LSP file watchers, and JS config loading
- Refactor JS config loader into `resolveJsConfig` / `resolveVitePlusConfig` with shared `importConfig` + `loadConfigs`
- Split test fixtures into `vite_config_*` (non VP mode) and `vite_plus_*` (VP mode)
- Add `env` field to fixture `options.json` for passing env vars to test runs
- Fix repo `oxlintrc.json` ignore glob (`*/files/**` → `**/files/**`) for nested fixture paths like monorepo usecase
fixes#20248
This check doesn't work well in scenarios where multiplt oxlint deps may be loaded. Furthermore, the check doesn't add much additional value (my intention was to enforce that it was wrapped, so that if we needed to manipulate the object before exporting, we could) - it will still be clearly suggested in the docs that users should use define config (and it may change to being required in the future.
Closes#20228
The challenge is how to communicate from JS to Rust side when we find a `vite.config.ts` file that doesn't have a `.lint` property.
For now, I've set it to return `null`, but please let me know if you have any better alternatives.
Vite+ support for Oxlint.
- Root config only
- Not expected nested vite configs
- Auto discover `vite.config.ts` only
- Other extensions (.js, .mts, etc.) can be added later without breaking compatibility though
- This is the same as `oxlint.config.*`
- Lowest priority
- .oxlintrc.json / .oxlintrc.jsonc / oxlint.config.ts take precedence in the same directory
- `defineConfig()` check in JS is skipped for `vite.config.ts`
- I don't know the right way to handle this case
- Also work with `-c vite.config.ts`
For now, I've tried to achieve the goal with the minimum changes, and if needed, we should be able to expand support later.
closes https://github.com/oxc-project/oxc/issues/19526
> This PR fixes a bug in the LSP where JavaScript/TypeScript config files were not being reloaded when changed. The fix implements cache-busting by appending a timestamp query parameter to file URLs during import, forcing Node.js to bypass its module cache.
This isn't technically needed at this point in time, but if we consider the following, when we have support for extends
- config A extends config B (lets assume this in DIR A)
- config B specifies a JS plugin (relative path pointing to DIR C)
Without using defineConfig, and setting the paths, we have no way of knowing the directory of B.
By enforcing the use of defineConfig, we can mutate the config, to add the config dir property so the relative paths are resolved properly