Skip to content

feat(lint)!: write lint config as flat config - #44

Merged
liangmiQwQ merged 5 commits into
mainfrom
feat/oxlint-flat-config
Oct 17, 2026
Merged

liangmiQwQ merged 5 commits into
mainfrom
feat/oxlint-flat-config

Conversation

@liangmiQwQ

@liangmiQwQ liangmiQwQ commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

This PR moves the lint preset to oxlint-flat-config.

The lint field of liangmi() now takes an ESLint-style flat config array instead of an Oxlint config object. User objects are appended after the preset, so they override it by order instead of being deeply merged. This is a breaking change for anyone passing lint today.

export default await liangmi({
  lint: [{ files: ['packages/cli/**'], rules: { 'no-console': 'off' } }]
})
  .remove('liangmi/style')
  .override('liangmi/options', { options: { typeCheck: false } })

The methods of @oxlint-flat-config/composer (append, prepend, insertBefore, insertAfter, override, replace, remove, overrideRules, removeRules) can be chained on liangmi(). They run on the lint flat config after the user objects are appended. To support this, every preset object is named, and the base is split into one object per category, so a whole category can be removed or overridden:

  • liangmi/ignores, liangmi/options
  • liangmi/<category> (correctness, perf, suspicious, nursery, restriction, pedantic, style)
  • liangmi/<trait> (node, browser, cli, react, vue) and liangmi/<role> (test, script, config-file)
  • In a workspace, a member's objects contain its path, like liangmi/packages/cli/react

Oxlint's categories and plugins fields aren't allowed in flat config, so the enabled categories are expanded with category(). The rules each enabled category turns off are written with the same prefixed names (like eslint/no-shadow), so they override the category() output. Trait and role objects extend the categories of the plugins they used to enable. Using composer methods in a workspace member throws the same error as passing lint there.

The lint result is unchanged: I ran vp lint on probe files with deliberate violations (source, test, script and a workspace member) before and after, and the diagnostics were identical.

Limitations on the oxlint-flat-config side

  1. overrideRules / removeRules compare rule names as written. category() writes prefixed names (eslint/no-debugger), but the hand-written restriction, pedantic and style rules are mostly unprefixed (no-console). So .removeRules('no-debugger') does nothing to the rule set by liangmi/correctness.
  2. The composer only finds top-level objects. Trait plugin categories sit in extends of objects like liangmi/react, so they can't be removed on their own. You have to override or replace the whole trait object.
  3. There is no scoped plugins field. Every built-in plugin is enabled at the root, and scoped categories have to be written as category() in extends. A plugin with no rules in the selected categories (like node) still produces an empty rules: {} override.

Both packages declare vite-plus: >=1.0.0 as a peer, which 1.0.0-rc.1 doesn't satisfy under strict semver. So this PR also changes the preset's peer dependency from 1.0.0-rc.1 to >=1.0.0, and develops against 1.0.0 so CI covers the lowest supported version.

oxlint-flat-config@0.4.0 and @oxlint-flat-config/composer@0.3.1 (which add the vite-plus entries) were released today. They're added to minimumReleaseAgeExclude, along with get-oxlint-rules@0.3.1.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1
  • coderabbit-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bfa8fb43-d617-4928-a0f7-2e8648906057

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@liangmiQwQ liangmiQwQ changed the title feat(lint)!: write lint config as flat config (experimental) feat(lint)!: write lint config as flat config Oct 17, 2026
@liangmiQwQ
liangmiQwQ marked this pull request as ready for review October 17, 2026 07:24
@liangmiQwQ
liangmiQwQ merged commit 37d0651 into main Oct 17, 2026
5 checks passed
@liangmiQwQ
liangmiQwQ deleted the feat/oxlint-flat-config branch October 17, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant