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
10 changes: 7 additions & 3 deletions packages/core/docs/functions/isReactAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
function isReactAPI(api: string): ReturnType;
```

Checks if the node is a React API identifier or member expression

## Parameters

| Parameter | Type |
| ------ | ------ |
| `api` | `string` |
| Parameter | Type | Description |
| ------ | ------ | ------ |
| `api` | `string` | The React API name to check against (e.g., "useState", "React.memo") |

## Returns

[`ReturnType`](../@eslint-react/namespaces/isReactAPI/type-aliases/ReturnType.md)

A predicate function to check if a node matches the API
10 changes: 7 additions & 3 deletions packages/core/docs/functions/isReactAPICall.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
function isReactAPICall(api: string): ReturnType;
```

Checks if the node is a call expression to a specific React API

## Parameters

| Parameter | Type |
| ------ | ------ |
| `api` | `string` |
| Parameter | Type | Description |
| ------ | ------ | ------ |
| `api` | `string` | The React API name to check against |

## Returns

[`ReturnType`](../@eslint-react/namespaces/isReactAPICall/type-aliases/ReturnType.md)

A predicate function to check if a node is a call to the API
6 changes: 4 additions & 2 deletions packages/core/src/component/component-collector-legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@

/**
* Check whether the given node is a this.setState() call
* @param node - The node to check
* @param node The node to check
* @param node

Check warning on line 74 in packages/core/src/component/component-collector-legacy.ts

View workflow job for this annotation

GitHub Actions / check

Missing JSDoc @param "node" description

Check warning on line 74 in packages/core/src/component/component-collector-legacy.ts

View workflow job for this annotation

GitHub Actions / check

Duplicate @param "node"

Check warning on line 74 in packages/core/src/component/component-collector-legacy.ts

View workflow job for this annotation

GitHub Actions / Publish

Missing JSDoc @param "node" description

Check warning on line 74 in packages/core/src/component/component-collector-legacy.ts

View workflow job for this annotation

GitHub Actions / Publish

Duplicate @param "node"

Check warning on line 74 in packages/core/src/component/component-collector-legacy.ts

View workflow job for this annotation

GitHub Actions / check

Missing JSDoc @param "node" description

Check warning on line 74 in packages/core/src/component/component-collector-legacy.ts

View workflow job for this annotation

GitHub Actions / check

Duplicate @param "node"
Comment on lines +73 to +74
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format and duplicate @param entry. Should be * @param node The node to check (single asterisk, single entry) instead of having both * @param node The node to check and * @param node on separate lines.

Copilot uses AI. Check for mistakes.
* @internal
*/
export function isThisSetState(node: TSESTree.CallExpression) {
Expand All @@ -85,7 +86,8 @@

/**
* Check whether the given node is an assignment to this.state
* @param node - The node to check
* @param node The node to check
* @param node

Check warning on line 90 in packages/core/src/component/component-collector-legacy.ts

View workflow job for this annotation

GitHub Actions / check

Missing JSDoc @param "node" description

Check warning on line 90 in packages/core/src/component/component-collector-legacy.ts

View workflow job for this annotation

GitHub Actions / check

Duplicate @param "node"

Check warning on line 90 in packages/core/src/component/component-collector-legacy.ts

View workflow job for this annotation

GitHub Actions / Publish

Missing JSDoc @param "node" description

Check warning on line 90 in packages/core/src/component/component-collector-legacy.ts

View workflow job for this annotation

GitHub Actions / Publish

Duplicate @param "node"

Check warning on line 90 in packages/core/src/component/component-collector-legacy.ts

View workflow job for this annotation

GitHub Actions / check

Missing JSDoc @param "node" description

Check warning on line 90 in packages/core/src/component/component-collector-legacy.ts

View workflow job for this annotation

GitHub Actions / check

Duplicate @param "node"
Comment on lines +89 to +90
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format and duplicate @param entry. Should be * @param node The node to check (single asterisk, single entry) instead of having both * @param node The node to check and * @param node on separate lines.

Copilot uses AI. Check for mistakes.
* @internal
*/
export function isAssignmentToThisState(node: TSESTree.AssignmentExpression) {
Expand Down
24 changes: 16 additions & 8 deletions packages/core/src/component/component-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
/**
* Checks if the given node is a function within a render method of a class component.
*
* @param node - The AST node to check
* @param node The AST node to check
* @param node

Check warning on line 39 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / check

Missing JSDoc @param "node" description

Check warning on line 39 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / check

Duplicate @param "node"

Check warning on line 39 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / Publish

Missing JSDoc @param "node" description

Check warning on line 39 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / Publish

Duplicate @param "node"

Check warning on line 39 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / check

Missing JSDoc @param "node" description

Check warning on line 39 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / check

Duplicate @param "node"
Comment on lines +38 to +39
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format and duplicate @param entries. Should be * @param node The AST node to check (single asterisk, single entry) instead of having both * @param node The AST node to check and * @param node on separate lines.

Copilot uses AI. Check for mistakes.
* @returns `true` if the node is a render function inside a class component
*
* @example
Expand All @@ -60,8 +61,10 @@
/**
* Checks if a function node should be excluded based on provided detection hints
*
* @param node - The function node to check
* @param hint - Component detection hints as bit flags
* @param node The function node to check
* @param hint Component detection hints as bit flags
* @param node

Check warning on line 66 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / check

Missing JSDoc @param "node" description

Check warning on line 66 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / check

Duplicate @param "node"

Check warning on line 66 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / Publish

Missing JSDoc @param "node" description

Check warning on line 66 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / Publish

Duplicate @param "node"

Check warning on line 66 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / check

Missing JSDoc @param "node" description

Check warning on line 66 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / check

Duplicate @param "node"
* @param hint

Check warning on line 67 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / check

Missing JSDoc @param "hint" description

Check warning on line 67 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / Publish

Missing JSDoc @param "hint" description

Check warning on line 67 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / check

Missing JSDoc @param "hint" description
Comment on lines +66 to +67
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format and duplicate @param entries. Should be * @param node The function node to check and * @param hint Component detection hints... (single asterisk, single entry each) instead of having duplicate entries.

Suggested change
* @param node
* @param hint

Copilot uses AI. Check for mistakes.
* @returns `true` if the function matches an exclusion hint
*/
function shouldExcludeBasedOnHint(node: AST.TSESTreeFunction, hint: bigint): boolean {
Expand All @@ -87,8 +90,10 @@
/**
* Determines if the node is an argument within `createElement`'s children list (3rd argument onwards)
*
* @param context - The rule context
* @param node - The AST node to check
* @param context The rule context
* @param node The AST node to check
* @param context

Check warning on line 95 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / check

Duplicate @param "context"

Check warning on line 95 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / Publish

Duplicate @param "context"

Check warning on line 95 in packages/core/src/component/component-definition.ts

View workflow job for this annotation

GitHub Actions / check

Duplicate @param "context"
* @param node
Comment on lines +93 to +96
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format and duplicate @param entries. Should be * @param context The rule context and * @param node The AST node to check (single asterisk, single entry each) instead of having duplicate entries.

Copilot uses AI. Check for mistakes.
* @returns `true` if the node is passed as a child to `createElement`
*/
function isChildrenOfCreateElement(context: RuleContext, node: TSESTree.Node): boolean {
Expand All @@ -111,9 +116,12 @@
/**
* Determines if a function node represents a valid React component definition
*
* @param context - The rule context
* @param node - The function node to analyze
* @param hint - Component detection hints (bit flags) to customize detection logic
* @param context The rule context
* @param node The function node to analyze
* @param hint Component detection hints (bit flags) to customize detection logic
* @param context
* @param node
* @param hint
Comment on lines +119 to +124
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format and duplicate @param entries. Should be * @param context The rule context, * @param node The function node to analyze, and * @param hint Component detection hints... (single asterisk, single entry each) instead of having duplicate entries.

Copilot uses AI. Check for mistakes.
* @returns `true` if the node is considered a component definition
*/
export function isComponentDefinition(
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/component/component-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ import { getFunctionComponentId } from "./component-id";

/**
* Check if a string matches the strict component name pattern
* @param name - The name to check
* @param name The name to check
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param name The name to check instead of * * @param name The name to check

Copilot uses AI. Check for mistakes.
*/
export function isComponentName(name: string) {
return RE_COMPONENT_NAME.test(name);
}

/**
* Check if a string matches the loose component name pattern
* @param name - The name to check
* @param name The name to check
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param name The name to check instead of * * @param name The name to check

Copilot uses AI. Check for mistakes.
*/
export function isComponentNameLoose(name: string) {
return RE_COMPONENT_NAME_LOOSE.test(name);
}

/**
* Get component name from an identifier or identifier sequence (e.g., MemberExpression)
* @param id - The identifier or identifier sequence
* @param id The identifier or identifier sequence
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param id The identifier or identifier sequence instead of * * @param id The identifier or identifier sequence

Copilot uses AI. Check for mistakes.
*/
export function getComponentNameFromId(id: TSESTree.Identifier | TSESTree.Identifier[] | unit) {
if (id == null) return unit;
Expand All @@ -34,8 +34,8 @@ export function getComponentNameFromId(id: TSESTree.Identifier | TSESTree.Identi

/**
* Check if the function has no name or a loose component name
* @param context - The rule context
* @param fn - The function node
* @param context The rule context
* @param fn The function node
*/
export function hasNoneOrLooseComponentName(context: RuleContext, fn: AST.TSESTreeFunction) {
const id = getFunctionComponentId(context, fn);
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/jsx/jsx-element-is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { getJsxElementType } from "./jsx-element-type";
* Determines if a JSX element is a host element
* Host elements in React start with lowercase letters (e.g., div, span)
*
* @param context - ESLint rule context
* @param node - AST node to check
* @param context ESLint rule context
* @param node AST node to check
Comment on lines +10 to +11
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param context ESLint rule context and * @param node AST node to check instead of * * @param (double asterisk).

Copilot uses AI. Check for mistakes.
* @returns boolean indicating if the element is a host element
*/
export function isJsxHostElement(context: RuleContext, node: TSESTree.Node) {
Expand All @@ -21,8 +21,8 @@ export function isJsxHostElement(context: RuleContext, node: TSESTree.Node) {
* Determines if a JSX element is a React Fragment
* Fragments can be imported from React and used like <Fragment> or <React.Fragment>
*
* @param context - ESLint rule context
* @param node - AST node to check
* @param context ESLint rule context
* @param node AST node to check
Comment on lines +24 to +25
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param context ESLint rule context and * @param node AST node to check instead of * * @param (double asterisk).

Copilot uses AI. Check for mistakes.
* @returns boolean indicating if the element is a Fragment with type narrowing
*/
export function isJsxFragmentElement(context: RuleContext, node: TSESTree.Node): node is TSESTree.JSXElement {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/jsx/jsx-element-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { stringifyJsx } from "./jsx-stringify";
* For JSX elements, returns the stringified name (e.g., "div", "Button", "React.Fragment")
* For JSX fragments, returns an empty string
*
* @param context - ESLint rule context
* @param node - JSX element or fragment node
* @param context ESLint rule context
* @param node JSX element or fragment node
Comment on lines +11 to +12
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param context ESLint rule context and * @param node JSX element or fragment node instead of * * @param (double asterisk).

Copilot uses AI. Check for mistakes.
* @returns String representation of the element type
*/
export function getJsxElementType(context: RuleContext, node: TSESTree.JSXElement | TSESTree.JSXFragment) {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/jsx/jsx-hierarchy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
/**
* Traverses up the AST to find a parent JSX attribute node that matches a given test
*
* @param node - The starting AST node
* @param test - Optional predicate function to test if the attribute meets criteria
* @param node The starting AST node
* @param test Optional predicate function to test if the attribute meets criteria
Comment on lines +10 to +11
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param node The starting AST node and * @param test Optional predicate function... instead of * * @param (double asterisk).

Copilot uses AI. Check for mistakes.
* Defaults to always returning true (matches any attribute)
* @returns The first matching JSX attribute node found when traversing upwards, or undefined
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/jsx/jsx-stringify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { TSESTree } from "@typescript-eslint/utils";
/**
* Incomplete but sufficient stringification of JSX nodes for common use cases
*
* @param node - JSX node from TypeScript ESTree
* @param node JSX node from TypeScript ESTree
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param node JSX node from TypeScript ESTree instead of * * @param node JSX node from TypeScript ESTree

Copilot uses AI. Check for mistakes.
* @returns String representation of the JSX node
*/
export function stringifyJsx(
Expand Down
12 changes: 12 additions & 0 deletions packages/core/src/utils/is-react-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export declare namespace isReactAPI {
};
}

/**
* Checks if the node is a React API identifier or member expression
* @param api The React API name to check against (e.g., "useState", "React.memo")
* @returns A predicate function to check if a node matches the API
*/
Comment on lines +16 to +20
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc comment is missing proper @param tags. While the description is good, it should use proper JSDoc format:

/**
 * Checks if the node is a React API identifier or member expression
 * @param api The React API name to check against (e.g., "useState", "React.memo")
 * @returns A predicate function to check if a node matches the API
 */

Note: The current format has the @param and @returns lines outside the JSDoc comment block, making them regular comments rather than JSDoc tags.

Copilot uses AI. Check for mistakes.
export function isReactAPI(api: string): isReactAPI.ReturnType {
const func = (context: RuleContext, node: unit | null | TSESTree.Node): node is
| TSESTree.Identifier
Expand All @@ -35,6 +40,11 @@ export declare namespace isReactAPICall {
};
}

/**
* Checks if the node is a call expression to a specific React API
* @param api The React API name to check against
* @returns A predicate function to check if a node is a call to the API
*/
Comment on lines +43 to +47
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc comment is missing proper @param tags. While the description is good, it should use proper JSDoc format:

/**
 * Checks if the node is a call expression to a specific React API
 * @param api The React API name to check against
 * @returns A predicate function to check if a node is a call to the API
 */

Note: The current format has the @param and @returns lines outside the JSDoc comment block, making them regular comments rather than JSDoc tags.

Copilot uses AI. Check for mistakes.
export function isReactAPICall(api: string): isReactAPICall.ReturnType {
const func = (context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.CallExpression => {
if (node == null) return false;
Expand All @@ -44,6 +54,7 @@ export function isReactAPICall(api: string): isReactAPICall.ReturnType {
return dual(2, func);
}

// React API checks
export const isCaptureOwnerStack = isReactAPI("captureOwnerStack");
export const isChildrenCount = isReactAPI("Children.count");
export const isChildrenForEach = isReactAPI("Children.forEach");
Expand All @@ -58,6 +69,7 @@ export const isForwardRef = isReactAPI("forwardRef");
export const isMemo = isReactAPI("memo");
export const isLazy = isReactAPI("lazy");

// React API Call checks
export const isCaptureOwnerStackCall = isReactAPICall("captureOwnerStack");
export const isChildrenCountCall = isReactAPICall("Children.count");
export const isChildrenForEachCall = isReactAPICall("Children.forEach");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ const POPOVER_API_PROPS: string[] = [

/**
* Gets all valid DOM property names based on React version
* @param context - ESLint rule context
* @param context ESLint rule context
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param context ESLint rule context instead of * * @param context ESLint rule context

Copilot uses AI. Check for mistakes.
* @returns Array of valid DOM property names
*/
function getDOMPropertyNames(context: RuleContext<MessageID, unknown[]>): string[] {
Expand Down Expand Up @@ -998,7 +998,7 @@ function getDOMPropertyNames(context: RuleContext<MessageID, unknown[]>): string
/**
* Checks if a node's parent is a JSX tag that is written with lowercase letters,
* and is not a custom web component.
* @param childNode - JSX element being tested
* @param childNode JSX element being tested
* @returns Whether the node is a valid HTML tag in JSX
*/
function isValidHTMLTagInJSX(childNode: JSXAttribute): boolean {
Expand All @@ -1015,7 +1015,7 @@ function isValidHTMLTagInJSX(childNode: JSXAttribute): boolean {

/**
* Normalizes attribute names that should be case-insensitive
* @param name - Attribute name to normalize
* @param name Attribute name to normalize
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param name Attribute name to normalize instead of * * @param name Attribute name to normalize

Copilot uses AI. Check for mistakes.
* @returns Normalized attribute name
*/
function normalizeAttributeCase(name: string): string {
Expand All @@ -1024,7 +1024,7 @@ function normalizeAttributeCase(name: string): string {

/**
* Checks if an attribute name is a valid data-* attribute
* @param name - Attribute name to test
* @param name Attribute name to test
* @returns Whether the attribute is a valid data attribute
*/
function isValidDataAttribute(name: string): boolean {
Expand All @@ -1033,7 +1033,7 @@ function isValidDataAttribute(name: string): boolean {

/**
* Checks if an attribute name has uppercase characters
* @param name - Attribute name to test
* @param name Attribute name to test
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param name Attribute name to test instead of * * @param name Attribute name to test

Copilot uses AI. Check for mistakes.
* @returns Whether the name has uppercase characters
*/
function hasUpperCaseCharacter(name: string): boolean {
Expand All @@ -1042,7 +1042,7 @@ function hasUpperCaseCharacter(name: string): boolean {

/**
* Checks if an attribute is a valid ARIA attribute
* @param name - Attribute name to test
* @param name Attribute name to test
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param name Attribute name to test instead of * * @param name Attribute name to test

Copilot uses AI. Check for mistakes.
* @returns Whether the attribute is a valid ARIA attribute
*/
function isValidAriaAttribute(name: string): boolean {
Expand All @@ -1051,7 +1051,7 @@ function isValidAriaAttribute(name: string): boolean {

/**
* Gets the tag name for a JSXAttribute
* @param node - JSXAttribute to get tag name from
* @param node JSXAttribute to get tag name from
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param node JSXAttribute to get tag name from instead of * * @param node JSXAttribute to get tag name from

Copilot uses AI. Check for mistakes.
* @returns Tag name or null
*/
function getTagName(node: JSXAttribute): string | null {
Expand All @@ -1063,7 +1063,7 @@ function getTagName(node: JSXAttribute): string | null {

/**
* Checks if the tag name has a dot (member expression)
* @param node - JSXAttribute to check
* @param node JSXAttribute to check
* @returns Whether the tag name has a dot
*/
function tagNameHasDot(node: JSXAttribute): boolean {
Expand All @@ -1075,8 +1075,8 @@ function tagNameHasDot(node: JSXAttribute): boolean {

/**
* Gets the standard name of an attribute
* @param name - Attribute name
* @param context - ESLint context
* @param name Attribute name
* @param context ESLint context
Comment on lines +1078 to +1079
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param name Attribute name and * @param context ESLint context instead of * * @param (double asterisk).

Copilot uses AI. Check for mistakes.
* @returns Standard name or undefined
*/
function getStandardName(name: string, context: RuleContext<MessageID, unknown[]>): string | undefined {
Expand All @@ -1092,8 +1092,8 @@ function getStandardName(name: string, context: RuleContext<MessageID, unknown[]

/**
* Checks if an object has a property
* @param obj - Object to check
* @param key - Key to check for
* @param obj Object to check
* @param key Key to check for
Comment on lines +1095 to +1096
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param obj Object to check and * @param key Key to check for instead of * * @param (double asterisk).

Copilot uses AI. Check for mistakes.
* @returns Whether the object has the property
*/
function has(obj: Record<string, any>, key: string): boolean {
Expand All @@ -1102,8 +1102,8 @@ function has(obj: Record<string, any>, key: string): boolean {

/**
* Gets text of a node
* @param context - ESLint context
* @param node - Node to get text from
* @param context ESLint context
* @param node Node to get text from
Comment on lines +1105 to +1106
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param context ESLint context and * @param node Node to get text from instead of * * @param (double asterisk).

Copilot uses AI. Check for mistakes.
* @returns Node's text
*/
function getText(context: RuleContext<MessageID, unknown[]>, node: any): string {
Expand All @@ -1112,9 +1112,9 @@ function getText(context: RuleContext<MessageID, unknown[]>, node: any): string

/**
* Tests React version against a comparator
* @param context - ESLint context
* @param comparator - Comparison operator
* @param version - Version to compare against
* @param context ESLint context
* @param comparator Comparison operator
* @param version Version to compare against
Comment on lines +1115 to +1117
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param context ESLint context, * @param comparator Comparison operator, and * @param version Version to compare against instead of * * @param (double asterisk).

Copilot uses AI. Check for mistakes.
* @returns Comparison result
*/
function testReactVersion(context: RuleContext<MessageID, unknown[]>, comparator: string, version: string): boolean {
Expand Down Expand Up @@ -1167,7 +1167,7 @@ export default createRule({

/**
* Create function for the ESLint rule
* @param context - ESLint rule context
* @param context ESLint rule context
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param context ESLint rule context instead of * * @param context ESLint rule context

Copilot uses AI. Check for mistakes.
* @returns Rule listener
*/
export function create(context: RuleContext<MessageID, unknown[]>): RuleListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type RuleSuggestMessageID = "addRelNoreferrerNoopener";
/**
* Checks if a value appears to be an external link.
* External links typically start with http(s):// or have protocol-relative format.
* @param value - The value to check
* @param value The value to check
* @returns Whether the value represents an external link
*/
function isExternalLinkLike(value: unknown): boolean {
Expand All @@ -31,7 +31,7 @@ function isExternalLinkLike(value: unknown): boolean {
/**
* Checks if a rel prop value contains the necessary security attributes.
* At minimum, it should contain "noreferrer".
* @param value - The rel prop value to check
* @param value The rel prop value to check
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra asterisk in JSDoc parameter format. Should be * @param value The rel prop value to check instead of * * @param value The rel prop value to check

Copilot uses AI. Check for mistakes.
* @returns Whether the rel value is considered secure
*/
function isSafeRel(value: unknown): boolean {
Expand Down
Loading