Skip to content

Commit

Permalink
eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
nsams committed Feb 15, 2025
1 parent 04b25ea commit 81b5033
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pnpm exec lint-staged

Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export function generateGrid(
targetDirectory,
gqlIntrospection,
}: { exportName: string; baseOutputFilename: string; targetDirectory: string; gqlIntrospection: IntrospectionQuery },
// eslint-disable-next-line @typescript-eslint/no-explicit-any

config: GridConfig<any>,
): GeneratorReturn {
const gqlType = config.gqlType;
Expand Down
18 changes: 12 additions & 6 deletions packages/admin/cms-admin/src/generator/future/generator.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { type GridColDef } from "@comet/admin";
import { type IconName } from "@comet/admin-icons";
import { type BlockInterface } from "@comet/blocks-admin";
import { GraphQLFileLoader } from "@graphql-tools/graphql-file-loader";
import { loadSchema } from "@graphql-tools/load";
import { type IconProps } from "@mui/material";
import { type GridCellParams, type GridFilterItem, type GridFilterOperator, type GridRenderCellParams, type GridSortDirection, type GridValidRowModel } from "@mui/x-data-grid";
import {
type GridCellParams,
type GridFilterItem,
type GridFilterOperator,
type GridRenderCellParams,
type GridSortDirection,
type GridValidRowModel,
} from "@mui/x-data-grid";
import { promises as fs } from "fs";
import { glob } from "glob";
import { introspectionFromSchema } from "graphql";
import { basename, dirname } from "path";
import { ComponentType, ReactNode } from "react";
import { type ComponentType, type ReactNode } from "react";

import { type BlockInterface } from "../../blocks/types";
import { type FinalFormFileUploadProps } from "../../form/file/FinalFormFileUpload";
import { generateForm } from "./generateForm";
import { generateGrid } from "./generateGrid";
Expand Down Expand Up @@ -80,7 +87,7 @@ export type FormFieldConfig<T> = (
helperText?: string;
readOnly?: boolean;
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any

export function isFormFieldConfig<T>(arg: any): arg is FormFieldConfig<T> {
return !isFormLayoutConfig(arg);
}
Expand All @@ -89,7 +96,6 @@ type OptionalNestedFieldsConfig<T> = {
type: "optionalNestedFields";
name: keyof T; // object name containing fields
checkboxLabel?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
fields: FormFieldConfig<any>[];
};
export type FormLayoutConfig<T> =
Expand All @@ -103,7 +109,7 @@ export type FormLayoutConfig<T> =
fields: (FormFieldConfig<T> | OptionalNestedFieldsConfig<T> | ComponentFormFieldConfig)[];
}
| OptionalNestedFieldsConfig<T>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any

export function isFormLayoutConfig<T>(arg: any): arg is FormLayoutConfig<T> {
return arg.type !== undefined && ["fieldSet", "optionalNestedFields"].includes(arg.type);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Imports } from "./generateImportsCode";
import { type Imports } from "./generateImportsCode";

// generated code is one level below config, this function converts relative imports to go one level up
export function convertConfigImport(imprt: { name: string; import: string }): Imports[0] {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import {
ArrayLiteralExpression,
ArrowFunction,
ExportedDeclarations,
Expression,
Identifier,
Node,
NumericLiteral,
ObjectLiteralExpression,
type ArrayLiteralExpression,
type ArrowFunction,
type ExportedDeclarations,
type Expression,
type Identifier,
type Node,
type NumericLiteral,
type ObjectLiteralExpression,
Project,
PropertyAssignment,
SourceFile,
StringLiteral,
type PropertyAssignment,
type SourceFile,
type StringLiteral,
SyntaxKind,
VariableDeclaration,
type VariableDeclaration,
} from "ts-morph";

import { GeneratorConfig } from "../generator";
import { type GeneratorConfig } from "../generator";

const project = new Project({
tsConfigFilePath: "tsconfig.json",
Expand Down

0 comments on commit 81b5033

Please sign in to comment.