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

update eslint to 9 #3658

Merged
merged 10 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix
  • Loading branch information
dimaMachina committed Jul 25, 2024
commit c050763280aeefb3b0a21f507f1fcacb8e42d978
20 changes: 11 additions & 9 deletions packages/graphiql-react/src/icons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const DeprecatedArgumentIcon = generateIcon(_DeprecatedArgumentIcon);
export const DeprecatedEnumValueIcon = generateIcon(_DeprecatedEnumValueIcon);
export const DeprecatedFieldIcon = generateIcon(_DeprecatedFieldIcon);
export const DirectiveIcon = generateIcon(_DirectiveIcon);
export const DocsFilledIcon = generateIcon(_DocsFilledIcon, 'filled docs icon');
export const DocsFilledIcon = generateIcon(_DocsFilledIcon);
export const DocsIcon = generateIcon(_DocsIcon);
export const EnumValueIcon = generateIcon(_EnumValueIcon);
export const FieldIcon = generateIcon(_FieldIcon);
Expand All @@ -58,22 +58,24 @@ export const PrettifyIcon = generateIcon(_PrettifyIcon);
export const ReloadIcon = generateIcon(_ReloadIcon);
export const RootTypeIcon = generateIcon(_RootTypeIcon);
export const SettingsIcon = generateIcon(_SettingsIcon);
export const StarFilledIcon = generateIcon(_StarFilledIcon, 'filled star icon');
export const StarFilledIcon = generateIcon(_StarFilledIcon);
export const StarIcon = generateIcon(_StarIcon);
export const StopIcon = generateIcon(_StopIcon);
export const TrashIcon = generateIcon(_TrashIcon);
export const TypeIcon = generateIcon(_TypeIcon);

function generateIcon(
RawComponent: FC<SVGProps<SVGSVGElement> & { title?: string }>,
title = RawComponent.name
// Icon component name starts with `Svg${CamelCaseFilename without .svg}`
.replace('Svg', '')
// Insert a space before all caps
.replaceAll(/([A-Z])/g, ' $1')
.trimStart()
.toLowerCase() + ' icon',
): FC<ComponentProps<'svg'>> {
const title =
RawComponent.name
// Icon component name starts with `Svg${CamelCaseFilename without .svg}`
.replace('Svg', '')
// Insert a space before all caps
.replaceAll(/([A-Z])/g, ' $1')
.trimStart()
.toLowerCase() + ' icon';

function IconComponent(props: ComponentProps<'svg'>) {
return <RawComponent title={title} {...props} />;
}
Expand Down
3 changes: 1 addition & 2 deletions packages/graphiql-react/src/icons/trash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"packages/*/src/*/__tests__/**/*.ts",
"packages/*/src/__tests__/**/*.ts",
"packages/*/vite.config.mts",
"packages/*/vitest.config.ts",
"packages/*/vitest.config.mts",
"examples/*/vite.config.ts",
"packages/graphiql/src/components/__tests__/**/*.ts",
"packages/graphiql/src/components/__tests__/**/*.tsx",
Expand Down
Loading
Loading