Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(experimental-utils): add missing signature for isParenthesized #3887

Merged
merged 1 commit into from Sep 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,6 +1,6 @@
import * as eslintUtils from 'eslint-utils';
import { TSESTree } from '../../ts-estree';
import * as TSESLint from '../../ts-eslint';
import { TSESTree } from '../../ts-estree';

/**
* Get the proper location of a given function node to report.
Expand Down Expand Up @@ -101,19 +101,23 @@ const hasSideEffect = eslintUtils.hasSideEffect as (
},
) => boolean;

/**
* Check whether a given node is parenthesized or not.
* This function detects it correctly even if it's parenthesized by specific syntax.
*
* @see {@link https://eslint-utils.mysticatea.dev/api/ast-utils.html#isparenthesized}
* @returns `true` if the node is parenthesized.
* If `times` was given, it returns `true` only if the node is parenthesized the `times` times.
* For example, `isParenthesized(2, node, sourceCode)` returns true for `((foo))`, but not for `(foo)`.
*/
const isParenthesized = eslintUtils.isParenthesized as (
node: TSESTree.Node,
sourceCode: TSESLint.SourceCode,
) => boolean;
const isParenthesized = eslintUtils.isParenthesized as {
/**
* Check whether a given node is parenthesized or not.
* This function detects it correctly even if it's parenthesized by specific syntax.
*
* @see {@link https://eslint-utils.mysticatea.dev/api/ast-utils.html#isparenthesized}
* @returns `true` if the node is parenthesized.
* If `times` was given, it returns `true` only if the node is parenthesized the `times` times.
* For example, `isParenthesized(2, node, sourceCode)` returns true for `((foo))`, but not for `(foo)`.
*/
(node: TSESTree.Node, sourceCode: TSESLint.SourceCode): boolean;
(
times: number,
node: TSESTree.Node,
sourceCode: TSESLint.SourceCode,
): boolean;
};

export {
getFunctionHeadLocation,
Expand Down