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

chore(deps): update dependency eslint-plugin-perfectionist to v2.10.0 #1617

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/mutations/codeFixes/noImplicitAny.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export type NoImplicitAnyNode =
| ts.PropertyDeclaration
| ts.VariableDeclaration;

export type NoImplicitAnyNodeToBeFixed = NoImplicitAnyNode & {
export type NoImplicitAnyNodeToBeFixed = {
initializer: undefined;
type: undefined;
};
} & NoImplicitAnyNode;

/**
* Error codes for the TypeScript language service to get --noImplicitAny code fixes.
Expand Down
4 changes: 2 additions & 2 deletions src/mutations/renames/isRequireToJsFile.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ts from "typescript";

export type LocalImplicitRequireCallExpression = ts.CallExpression & {
export type LocalImplicitRequireCallExpression = {
arguments: [ts.StringLiteral];
};
} & ts.CallExpression;

export const isRequireToJsFile = (
node: ts.Node,
Expand Down
7 changes: 2 additions & 5 deletions src/mutators/builtIn/fixImportExtensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ import {
import { getTypeAtLocationIfNotError } from "../../../shared/types.js";
import { collectMutationsFromNodes } from "../../collectMutationsFromNodes.js";

type ExtensionlessExportOrImport = (
| ts.ExportDeclaration
| ts.ImportDeclaration
) & {
type ExtensionlessExportOrImport = {
moduleSpecifier: ts.StringLiteral;
};
} & (ts.ExportDeclaration | ts.ImportDeclaration);

export const fixImportExtensions: FileMutator = (
request: FileMutationsRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export interface GenericClassDetails {
typeParameterNames: readonly string[];
}

export type ParameterTypeNode = ts.TypeNode & {
export type ParameterTypeNode = {
parent: ts.ParameterDeclaration;
};
} & ts.TypeNode;

export interface ParameterTypeNodeSummary {
parameterName: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import ts from "typescript";

export type VariableWithImplicitGeneric = ts.VariableDeclaration & {
export type VariableWithImplicitGeneric = {
initializer: GenericCapableInitializer;
type: undefined;
};
} & ts.VariableDeclaration;

type GenericCapableInitializer = ts.ArrayLiteralExpression | ts.NewExpression;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const fixIncompleteParameterTypes: FileMutator = (

const isParameterWithType = (
node: ts.Node,
): node is ts.ParameterDeclaration & NodeWithType =>
): node is NodeWithType & ts.ParameterDeclaration =>
ts.isParameter(node) && isNodeWithType(node);

const visitParameterDeclaration = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const fixIncompletePropertyDeclarationTypes: FileMutator = (

const isPropertyDeclarationWithType = (
node: ts.Node,
): node is ts.PropertyDeclaration & NodeWithType =>
): node is NodeWithType & ts.PropertyDeclaration =>
ts.isPropertyDeclaration(node) && isNodeWithType(node);

const visitPropertyDeclaration = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import ts from "typescript";

import { ReactComponentNode } from "../../reactFiltering/isReactComponentNode.js";

type PropTypesMember = ts.PropertyDeclaration & {
type PropTypesMember = {
initializer: ts.ObjectLiteralExpression;
name: {
kind: ts.SyntaxKind.Identifier;
text: "propTypes";
};
};
} & ts.PropertyDeclaration;

/**
* @returns Whether a node is a `propTypes` class member with an object literal value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ export type ReactComponentNode =
| ReactClassComponentNode
| ReactFunctionalComponentNode;

export type ReactClassComponentNode = (
| ts.ClassDeclaration
| ts.ClassExpression
) & {
export type ReactClassComponentNode = {
heritageClauses: ts.NodeArray<ts.HeritageClause>;
};
} & (ts.ClassDeclaration | ts.ClassExpression);

export type ReactFunctionalComponentNode =
| ts.ArrowFunction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const fixIncompleteVariableTypes: FileMutator = (

const isNodeVariableDeclarationWithType = (
node: ts.Node,
): node is ts.VariableDeclaration & NodeWithType =>
): node is NodeWithType & ts.VariableDeclaration =>
ts.isVariableDeclaration(node) && isNodeWithType(node);

const visitVariableDeclaration = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ export const fixNoImplicitAnyParameters: FileMutator = (

const isNodeNoImplicitAnyFixableParameter = (
node: ts.Node,
): node is ts.ParameterDeclaration & NoImplicitAnyNodeToBeFixed =>
): node is NoImplicitAnyNodeToBeFixed & ts.ParameterDeclaration =>
ts.isParameter(node) && canNodeBeFixedForNoImplicitAny(node);
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ export const fixNoImplicitAnyPropertyDeclarations: FileMutator = (

const isNodeNoImplicitAnyFixablePropertyDeclaration = (
node: ts.Node,
): node is ts.PropertyDeclaration & NoImplicitAnyNodeToBeFixed =>
): node is NoImplicitAnyNodeToBeFixed & ts.PropertyDeclaration =>
ts.isPropertyDeclaration(node) && canNodeBeFixedForNoImplicitAny(node);
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
import { NodeWithType, isNodeWithType } from "../../../../shared/nodeTypes.js";
import { collectMutationsFromNodes } from "../../../collectMutationsFromNodes.js";

type InferablePropertyDeclaration = ts.PropertyDeclaration &
NodeWithType &
Required<Pick<ts.PropertyDeclaration, "initializer">>;
type InferablePropertyDeclaration = NodeWithType &
Required<Pick<ts.PropertyDeclaration, "initializer">> &
ts.PropertyDeclaration;

export const fixNoInferableTypesPropertyDeclarations: FileMutator = (
request: FileMutationsRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import {
import { NodeWithType, isNodeWithType } from "../../../../shared/nodeTypes.js";
import { collectMutationsFromNodes } from "../../../collectMutationsFromNodes.js";

type InferableVariableDeclaration = ts.VariableDeclaration &
NodeWithType &
Required<Pick<ts.VariableDeclaration, "initializer">> & {
parent: ts.VariableDeclarationList;
};
type InferableVariableDeclaration = {
parent: ts.VariableDeclarationList;
} & NodeWithType &
Required<Pick<ts.VariableDeclaration, "initializer">> &
ts.VariableDeclaration;

export const fixNoInferableTypesVariableDeclarations: FileMutator = (
request: FileMutationsRequest,
Expand Down
4 changes: 2 additions & 2 deletions src/options/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ export interface TypeStatOptions extends BaseTypeStatOptions {
/**
* Parsed TypeScript compiler options with relevant fields filled out.
*/
export type TypeStatCompilerOptions = ts.CompilerOptions & {
export type TypeStatCompilerOptions = {
noImplicitAny: boolean;
noImplicitThis: boolean;
strictNullChecks: boolean;
};
} & ts.CompilerOptions;

/**
* Directives for file-level changes.
Expand Down
4 changes: 2 additions & 2 deletions src/shared/diagnostics.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ts from "typescript";

export type DiagnosticWithStart = ts.Diagnostic & {
export type DiagnosticWithStart = {
start: number;
};
} & ts.Diagnostic;

export const isDiagnosticWithStart = (
diagnostic: ts.Diagnostic,
Expand Down
4 changes: 2 additions & 2 deletions src/shared/nodeExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export const getBaseClassDeclaration = (
const { resolvedBaseConstructorType } = getTypeAtLocationIfNotError(
request,
extension.parent.parent,
) as ts.Type & {
) as {
resolvedBaseConstructorType: ts.Type | undefined;
};
} & ts.Type;

if (resolvedBaseConstructorType !== undefined) {
extensionSymbol = resolvedBaseConstructorType.symbol;
Expand Down
48 changes: 24 additions & 24 deletions src/shared/nodeTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ export type NodeSelector<TNode extends ts.Node> = (
/**
* Any node type that may optionally contain a type annotation.
*/
export type NodeWithOptionalType = ts.Node & {
export type NodeWithOptionalType = {
type?: ts.TypeNode;
};
} & ts.Node;

/**
* Any node type that contains a type annotation.
*/
export type NodeWithType = ts.Node & {
export type NodeWithType = {
type: ts.TypeNode;
};
} & ts.Node;

export type NodeWithIdentifierName = ts.Node & {
export type NodeWithIdentifierName = {
name: ts.Identifier;
};
} & ts.Node;

export type ParameterDeclarationWithType = ts.ParameterDeclaration &
NodeWithType;
export type ParameterDeclarationWithType = NodeWithType &
ts.ParameterDeclaration;

export type PropertySignatureWithType = ts.PropertySignature & NodeWithType;
export type PropertySignatureWithType = NodeWithType & ts.PropertySignature;

/**
* Node types TypeStat may attempt to create a type declaration on.
Expand All @@ -42,31 +42,31 @@ export type NodeWithCreatableType =
/**
* Node types TypeStat may attempt to add to an existing type declaration on.
*/
export type NodeWithAddableType = NodeWithType &
(
| ts.FunctionLikeDeclaration
| ts.ParameterDeclaration
| ts.PropertyDeclaration
| ts.VariableDeclaration
);
export type NodeWithAddableType = (
| ts.FunctionLikeDeclaration
| ts.ParameterDeclaration
| ts.PropertyDeclaration
| ts.VariableDeclaration
) &
NodeWithType;

/**
* Any function-like declaration that has an explicit type.
*/
export type FunctionLikeDeclarationWithType = ts.FunctionLikeDeclaration &
NodeWithType;
export type FunctionLikeDeclarationWithType = NodeWithType &
ts.FunctionLikeDeclaration;

// TODO: make this a more specific type
// Will have to deal with instantiations (new Container<T>() { ... }) and declarations (class Container<T>() { ... }))
export type NodeWithDefinedTypeArguments = ts.Node & {
export type NodeWithDefinedTypeArguments = {
typeArguments?: ts.NodeArray<ts.TypeNode>;
};
} & ts.Node;

// TODO: make this a more specific type
// Will have to deal with instantiations (new Container<T>() { ... }) and declarations (class Container<T>() { ... }))
export type NodeWithTypeParameters = ts.Node & {
export type NodeWithTypeParameters = {
typeParameters: ts.NodeArray<ts.TypeNode> | undefined;
};
} & ts.Node;

export const isNodeWithType = (
node: NodeWithOptionalType,
Expand All @@ -90,8 +90,8 @@ export const isNodeWithTypeParameters = (
return "typeParameters" in node;
};

export type PropertySignatureWithStaticName = ts.PropertySignature &
NodeWithIdentifierName;
export type PropertySignatureWithStaticName = NodeWithIdentifierName &
ts.PropertySignature;

export const isPropertySignatureWithStaticName = (
node: ts.Node,
Expand Down
12 changes: 6 additions & 6 deletions src/shared/typeNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,29 @@ export type WellKnownTypeName =
| "unknown"
| "void";

export type TypeWithTypeArguments = ts.Type & {
export type TypeWithTypeArguments = {
typeArguments: ts.Type[];
};
} & ts.Type;

export const isTypeArgumentsType = (
type: ts.Type,
): type is TypeWithTypeArguments => {
return "typeArguments" in type && !!type.typeArguments;
};

export type TypeWithOptionalTypeArguments = ts.Type & {
export type TypeWithOptionalTypeArguments = {
typeArguments?: ts.Type[];
};
} & ts.Type;

export const isOptionalTypeArgumentsTypeNode = (
type: ts.Type,
): type is TypeWithOptionalTypeArguments => {
return "typeArguments" in type;
};

export type TypeWithIntrinsicName = ts.Type & {
export type TypeWithIntrinsicName = {
intrinsicName: WellKnownTypeName;
};
} & ts.Type;

export const isIntrinsicNameType = (
type: ts.Type,
Expand Down
Loading