Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(eslint-plugin): add configs.all / recommended
  • Loading branch information
JLHwung committed Jul 17, 2026
commit 2eef32253efddcab5c0064eaf06884700c4899d5
14 changes: 14 additions & 0 deletions eslint/babel-eslint-plugin/src/configs/all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { SeverityString } from "../types";

export const name = "babel/eslint-plugin/all";
export const rules: Record<string, SeverityString> = {
// ESLint core rules
"new-cap": "off",
"no-undef": "off",
"no-unused-expressions": "off",

// babel-eslint-plugin rules
"babel/new-cap": "error",
"babel/no-undef": "error",
"babel/no-unused-expressions": "error",
};
7 changes: 7 additions & 0 deletions eslint/babel-eslint-plugin/src/configs/recommended.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { SeverityString } from "../types.ts";

export const name = "babel/eslint-plugin/recommended";
export const rules: Record<string, SeverityString> = {
// ESLint core rules
// babel-eslint-plugin rules
};
10 changes: 9 additions & 1 deletion eslint/babel-eslint-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import type { ESLint, Rule } from "eslint";
import newCap from "./rules/new-cap.ts";
import noUndef from "./rules/no-undef.ts";
import noUnusedExpressions from "./rules/no-unused-expressions.ts";
import * as recommendedConfig from "./configs/recommended.ts";
import * as allConfig from "./configs/all.ts";
import type { ESLint } from "eslint";

const meta: ESLint.Plugin["meta"] = {
name: PACKAGE_JSON.name,
Expand All @@ -22,5 +25,10 @@ const rulesConfig = {
"no-unused-expressions": "off",
};

const configs = {
recommended: recommendedConfig,
all: allConfig,
};

// @ts-expect-error TODO(Babel 9): Remove rulesConfig in favor of configs
export default { meta, rules, rulesConfig } satisfies ESLint.Plugin;
export default { configs, meta, rules, rulesConfig } satisfies ESLint.Plugin;
2 changes: 2 additions & 0 deletions eslint/babel-eslint-plugin/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ export type Violation = ReportParameters[0] & { node: BabelESTreeNode };
// As of ESLint 10 the report parameters are [violation], here we pass through the rest of the parameters as well to be future proof.
export type RefinedReportParameters = [Violation, ...Tail<ReportParameters>];
type Tail<T extends any[]> = T extends [any, ...infer Rest] ? Rest : never;

export type SeverityString = "error" | "warn" | "off";