🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@eslint-react/core

Package Overview
Dependencies
Maintainers
1
Versions
1448
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eslint-react/core - npm Package Compare versions

Comparing version

to
2.0.0-next.44

56

dist/index.d.ts

@@ -5,3 +5,3 @@ import { RuleContext } from '@eslint-react/kit';

import * as AST from '@eslint-react/ast';
import { _ } from '@eslint-react/eff';
import { unit } from '@eslint-react/eff';
import * as birecord from 'birecord';

@@ -84,6 +84,6 @@ import { Scope } from '@typescript-eslint/scope-manager';

interface SemanticNode {
id: _ | TSESTree.Identifier | TSESTree.Identifier[];
id: unit | TSESTree.Identifier | TSESTree.Identifier[];
key: string;
kind: string;
name: _ | string;
name: unit | string;
node: TSESTree.Node;

@@ -105,3 +105,3 @@ flag: bigint;

interface FunctionComponent extends SemanticNode {
id: _ | TSESTree.Identifier | TSESTree.Identifier[];
id: unit | TSESTree.Identifier | TSESTree.Identifier[];
kind: "function";

@@ -111,8 +111,8 @@ node: AST.TSESTreeFunction;

hint: ComponentDetectionHint;
initPath: _ | AST.FunctionInitPath;
initPath: unit | AST.FunctionInitPath;
hookCalls: TSESTree.CallExpression[];
displayName: _ | TSESTree.Expression;
displayName: unit | TSESTree.Expression;
}
interface ClassComponent extends SemanticNode {
id: _ | TSESTree.Identifier;
id: unit | TSESTree.Identifier;
kind: "class";

@@ -123,3 +123,3 @@ node: AST.TSESTreeClass;

methods: AST.TSESTreeMethodOrProperty[];
displayName: _ | TSESTree.Expression;
displayName: unit | TSESTree.Expression;
}

@@ -144,3 +144,3 @@ type Component = ClassComponent | FunctionComponent;

getCurrentEntries: () => FunctionEntry[];
getCurrentEntry: () => FunctionEntry | _;
getCurrentEntry: () => FunctionEntry | unit;
};

@@ -187,3 +187,3 @@ listeners: ESLintUtils.RuleListener;

declare function getFunctionComponentId(context: RuleContext, node: AST.TSESTreeFunction): TSESTree.Identifier | TSESTree.Identifier[] | _;
declare function getFunctionComponentId(context: RuleContext, node: AST.TSESTreeFunction): TSESTree.Identifier | TSESTree.Identifier[] | unit;

@@ -227,3 +227,3 @@ declare function getComponentFlagFromInitPath(initPath: FunctionComponent["initPath"]): bigint;

declare function isComponentNameLoose(name: string): boolean;
declare function getComponentNameFromId(id: TSESTree.Identifier | TSESTree.Identifier[] | _): string | undefined;
declare function getComponentNameFromId(id: TSESTree.Identifier | TSESTree.Identifier[] | unit): string | undefined;
declare function hasNoneOrLooseComponentName(context: RuleContext, fn: AST.TSESTreeFunction): boolean;

@@ -343,3 +343,3 @@

interface Hook extends SemanticNode {
id: TSESTree.Identifier | _;
id: TSESTree.Identifier | unit;
node: AST.TSESTreeFunction;

@@ -362,3 +362,3 @@ name: string;

declare function isReactHook(node: AST.TSESTreeFunction | _): boolean;
declare function isReactHook(node: AST.TSESTreeFunction | unit): boolean;
/**

@@ -369,7 +369,7 @@ * Check if the given node is a React Hook call by its name.

*/
declare function isReactHookCall(node: TSESTree.Node | _): boolean;
declare function isReactHookCallWithName(context: RuleContext, node: TSESTree.Node | _): (name: string) => boolean;
declare function isReactHookCallWithNameLoose(node: TSESTree.Node | _): (name: string) => boolean;
declare function isReactHookCallWithNameAlias(context: RuleContext, name: string, alias?: _ | string[]): (node: TSESTree.CallExpression) => boolean;
declare function isUseEffectCallLoose(node: TSESTree.Node | _): boolean;
declare function isReactHookCall(node: TSESTree.Node | unit): boolean;
declare function isReactHookCallWithName(context: RuleContext, node: TSESTree.Node | unit): (name: string) => boolean;
declare function isReactHookCallWithNameLoose(node: TSESTree.Node | unit): (name: string) => boolean;
declare function isReactHookCallWithNameAlias(context: RuleContext, name: string, alias?: unit | string[]): (node: TSESTree.CallExpression) => boolean;
declare function isUseEffectCallLoose(node: TSESTree.Node | unit): boolean;
declare const isUseCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;

@@ -412,3 +412,3 @@ declare const isUseActionStateCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;

*/
declare function getAttribute(context: RuleContext, name: string, attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], initialScope?: Scope): TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute | _;
declare function getAttribute(context: RuleContext, name: string, attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], initialScope?: Scope): TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute | unit;

@@ -456,3 +456,3 @@ /**

*/
declare function isJsxText(node: TSESTree$1.Node | null | _): node is TSESTree$1.JSXText | TSESTree$1.Literal;
declare function isJsxText(node: TSESTree$1.Node | null | unit): node is TSESTree$1.JSXText | TSESTree$1.Literal;
/**

@@ -468,3 +468,3 @@ * Heuristic decision to determine if a node is a JSX-like node.

getScope: (node: TSESTree$1.Node) => Scope;
}, node: TSESTree$1.Node | _ | null, hint?: JSXDetectionHint): boolean;
}, node: TSESTree$1.Node | unit | null, hint?: JSXDetectionHint): boolean;

@@ -489,8 +489,8 @@ /**

*/
declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | _;
declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | unit;
declare function isHostElement(context: RuleContext, node: TSESTree.Node): boolean;
declare function isKeyedElement(context: RuleContext, node: TSESTree.Node, initialScope?: Scope): boolean;
declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | null | _, allowJSXFragment?: false): node is TSESTree.JSXElement;
declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | null | _, allowJSXFragment?: true): node is TSESTree.JSXElement | TSESTree.JSXFragment;
declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | null | unit, allowJSXFragment?: false): node is TSESTree.JSXElement;
declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | null | unit, allowJSXFragment?: true): node is TSESTree.JSXElement | TSESTree.JSXFragment;

@@ -521,4 +521,4 @@ /**

type ReturnType = {
(context: RuleContext, node: _ | null | TSESTree.Node): node is TSESTree.Identifier | TSESTree.MemberExpression;
(context: RuleContext): (node: _ | null | TSESTree.Node) => node is TSESTree.MemberExpression | TSESTree.Identifier;
(context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.Identifier | TSESTree.MemberExpression;
(context: RuleContext): (node: unit | null | TSESTree.Node) => node is TSESTree.MemberExpression | TSESTree.Identifier;
};

@@ -529,4 +529,4 @@ }

type ReturnType = {
(context: RuleContext, node: _ | null | TSESTree.Node): node is TSESTree.CallExpression;
(context: RuleContext): (node: _ | null | TSESTree.Node) => node is TSESTree.CallExpression;
(context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.CallExpression;
(context: RuleContext): (node: unit | null | TSESTree.Node) => node is TSESTree.CallExpression;
};

@@ -533,0 +533,0 @@ }

import { AST_NODE_TYPES } from '@typescript-eslint/types';
import * as AST14 from '@eslint-react/ast';
import { flip, dual, constFalse, identity, constTrue, _ } from '@eslint-react/eff';
import { flip, dual, constFalse, identity, constTrue, unit } from '@eslint-react/eff';
import { RegExp, Selector } from '@eslint-react/kit';

@@ -73,3 +73,3 @@ import { coerceSettings, DEFAULT_ESLINT_REACT_SETTINGS, getId } from '@eslint-react/shared';

case (node.type === AST_NODE_TYPES.BlockStatement || node.type === AST_NODE_TYPES.Program || node.parent === node):
return _;
return unit;
default:

@@ -671,3 +671,3 @@ return getInstanceId(node.parent, node);

}
return _;
return unit;
}

@@ -703,3 +703,3 @@

function getComponentNameFromId(id) {
if (id == null) return _;
if (id == null) return unit;
return Array.isArray(id) ? id.map((n) => n.name).join(".") : id.name;

@@ -773,3 +773,3 @@ }

node: entry.node,
displayName: _,
displayName: unit,
flag: getComponentFlagFromInitPath(initPath),

@@ -785,3 +785,3 @@ hint,

if (left.type !== AST_NODE_TYPES.MemberExpression) return;
const componentName = left.object.type === AST_NODE_TYPES.Identifier ? left.object.name : _;
const componentName = left.object.type === AST_NODE_TYPES.Identifier ? left.object.name : unit;
const component = [...components.values()].findLast(({ name }) => name != null && name === componentName);

@@ -815,3 +815,3 @@ if (component == null) return;

node: entry.node,
displayName: _,
displayName: unit,
flag: getComponentFlagFromInitPath(initPath),

@@ -850,3 +850,3 @@ hint,

// TODO: Get displayName of class component
displayName: _,
displayName: unit,
flag,

@@ -853,0 +853,0 @@ hint: 0n,

{
"name": "@eslint-react/core",
"version": "2.0.0-next.43",
"version": "2.0.0-next.44",
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",

@@ -36,7 +36,7 @@ "homepage": "https://github.com/Rel1cx/eslint-react",

"ts-pattern": "^5.7.1",
"@eslint-react/ast": "2.0.0-next.43",
"@eslint-react/eff": "2.0.0-next.43",
"@eslint-react/kit": "2.0.0-next.43",
"@eslint-react/var": "2.0.0-next.43",
"@eslint-react/shared": "2.0.0-next.43"
"@eslint-react/ast": "2.0.0-next.44",
"@eslint-react/eff": "2.0.0-next.44",
"@eslint-react/shared": "2.0.0-next.44",
"@eslint-react/var": "2.0.0-next.44",
"@eslint-react/kit": "2.0.0-next.44"
},

@@ -43,0 +43,0 @@ "devDependencies": {