Commit Graph

20 Commits

Author SHA1 Message Date
Boshen 1193c9dbaf chore(oxfmt): dogfood operator position at line start (#25937)
dogfood
2026-08-20 14:36:47 +00:00
overlookmotel 1f965341ba refactor(linter/config): do not import from globals.ts manually (#22927)
There's no need to import globals from `globals.ts` manually. TSDown plugin does this transform automatically. (I sense the hand of an LLM here)
2026-06-03 00:53:31 +00:00
leaysgur 1ccaf767d6 refactor(oxlint,oxfmt): Fix up apps/shared usage (#22457)
Final clean up.

- Share `isObject()` function
- Clean up directory structure
- Use `Error.cause` for TS hint error
2026-05-20 08:21:39 +00:00
leaysgur 2d4c9194bd feat(oxlint): Support vite-plus/resolveConfig for vite.config.ts (#22456)
Fixes #21417 and #21057

Now Oxlint can use the common functions defined in `shared` as well.
2026-05-20 08:21:38 +00:00
leaysgur dcc6d38330 refactor(oxlint,oxfmt): Use shared/importJsConfig for js config (#22453)
Consolidate the following parts:

- Using native `import()`s
- Specifying `cacheKey`
- Extracting default exports
- Returning hints for TS incompatibility errors
2026-05-18 08:05:48 +00:00
leaysgur 37d49fcd40 refactor(oxlint,oxfmt): Share src-js code via apps/shared (#22452)
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.
2026-05-18 07:56:26 +00:00
leaysgur f99ecdaa76 feat(oxlint): Gate vite.config.ts recognition behind VP_VERSION env var (#21298)
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
2026-04-13 01:10:46 +00:00
camc314 27374e8f14 feat(linter): add hint about node version when ts config fail to import (#20570)
fixes #20467

I tested this locally:

```
Failed to parse oxlint configuration file.

  x Failed to load config: <fixture>/oxlint.config.ts
  |
  | TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for <fixture>/oxlint.config.ts
  |
  | TypeScript config files require Node.js ^20.19.0 || >=22.12.0.
  | Detected Node.js v22.11.0.
  | Please upgrade Node.js or use a JSON config file instead.
```
2026-03-25 20:13:29 +00:00
camc314 a4b61f78d0 fix(linter): remove defineConfig check (#20308)
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.
2026-03-12 20:37:55 +00:00
leaysgur 4ea67decf5 fix(oxlint,oxfmt): Skip vite.config.ts exports defineConfig(fn) (#20260)
`vite.config.ts` may return function from `defineConfig(({ mode }) => ({ ... }))`, but we can't evaluate.

Just skip it like no `.lint|fmt` config.
2026-03-12 04:56:57 +00:00
leaysgur 5eb99911cd refactor(oxlint): extract vite lint config in JS loader (#20256)
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.
2026-03-12 04:14:26 +00:00
leaysgur 04a5ce0bc2 feat(oxlint): Support vite.config.ts .lint field (#20214)
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.
2026-03-11 04:34:48 +00:00
Sysix 87318e72fd fix(oxlint/lsp): load js config with reforcing fs read (#19551)
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.
2026-03-03 18:35:12 +00:00
camc314 7a333c13a0 feat(linter): support dynamic configs via CLI arguments (#19384) 2026-02-14 14:51:55 +00:00
camc314 bb1eb97e18 feat(linter): improve diagnostic message for circular configs (#18947) 2026-02-04 17:10:41 +00:00
camc314 749972f2df feat(linter): validate dynamic config extends shape (#18943) 2026-02-04 17:10:40 +00:00
camc314 b23395af07 feat(linter): enforce exporting an object with defineConfig (#18858)
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
2026-02-02 15:30:50 +00:00
camc314 c879992bfd fix(linter): error on arrays passed in as config (#18822)
see https://github.com/oxc-project/oxc/issues/18821
2026-02-02 00:46:50 +00:00
camc314 ea97231b3f feat(linter): implement oxlint.config.ts support (#17563)
Refs: https://github.com/oxc-project/oxc/issues/17527

note: this does not include language server support
2026-02-01 23:10:54 +00:00
camc314 772ea7082c feat(linter): introduce load_js_configs napi callback (#18767) 2026-01-31 13:57:35 +00:00