Commit Graph

9 Commits

Author SHA1 Message Date
camc314 92f154a07c feat(oxlint,oxfmt): auto-discover .mts config files (#24357)
## Summary

- auto-discover `oxfmt.config.mts` and `oxlint.config.mts`
- watch `.mts` configs in the language server and reject `.ts`/`.mts` conflicts
- add focused CLI and LSP coverage
2026-07-10 11:38:35 +00:00
Sysix d86f60b61c fix(lsp): normalize user config path to watch pattern (#23723)
When a user defined a custom config path, like `fmt.configPath` or `configPath`, the watch pattern returned the same path.
VS Code does not respect this as a valid pattern and does not watch for files defined like `./define-config.ts`.
Resulting into an LSP client, which will not send a watched-file-change requests to the server, when the user edited an important config path.
2026-06-25 00:15:37 +00:00
Sysix a0c883cb90 feat(oxlint/lsp): add vite plus version to server info (#21587)
closes https://github.com/oxc-project/oxc/issues/21561
2026-04-21 01:16:30 +00:00
Sysix b0817ae645 refactor(lsp): remove Tool::name trait method (#21530)
This method was used to create unique watcher IDs for each tool.
Because `oxc_language_server::run_server` now accepts only one tool, we can safely remove this method.
2026-04-17 15:18:24 +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
Sysix cc68f49151 test(oxlint/lsp): add basic test for single file lsp mode (#20531) 2026-03-20 20:11:38 +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
Scott S. 2488a688f6 feat(linter): add .oxlintrc.jsonc config file support (#19870)
## Summary

- Teach config discovery to recognize `.oxlintrc.jsonc` alongside
`.oxlintrc.json`
- JSONC parsing already works via `json_strip_comments::strip()` in
`Oxlintrc::from_file()`, so this is purely a filename discovery change
- Prefer `.json` over `.jsonc` when both exist in the same directory
(matches oxfmt behavior)
   - Add `.oxlintrc.jsonc` to LSP file watch patterns
- Update CLI help text, error messages, and diagnostic notes to mention
`.jsonc`

   ## Changes

   | File | Change |
   |------|--------|
| `apps/oxlint/src/lib.rs` | Add `DEFAULT_JSONC_OXLINTRC_NAME` constant
|
| `apps/oxlint/src/config_loader.rs` | Update discovery functions
(`find_configs_in_directory`, `to_discovered_config`,
`try_load_config_from_dir`, `load_many`) + add tests |
| `apps/oxlint/src/lsp/server_linter.rs` | Add `.jsonc` to watch
patterns and extended path filter + update tests |
   | `apps/oxlint/src/command/lint.rs` | Update CLI help text |
   | `apps/oxlint/src/lint.rs` | Update fallback error message |

   ## Test plan

   - [x] `cargo check -p oxlint` — compiles cleanly
- [x] `cargo test -p oxlint -- test_jsonc_config_discovery` — new test:
`.oxlintrc.jsonc` is discovered and loaded
- [x] `cargo test -p oxlint -- test_json_preferred_over_jsonc` — new
test: `.json` preferred when both exist
- [x] `cargo test -p oxlint -- test_watchers` — all 10 watcher tests
pass with updated pattern counts

   Closes #19729

---------

Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2026-03-03 17:15:40 +00:00
Sysix c740e07860 test(oxlint/lsp): add init tests on js side (#18729) 2026-02-05 20:47:38 +00:00