Skip to content

refactor(kit)!: replace defineConfig with chainable .use().getConfig() builder API#1644

Merged
Rel1cx merged 4 commits intomainfrom
refactor/kit-chainable-use-api
Mar 27, 2026
Merged

refactor(kit)!: replace defineConfig with chainable .use().getConfig() builder API#1644
Rel1cx merged 4 commits intomainfrom
refactor/kit-chainable-use-api

Conversation

@Rel1cx
Copy link
Copy Markdown
Owner

@Rel1cx Rel1cx commented Mar 27, 2026

  • Move string-ts from devDependencies to dependencies in packages/utilities/kit/package.json so 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.

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()
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
eslint-react Ready Ready Preview, Comment Mar 27, 2026 1:11pm

Request Review

@Rel1cx Rel1cx marked this pull request as ready for review March 27, 2026 12:51
@Rel1cx Rel1cx requested a review from Copilot March 27, 2026 12:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 KitBuilder with .use() and .getConfig(); removes defineConfig and derives rule names via kebabCase(factory.name).
  • Changes RuleDefinition from { name, make } objects to a (ctx, kit) => RuleListener function 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>
@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​effect/​language-service@​0.84.0 ⏵ 0.84.195 +1100100 +198 +1100

View full report

@Rel1cx Rel1cx merged commit e9f9a83 into main Mar 27, 2026
13 checks passed
@Rel1cx Rel1cx deleted the refactor/kit-chainable-use-api branch March 27, 2026 13:14
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.

3 participants