Add eslint-plugin configs#17956
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/61643 |
|
commit: |
| export const rules: Record<string, SeverityString> = { | ||
| // ESLint core rules | ||
| // babel-eslint-plugin rules | ||
| }; |
There was a problem hiding this comment.
Is there a reason for this?
There was a problem hiding this comment.
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.
7b5f938 to
b18c1d7
Compare
b18c1d7 to
801c53d
Compare
801c53d to
2f16453
Compare
There was a problem hiding this comment.
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.recommendedandconfigs.allon@babel/eslint-pluginand 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.tstests undereslint/*/testandcodemods/*/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"; | |||
| 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 = [ | ||
| { |
This PR includes commits from #17950.In this PR we add two config presets
.recommendedand.allfor the@babel/eslint-pluginvia the.configsproperty. The naming convention aligns to the official ESLint plugin@eslint/js.