Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .pkgs/eslint-plugin-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"tsup": "^8.4.0"
},
"peerDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@eslint/markdown": "^6.4.0",
"@local/configs": "workspace:*",
"@mdx-js/mdx": "^3.1.0",
"@tailwindcss/postcss": "^4.1.4",
"@tailwindcss/postcss": "^4.1.5",
"@theguild/remark-mermaid": "^0.3.0",
"@tsconfig/next": "^2.0.3",
"@tsconfig/node22": "^22.0.1",
Expand All @@ -46,7 +46,7 @@
"@types/mdx": "^2.0.13",
"@types/node": "^22.15.3",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"autoprefixer": "^10.4.21",
"dedent": "^1.5.3",
"eslint": "^9.25.1",
Expand All @@ -58,7 +58,7 @@
"eslint-plugin-unicorn": "^59.0.0",
"importx": "^0.5.2",
"postcss": "^8.5.3",
"tailwindcss": "^4.1.4",
"tailwindcss": "^4.1.5",
"tailwindcss-animated": "^2.0.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.31.1"
Expand Down
2 changes: 1 addition & 1 deletion examples/next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@tsconfig/strictest": "^2.0.5",
"@types/node": "^22.15.3",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"eslint": "^9.25.1",
"eslint-config-flat-gitignore": "^2.1.0",
"eslint-plugin-react-hooks": "^5.2.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/vite-react-dom-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"@tsconfig/strictest": "^2.0.5",
"@tsconfig/vite-react": "^3.4.0",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"@vitejs/plugin-react": "^4.4.1",
"eslint": "^9.25.1",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"typescript": "^5.8.3",
"typescript-eslint": "^8.31.1",
"vite": "^6.3.3"
"vite": "^6.3.4"
},
"engines": {
"node": ">=20.19.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/vite-react-dom-js-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
"@eslint/config-inspector": "^1.0.2",
"@eslint/js": "^9.25.1",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"@vitejs/plugin-react": "^4.4.1",
"eslint": "^9.25.1",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.0.0",
"vite": "^6.3.3"
"vite": "^6.3.4"
},
"engines": {
"node": ">=20.19.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
"react-dom": "^19.1.0"
},
"devDependencies": {
"@babel/core": "^7.26.10",
"@babel/eslint-parser": "^7.27.0",
"@babel/preset-env": "^7.26.9",
"@babel/preset-react": "^7.26.3",
"@babel/core": "^7.27.1",
"@babel/eslint-parser": "^7.27.1",
"@babel/preset-env": "^7.27.1",
"@babel/preset-react": "^7.27.1",
"@eslint/config-inspector": "^1.0.2",
"@eslint/js": "^9.25.1",
"@types/babel__core": "~7.20.5",
"@types/babel__preset-env": "~7.10.0",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"@vitejs/plugin-react": "^4.4.1",
"eslint": "^9.25.1",
"eslint-plugin-react-debug": "workspace:*",
Expand All @@ -35,7 +35,7 @@
"eslint-plugin-react-web-api": "workspace:*",
"eslint-plugin-react-x": "workspace:*",
"globals": "^16.0.0",
"vite": "^6.3.3"
"vite": "^6.3.4"
},
"engines": {
"node": ">=20.19.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@tsconfig/strictest": "^2.0.5",
"@tsconfig/vite-react": "^3.4.0",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"@vitejs/plugin-react": "^4.4.1",
"eslint": "^9.25.1",
"eslint-plugin-react-hooks": "^5.2.0",
Expand All @@ -33,7 +33,7 @@
"ts-blank-eslint-parser": "^0.4.3",
"typescript": "^5.8.3",
"typescript-eslint": "^8.31.1",
"vite": "^6.3.3"
"vite": "^6.3.4"
},
"engines": {
"node": ">=20.19.0"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@tsconfig/strictest": "^2.0.5",
"@types/node": "^22.15.3",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"@typescript-eslint/parser": "^8.31.1",
"@typescript-eslint/rule-tester": "^8.31.1",
"@typescript-eslint/types": "^8.31.1",
Expand Down Expand Up @@ -109,7 +109,7 @@
],
"overrides": {
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"cross-spawn": "^7.0.6",
"esbuild": "^0.25.3",
"lucide-react": "^0.503.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/is-react-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function isReactAPI(api: string): isReactAPI.ReturnType {
{
if (node == null) return false;
const getText = (n: TSESTree.Node) => context.sourceCode.getText(n);
const name = AST.toString(node, getText);
const name = AST.toStringFormat(node, getText);
if (name === api) return true;
if (name.substring(name.indexOf(".") + 1) === api) return true;
return false;
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"tsup": "^8.4.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"tsup": "^8.4.0"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"tsup": "^8.4.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-web-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"tsup": "^8.4.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-x/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react-dom": "^19.1.3",
"ts-api-utils": "^2.1.0",
"tsup": "^8.4.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ export function useNoDirectSetStateInUseEffect<Ctx extends RuleContext>(

function getCallName(node: TSESTree.Node) {
if (node.type === T.CallExpression) {
return AST.toString(node.callee, getText);
return AST.toStringFormat(node.callee, getText);
}
return AST.toString(node, getText);
return AST.toStringFormat(node, getText);
}

function getCallKind(node: TSESTree.CallExpression) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
messageId: "unstableContextValue",
node: constructionNode,
data: {
type: AST.toDelimiterCaseType(constructionNode),
type: AST.toDelimiterFormat(constructionNode),
suggestion,
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
if (ER.isReactHookCall(construction.node)) {
continue;
}
const forbiddenType = AST.toDelimiterCaseType(right);
const forbiddenType = AST.toDelimiterFormat(right);
context.report({
messageId: "noUnstableDefaultProps",
node: right,
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@eslint-react/eff": "workspace:*",
"@eslint-react/kit": "workspace:*",
"@typescript-eslint/utils": "^8.31.1",
"@zod/mini": "^4.0.0-beta.20250424T163858",
"@zod/mini": "^4.0.0-beta.20250430T185432",
"ts-pattern": "^5.7.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/ast/src/__tests__/ast-class-id.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TSESTreeClass } from "../ast-node";
import type { TSESTreeClass } from "../ast-node-types";

import path from "node:path";
import { parseForESLint } from "@typescript-eslint/parser";
Expand Down
4 changes: 2 additions & 2 deletions packages/utilities/ast/src/__tests__/ast-function-id.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TSESTreeFunction } from "../ast-node";
import type { TSESTreeFunction } from "../ast-node-types";

import path from "node:path";
import { parseForESLint } from "@typescript-eslint/parser";
Expand All @@ -8,7 +8,7 @@ import { simpleTraverse } from "@typescript-eslint/typescript-estree";
import { describe, expect, it } from "vitest";
import { getFixturesRootDir } from "../../../../../test";
import { getFunctionId } from "../ast-function-id";
import { isFunction } from "../ast-is";
import { isFunction } from "../ast-node-is";

function parse(code: string) {
return parseForESLint(code, {
Expand Down
4 changes: 2 additions & 2 deletions packages/utilities/ast/src/__tests__/ast-hierarchy.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TSESTreeFunction } from "../ast-node";
import type { TSESTreeFunction } from "../ast-node-types";

import path from "node:path";
import { parseForESLint } from "@typescript-eslint/parser";
Expand All @@ -9,7 +9,7 @@ import tsx from "dedent";
import { describe, expect, it } from "vitest";
import { getFixturesRootDir } from "../../../../../test";
import { getNestedReturnStatements } from "../ast-hierarchy";
import { isFunction } from "../ast-is";
import { isFunction } from "../ast-node-is";

function parse(code: string) {
return parseForESLint(code, {
Expand Down
13 changes: 0 additions & 13 deletions packages/utilities/ast/src/ast-array-pattern.ts

This file was deleted.

7 changes: 1 addition & 6 deletions packages/utilities/ast/src/ast-class-id.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import type { TSESTree } from "@typescript-eslint/types";
import type { TSESTreeClass } from "./ast-node";
import type { TSESTreeClass } from "./ast-node-types";
import { _ } from "@eslint-react/eff";

import { AST_NODE_TYPES as T } from "@typescript-eslint/types";

/**
* Gets class identifier from ClassDeclaration or ClassExpression
* @param node The AST node to check
* @returns class identifier or null
*/
export function getClassId(node: TSESTreeClass): TSESTree.Identifier | _ {
if (node.id != null) return node.id;
if (node.parent.type === T.VariableDeclarator && node.parent.id.type === T.Identifier) {
Expand Down
4 changes: 2 additions & 2 deletions packages/utilities/ast/src/ast-expression.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { TSESTree } from "@typescript-eslint/types";
import type { TSESTreeTypeExpression } from "./ast-node";
import type { TSESTreeTypeExpression } from "./ast-node-types";

import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
import { isTypeExpression } from "./ast-is";
import { isTypeExpression } from "./ast-node-is";

/**
* Recursively get the inner expression until it's not a TypeExpression
Expand Down
16 changes: 8 additions & 8 deletions packages/utilities/ast/src/ast-function-id.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/* eslint-disable jsdoc/require-param */
import type { TSESTree } from "@typescript-eslint/types";
import type { TSESTreeFunction } from "./ast-node-types";
import { _ } from "@eslint-react/eff";

import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
import { isMethodOrProperty, isTypeAssertionExpression } from "./ast-node-is";

// Ported from https://github.com/eps1lon/react/blob/8b8d265bd9a4cab7bbd04a9a13950fdc946ea51c/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js#L642
/**
* Gets the static name of a function AST node. For function declarations it is
Expand All @@ -6,14 +14,6 @@
* where JS gives anonymous function expressions names. We roughly detect the
* same AST nodes with some exceptions to better fit our use case.
*/

import type { TSESTree } from "@typescript-eslint/types";
import type { TSESTreeFunction } from "./ast-node";
import { _ } from "@eslint-react/eff";

import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
import { isMethodOrProperty, isTypeAssertionExpression } from "./ast-is";

export function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.Identifier | _ {
switch (true) {
// function MaybeComponent() {}
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/ast/src/ast-function-init-path.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TSESTree } from "@typescript-eslint/types";
import type { TSESTreeFunction } from "./ast-node";
import type { TSESTreeFunction } from "./ast-node-types";
import { _ } from "@eslint-react/eff";

import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/ast/src/ast-function-is.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TSESTreeFunction } from "./ast-node";
import type { TSESTreeFunction } from "./ast-node-types";

import { AST_NODE_TYPES as T } from "@typescript-eslint/types";

Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/ast/src/ast-hierarchy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { _ } from "@eslint-react/eff";
import { AST_NODE_TYPES as T, type TSESTree } from "@typescript-eslint/types";
import { simpleTraverse } from "@typescript-eslint/typescript-estree";
import { is, isFunction } from "./ast-is";
import { is, isFunction } from "./ast-node-is";

/**
* Find the parent node that satisfies the test function
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/ast/src/ast-line.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { TSESTree } from "@typescript-eslint/types";
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
import { isOneOf } from "./ast-is";
import { isOneOf } from "./ast-node-is";

/**
* Check if a node is multiline
Expand Down
Loading