Skip to content

Add eslint-plugin configs#17956

Open
JLHwung wants to merge 5 commits into
babel:mainfrom
JLHwung:add-eslint-plugin-presets
Open

Add eslint-plugin configs#17956
JLHwung wants to merge 5 commits into
babel:mainfrom
JLHwung:add-eslint-plugin-presets

Conversation

@JLHwung
Copy link
Copy Markdown
Contributor

@JLHwung JLHwung commented Apr 28, 2026

Q                       A
Fixed Issues?
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This PR includes commits from #17950.

In this PR we add two config presets .recommended and .all for the @babel/eslint-plugin via the .configs property. The naming convention aligns to the official ESLint plugin @eslint/js.

@JLHwung JLHwung added PR: New Feature 🚀 A type of pull request used for our changelog categories PR: Needs Docs area: eslint labels Apr 28, 2026
@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Apr 28, 2026

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/61643

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 28, 2026

Open in StackBlitz

commit: 070a740

Comment on lines +4 to +7
export const rules: Record<string, SeverityString> = {
// ESLint core rules
// babel-eslint-plugin rules
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question. The recommended set is empty because none of official ESLint rules that we replaced are in the @eslint/js recommended set. However, if we add new rules in the future, the recommended set may add new rules. The placeholder is here such that we don't have to remove and add back the recommended set.

@JLHwung JLHwung force-pushed the add-eslint-plugin-presets branch 2 times, most recently from 7b5f938 to b18c1d7 Compare May 2, 2026 02:31
@JLHwung JLHwung force-pushed the add-eslint-plugin-presets branch from b18c1d7 to 801c53d Compare May 11, 2026 13:14
@JLHwung JLHwung force-pushed the add-eslint-plugin-presets branch from 801c53d to 2f16453 Compare May 21, 2026 14:32
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 adds configs presets to @babel/eslint-plugin (intended to mirror the naming style of @eslint/js) and wires up the repo’s type-testing setup so the new eslint/codemods .tst.ts tests are included in TypeScript + Tstyche runs.

Changes:

  • Expose configs.recommended and configs.all on @babel/eslint-plugin and add corresponding config modules.
  • Add a Tstyche type test to validate the plugin’s exported shape (meta, rules, configs).
  • Expand Tstyche/TS/ESLint config globs to include .tst.ts tests under eslint/*/test and codemods/*/test.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tstyche.json Expands Tstyche test glob to include codemods/ and eslint/ packages.
tsconfig.json Includes codemods/*/test/*.tst.ts and eslint/*/test/*.tst.ts in TS project includes.
scripts/generators/tsconfig.ts Keeps the generated tsconfig.json in sync with the new .tst.ts include patterns.
eslint/babel-eslint-plugin/test/index.tst.ts Adds type-level validation for the plugin’s meta/rules/configs exports.
eslint/babel-eslint-plugin/src/types.ts Adds a SeverityString helper type for config rule severities.
eslint/babel-eslint-plugin/src/index.ts Exposes configs on the plugin export and imports the new preset modules.
eslint/babel-eslint-plugin/src/configs/recommended.ts Introduces the recommended config preset module.
eslint/babel-eslint-plugin/src/configs/all.ts Introduces the all config preset module defining rule severity mappings.
eslint.config.ts Updates lint config file globs to include the new .tst.ts test locations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,14 @@
import type { SeverityString } from "../types";
Comment thread eslint/babel-eslint-plugin/src/configs/recommended.ts
Comment on lines +20 to +25
const config = [plugin.configs.recommended, plugin.configs.all];
expect(config).type.toBeAssignableTo<Linter.Config[]>();
});
it("configs can be used in a config array with overrides", () => {
const config = [
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: eslint PR: Needs Docs PR: New Feature 🚀 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants