Commit Graph

21 Commits

Author SHA1 Message Date
camc314 4004c101ca fix(linter/eslint/no-irregular-whitespace): check comments by default (#25660)
## Summary

- align the skipComments default with ESLint
- report irregular whitespace in line and block comments by default
- preserve the skipComments: true opt-out
- verify suppressed comment diagnostics count disable directives as used
- regenerate the published configuration schema

Fixes #25616.
2026-08-14 12:59:55 +00:00
leaysgur e81b2ff6c5 fix(oxlint,oxfmt): report error for invalid glob patterns (#24744)
Fixes #24612

- Update `fast-glob` to `1.1.0` which exposes `validate()` api
- Use it in `oxc_config`, apps will be validated through `deserialize`
- Oxfmt supports globs for CLI paths, also validated
2026-07-21 04:43:49 +00:00
camc314 e6d5cfe503 test(oxlint): remove redundant ignore pattern CLI test (#24353)
## Summary

- remove the platform-dependent CLI snapshot test for parent-directory ignore patterns
- remove the dedicated CLI fixtures and snapshot
- rely on the existing `oxc_config` unit tests for pattern semantics and the existing `ConfigStoreBuilder` test for Oxlint integration
2026-07-10 09:50:52 +00:00
leaysgur 83378351e4 fix(linter): error on ignorePatterns that cannot match files aoutside the config directory (#24341)
Follow up on #24339

- Added the same guard as Oxfmt
- Since they are identical, I moved them into `oxc_config` so they can be shared
2026-07-10 09:05:48 +00:00
leaysgur 2ce5a33ecc fix(linter): resolve ignorePatterns relative to the config dir (#24339)
Fixes #24310

Root config's `ignorePatterns` are now resolved relative to the directory containing the config file, instead of CWD.

Also fixes a latent issue: a `--config <path>` containing `..` silently disabled all `ignorePatterns` (the unnormalized parent dir never prefix-matches lint target paths). Explicit config paths are now lexically normalized, same as Oxfmt.

### Behavior change

The new anchoring applies in all cases, including `--config` / LSP `configPath`. This intentionally differs from ESLint, which resolves alternate-config ignore patterns relative to CWD:

- `extends`, `overrides[].files`, and JS plugin specifiers are already config-file-relative, including via `--config`
  - rooting only `ignorePatterns` at CWD would give one file two coordinate systems
- Wrappers like Vite+ pass `--config <workspace-root config>` as an implementation detail while CWD stays at the invocation directory, so "`--config` means CWD-relative" does not hold in practice
  - #24276

Impact should be small: bare names (`dist`, `*.min.js`) and `**/`-prefixed patterns are unaffected by the anchor.

The updated `config_ignore_patterns/with_oxlintrc` snapshot shows the `--config` case.
2026-07-10 08:39:56 +00:00
Sysix 6b50f23ac4 fix(oxlint/cli): load root config by searching up parent directories (#22272)
Allow users to run `oxlint` in a sub package, when the monorepo has a base config.

Example:
`cd project/packages/pack-a && oxlint`

Now it detects the config from `project/.oxlintrc.json`, aligning how the LSP side works.
Aligns too how oxfmt searches config path.

closes https://github.com/oxc-project/oxc/issues/21533
found in https://github.com/voidzero-dev/vite-plus/pull/1378#discussion_r3078146663
2026-05-11 08:09:18 +00:00
Sysix 080d90ed6a fix(linter): move no-debugger fix to suggestion (#22256)
`console.log` and `debugger;` are utils while developing.
`console.log` is already a suggestion (aligned with ESLint), but `no-debugger` would be autofixed too.
ESLint does not have a fixer for his rule, but we do.

This is a part of #22195, where do not autofix suggestions on the editor side, aligning with ESLint.
`debugger;` should not be autofixed on save.
2026-05-09 10:20:33 +00:00
Sysix 8b4829b04d feat(linter): split no-negated-condition rule to unicorn & eslint (#21998)
>## Pull request overview

> Splits the previously shared `no-negated-condition` implementation into distinct `eslint/no-negated-condition` and `unicorn/no-negated-condition` rules while reusing a shared implementation module, and removes the now-unneeded unicorn↔eslint aliasing in config and rule-status tooling.

Question: Should we support `unicorn/no-named-default`? Because it is marked as not supported because it is already implemented in `import/no-named-default`.
See unicorn issue: https://github.com/oxc-project/oxc/issues/684
2026-05-01 08:12:27 +00:00
mustafa0x aace797941 fix(linter): detect Svelte TS and module scripts correctly (#20819)
## Summary
- parse Svelte <script> attributes instead of broad substring checks
- detect both module and context="module" scripts when creating partial
JS sources
- add unit and CLI coverage for module/instance scripts in both JS and
TS

## Validation
- mise x -- cargo test -p oxlint lint_svelte_
- mise x -- cargo test -p oxc_linter partial_loader::svelte

## AI usage disclosure
This PR was prepared with AI assistance (Codex). I reviewed and take
responsibility for the final changes.

---------

Co-authored-by: Cameron <cameron.clark@hey.com>
2026-04-27 10:39:04 +01:00
Sysix 8c638c505e refactor(linter): move valid-title rule to shared and crate own rule for vitest (#18467) 2026-04-25 16:23:55 +00:00
Christian Vuerings 348f46cfc1 feat(linter): add respectEslintDisableDirectives option (#21384)
## Summary
- add a root-only `options.respectEslintDisableDirectives` config option
- make directive parsing and `reportUnusedDisableDirectives` honor that
switch
- preserve current behavior by default with `true`
- regenerate the schema / generated TS config types and add CLI + unit
coverage

## Proposal
Use a boolean option to control whether oxlint recognizes ESLint-style
disable directives:

```json
{
  "options": {
    "respectEslintDisableDirectives": false
  }
}
```

Behavior:
- unset or `true`: oxlint recognizes both `oxlint-*` and `eslint-*`
- `false`: oxlint only recognizes `oxlint-*`

This also applies to `reportUnusedDisableDirectives`.

## Notes
- unused-directive diagnostics now report the actual matched prefix
(`oxlint-disable` vs `eslint-disable`) instead of always saying
`eslint-disable`
- the option is root-only, consistent with the other global `options.*`
switches in the config loader

closes https://github.com/oxc-project/oxc/pull/20447
fixes https://github.com/oxc-project/oxc/issues/20375

---------

Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2026-04-23 13:30:47 +01:00
camc314 ae4531269f feat(linter): introduce --type-check-only flag (#21184) 2026-04-08 17:20:40 +00:00
bab af8e12202a fix(linter): render each config error as a separate diagnostic (#21120)
closes https://github.com/oxc-project/oxc/issues/21094

Co-authored-by: Cameron <cameron.clark@hey.com>
2026-04-08 16:45:19 +01:00
camc314 7354f3cd64 feat(linter)!: error on no matched files (#21144) 2026-04-07 21:10:31 +00:00
camc314 5ed854fc02 test(linter): typecheck files even when zero rules are enabled (#21117)
not sure we had test coverage here previously, but it's important this case doesn't regress
2026-04-07 10:22:51 +00:00
Sysix 21133291cf test(oxlint): add test for nested config with cwd (#21050)
Added a test to show the bug in https://github.com/oxc-project/oxc/issues/21030 and https://github.com/oxc-project/oxc/issues/20904,
2026-04-05 11:49:55 +00:00
camc314 0b84de1c1a feat(oxlint): support allow option for prefer-promise-reject-errors (#20934)
Add the TypeScript rule config surface for the new `allow` specifier option and extend the oxlint CLI fixture to verify the option end to end.

Tested with:
- `cargo test -p oxc_linter prefer_promise_reject_errors -- --nocapture`
- `cargo test -p oxlint test_tsgolint_rule_options -- --nocapture`
- `node --run fmt`

AI usage disclosure: Codex was used to implement the config support, add the CLI fixture coverage, and prepare this PR. The changes were reviewed in the local workspace before submission.
2026-04-01 14:50:20 +00:00
renovate 382a469337 chore(deps): update dependency oxlint-tsgolint to v0.18.0 (#20798)
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|---|---|
| [oxlint-tsgolint](https://redirect.github.com/oxc-project/tsgolint) | [`0.17.4` → `0.18.0`](https://renovatebot.com/diffs/npm/oxlint-tsgolint/0.17.4/0.18.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/oxlint-tsgolint/0.18.0?slim=true) | ![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/oxlint-tsgolint/0.18.0?slim=true) | ![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/oxlint-tsgolint/0.17.4/0.18.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/oxlint-tsgolint/0.17.4/0.18.0?slim=true) |

---

### Release Notes

<details>
<summary>oxc-project/tsgolint (oxlint-tsgolint)</summary>

### [`v0.18.0`](https://redirect.github.com/oxc-project/tsgolint/releases/tag/v0.18.0)

[Compare Source](https://redirect.github.com/oxc-project/tsgolint/compare/v0.17.4...v0.18.0)

#### What's Changed

- fix(lint): suppress unparam on toStaticValue by [@&#8203;camc314](https://redirect.github.com/camc314) in [#&#8203;834](https://redirect.github.com/oxc-project/tsgolint/pull/834)
- fix(promise-function-async): place async fix after export modifiers by [@&#8203;camc314](https://redirect.github.com/camc314) in [#&#8203;839](https://redirect.github.com/oxc-project/tsgolint/pull/839)
- chore: improve assertion diagnostic msg by [@&#8203;camc314](https://redirect.github.com/camc314) in [#&#8203;842](https://redirect.github.com/oxc-project/tsgolint/pull/842)
- fix(dot-notation): ignore non-ascii property names by [@&#8203;camc314](https://redirect.github.com/camc314) in [#&#8203;840](https://redirect.github.com/oxc-project/tsgolint/pull/840)
- chore: update typescript-go submodule by [@&#8203;camc314](https://redirect.github.com/camc314) in [#&#8203;841](https://redirect.github.com/oxc-project/tsgolint/pull/841)

**Full Changelog**: <https://github.com/oxc-project/tsgolint/compare/v0.17.4...v0.18.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My45My4wIiwidXBkYXRlZEluVmVyIjoiNDMuOTMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
2026-03-27 13:27:56 +00:00
camc314 c0ebbce18c feat(linter)!: report error on unknown builtin rule (#20464) 2026-03-25 21:47:06 +00:00
camc314 0c57312607 fix(tsgolint): use primary span for the disable directive (#20436)
fixes https://github.com/oxc-project/tsgolint/issues/769
2026-03-16 19:52:22 +00:00
Sysix 065a358c90 test(oxlint): move non lsp fixtures to fixtures/cli (#20044)
Now there are only two folders in `apps/oxlint/fixtures`.
We can later create another directory for both integrations (like config walker).
2026-03-06 12:12:54 +00:00