refactor(kit)!: replace defineConfig with chainable .use().getConfig() builder API#1644
Merged
refactor(kit)!: replace defineConfig with chainable .use().getConfig() builder API#1644
defineConfig with chainable .use().getConfig() builder API#1644Conversation
BREAKING CHANGE: The default export of `@eslint-react/kit` is now
`eslintReactKit()` which returns a `KitBuilder` with `.use()` and
`.getConfig()` methods. The `defineConfig` named export is removed.
`RuleDefinition` is changed from `{ name, make }` interface to a
`(ctx, kit) => RuleListener` type alias. Rule names are derived
automatically via `kebabCase(factory.name)`.
Migration:
eslintReactKit(rule1(), rule2())
→
eslintReactKit()
.use(rule1)
.use(ruleWithOptions, { ... })
.getConfig()
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors @eslint-react/kit to replace the defineConfig API with a chainable builder (eslintReactKit().use(...).getConfig()), and updates examples and documentation to match the new usage and rule definition shape.
Changes:
- Introduces
KitBuilderwith.use()and.getConfig(); removesdefineConfigand derives rule names viakebabCase(factory.name). - Changes
RuleDefinitionfrom{ name, make }objects to a(ctx, kit) => RuleListenerfunction type (returned by rule factories). - Updates kit docs, website docs, and example configs/rules to use the new builder API.
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds lockfile entry for newly used string-ts. |
| packages/utilities/kit/src/index.ts | Implements the new eslintReactKit() builder API and auto rule-name derivation. |
| packages/utilities/kit/package.json | Adds string-ts dependency (currently under devDependencies). |
| packages/utilities/kit/docs/type-aliases/RuleDefinition.md | Documents new RuleDefinition type alias. |
| packages/utilities/kit/docs/interfaces/RuleDefinition.md | Removes old RuleDefinition interface docs. |
| packages/utilities/kit/docs/interfaces/KitBuilder.md | Adds docs for KitBuilder. |
| packages/utilities/kit/docs/functions/defineConfig.md | Removes docs for defineConfig. |
| packages/utilities/kit/docs/functions/default.md | Adds docs for the new default export. |
| packages/utilities/kit/docs/README.md | Updates API reference index for new exports. |
| packages/utilities/kit/README.md | Updates README to builder API and new rule-definition approach. |
| examples/react-dom-with-custom-rules/eslint.config.ts | Migrates example config to .use(...).getConfig() builder usage. |
| examples/react-dom-with-custom-rules/.config/rules/*.ts | Migrates example custom rules to the new rule factory + RuleDefinition function type. |
| apps/website/content/docs/migrating-from-eslint-plugin-react.mdx | Updates migration guide snippets to new builder API. |
| apps/website/content/docs/configuration/configure-project-rules.mdx | Updates project-rules documentation to new builder API. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: REL1CX <solarflarex@qq.com>
Agent-Logs-Url: https://github.com/Rel1cx/eslint-react/sessions/762518a7-d6a4-4590-92ad-6c5a3e3d33aa Co-authored-by: Rel1cx <24217275+Rel1cx@users.noreply.github.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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.
string-tsfromdevDependenciestodependenciesinpackages/utilities/kit/package.jsonso consumers get it when installing@eslint-react/kit⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.