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 VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0-next.169
2.0.0-beta.69
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/monorepo",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"private": true,
"description": "Monorepo for eslint-plugin-react-[x, dom, web-api, hooks-extra, naming-convention].",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/core",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
"homepage": "https://github.com/Rel1cx/eslint-react",
"bugs": {
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
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-debug",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "ESLint React's ESLint plugin for debugging related rules.",
"keywords": [
"react",
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
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-dom",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "ESLint React's ESLint plugin for React DOM related rules.",
"keywords": [
"react",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-hooks-extra",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
"keywords": [
"react",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getSettingsFromContext } from "@eslint-react/shared";
import * as VAR from "@eslint-react/var";
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
import type { ESLintUtils, TSESTree } from "@typescript-eslint/utils";
import { getStaticValue } from "@typescript-eslint/utils/ast-utils";
import type { Scope } from "@typescript-eslint/utils/ts-eslint";

import { match } from "ts-pattern";
Expand Down Expand Up @@ -142,11 +143,7 @@ export function useNoDirectSetStateInUseEffect<Ctx extends RuleContext>(
return false;
}
const indexScope = context.sourceCode.getScope(node);
const indexValue = VAR.toStaticValue({
kind: "lazy",
node: index,
initialScope: indexScope,
}).value;
const indexValue = getStaticValue(index, indexScope)?.value;
return indexValue === 1 && isIdFromUseStateCall(callee.object);
}
// const [data, setData] = useState();
Expand All @@ -162,11 +159,7 @@ export function useNoDirectSetStateInUseEffect<Ctx extends RuleContext>(
}
const property = node.callee.property;
const propertyScope = context.sourceCode.getScope(node);
const propertyValue = VAR.toStaticValue({
kind: "lazy",
node: property,
initialScope: propertyScope,
}).value;
const propertyValue = getStaticValue(property, propertyScope)?.value;
return propertyValue === 1 && isIdFromUseStateCall(node.callee.object, 1);
}
default: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-naming-convention",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "ESLint React's ESLint plugin for naming convention related rules.",
"keywords": [
"react",
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
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-web-api",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
"keywords": [
"react",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AST_NODE_TYPES as T } from "@typescript-eslint/utils";
import type { RuleListener } from "@typescript-eslint/utils/ts-eslint";
import type { EventListenerEntry } from "../types";

import { getStaticValue } from "@typescript-eslint/utils/ast-utils";
import { isMatching, match, P } from "ts-pattern";
import { createRule, getPhaseKindOfFunction } from "../utils";

Expand Down Expand Up @@ -102,7 +103,7 @@ function getOptions(node: TSESTree.CallExpressionArgument, initialScope: Scope):
break;
}
default: {
v = VAR.toStaticValue({ kind: "lazy", node: value, initialScope }).value;
v = getStaticValue(value, initialScope)?.value;
break;
}
}
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
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-x",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "A set of composable ESLint rules for for libraries and frameworks that use React as a UI runtime.",
"keywords": [
"react",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type { CamelCase } from "string-ts";
import { unionConstituents } from "ts-api-utils";
import { match, P } from "ts-pattern";

import { getStaticValue } from "@typescript-eslint/utils/ast-utils";
import { createRule } from "../utils";

export const RULE_NAME = "no-leaked-conditional-rendering";
Expand Down Expand Up @@ -82,9 +83,7 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
}
const initialScope = context.sourceCode.getScope(left);
const isLeftNan = (left.type === T.Identifier && left.name === "NaN")
|| VAR
.toStaticValue({ kind: "lazy", node: left, initialScope })
.value === "NaN";
|| getStaticValue(left, initialScope)?.value === "NaN";
if (isLeftNan) {
return {
messageId: "noLeakedConditionalRendering",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/eslint-plugin",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "A unified plugin that combines all individual plugins from the eslint-react monorepo into one.",
"keywords": [
"react",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/shared",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "ESLint React's Shared constants and functions.",
"homepage": "https://github.com/Rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/ast/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/ast",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "ESLint React's TSESTree AST utility module.",
"homepage": "https://github.com/Rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/eff/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/eff",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "JavaScript and TypeScript utilities (previously some re-exports of the effect library).",
"homepage": "https://github.com/Rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/kit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/kit",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "ESLint React's plugin kit for building plugins and rules.",
"homepage": "https://github.com/Rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/var/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/var",
"version": "2.0.0-next.169",
"version": "2.0.0-beta.69",
"description": "ESLint React's TSESTree AST utility module for static analysis of variables.",
"homepage": "https://github.com/Rel1cx/eslint-react",
"bugs": {
Expand Down
1 change: 0 additions & 1 deletion packages/utilities/var/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from "./misc";
export * from "./value-construction";
export * from "./value-equal";
export * from "./value-helper";
export * from "./variable-assignment";
export type * from "./variable-declaration";
export * from "./variable-extractor";
Expand Down
8 changes: 4 additions & 4 deletions packages/utilities/var/src/value-equal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { unit } from "@eslint-react/eff";
import { DefinitionType, type Scope, type Variable } from "@typescript-eslint/scope-manager";
import type { TSESTree } from "@typescript-eslint/types";
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
import { toStaticValue } from "./value-helper";
import { getStaticValue } from "@typescript-eslint/utils/ast-utils";
import { findVariable } from "./variable-extractor";
import { getVariableDefinitionNode } from "./variable-resolver";

Expand Down Expand Up @@ -99,9 +99,9 @@ export function isNodeValueEqual(
return aFunction === bFunction;
}
default: {
const aStatic = toStaticValue({ kind: "lazy", node: a, initialScope: aScope });
const bStatic = toStaticValue({ kind: "lazy", node: b, initialScope: bScope });
return aStatic.kind !== "none" && bStatic.kind !== "none" && aStatic.value === bStatic.value;
const aStatic = getStaticValue(a, aScope);
const bStatic = getStaticValue(b, bScope);
return aStatic != null && bStatic != null && aStatic.value === bStatic.value;
}
}
}
Expand Down
40 changes: 0 additions & 40 deletions packages/utilities/var/src/value-helper.ts

This file was deleted.