Repository navigation
feat(lint)!: write lint config as flat config - #44
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
liangmiQwQ
marked this pull request as ready for review
October 17, 2026 07:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves the lint preset to
oxlint-flat-config.The
lintfield ofliangmi()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 passinglinttoday.The methods of
@oxlint-flat-config/composer(append,prepend,insertBefore,insertAfter,override,replace,remove,overrideRules,removeRules) can be chained onliangmi(). They run on thelintflat 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/optionsliangmi/<category>(correctness,perf,suspicious,nursery,restriction,pedantic,style)liangmi/<trait>(node,browser,cli,react,vue) andliangmi/<role>(test,script,config-file)liangmi/packages/cli/reactOxlint's
categoriesandpluginsfields aren't allowed in flat config, so the enabled categories are expanded withcategory(). The rules each enabled category turns off are written with the same prefixed names (likeeslint/no-shadow), so they override thecategory()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 passinglintthere.The lint result is unchanged: I ran
vp linton 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-configsideoverrideRules/removeRulescompare rule names as written.category()writes prefixed names (eslint/no-debugger), but the hand-writtenrestriction,pedanticandstylerules are mostly unprefixed (no-console). So.removeRules('no-debugger')does nothing to the rule set byliangmi/correctness.extendsof objects likeliangmi/react, so they can't be removed on their own. You have tooverrideorreplacethe whole trait object.pluginsfield. Every built-in plugin is enabled at the root, and scoped categories have to be written ascategory()inextends. A plugin with no rules in the selected categories (likenode) still produces an emptyrules: {}override.Both packages declare
vite-plus: >=1.0.0as a peer, which1.0.0-rc.1doesn't satisfy under strict semver. So this PR also changes the preset's peer dependency from1.0.0-rc.1to>=1.0.0, and develops against1.0.0so CI covers the lowest supported version.oxlint-flat-config@0.4.0and@oxlint-flat-config/composer@0.3.1(which add thevite-plusentries) were released today. They're added tominimumReleaseAgeExclude, along withget-oxlint-rules@0.3.1.🤖 Generated with Claude Code