Skip to content

Commit

Permalink
update prettier/tailwind/eslint configs (#1786)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
dimaMachina and github-actions[bot] authored Nov 8, 2024
1 parent b60fc55 commit a3931b4
Show file tree
Hide file tree
Showing 24 changed files with 1,392 additions and 236 deletions.
5 changes: 5 additions & 0 deletions .changeset/@theguild_components-1786-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@theguild/components": patch
---
dependencies updates:
- Updated dependency [`@theguild/tailwind-config@0.6.0` ↗︎](https://www.npmjs.com/package/@theguild/tailwind-config/v/0.6.0) (from `0.6.0-alpha-20241106003557-2c94714753ba2342f442f836b4683119985ee2c5`, in `peerDependencies`)
18 changes: 1 addition & 17 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ module.exports = {
'@theguild/eslint-config/yml',
// '@theguild/eslint-config/mdx',
'plugin:tailwindcss/recommended',
// 'plugin:storybook/recommended', // broken in ESLint 9
'plugin:storybook/recommended',
],
parserOptions: {
project: ['tsconfig.eslint.json', 'website/tsconfig.json', 'packages/*/tsconfig.json'],
},
rules: {
'tailwindcss/classnames-order': 'off', // conflicts with official prettier-plugin-tailwindcss and tailwind v3
// set more strict to highlight in editor
Expand All @@ -38,13 +35,6 @@ module.exports = {
whitelist: [
// TODO: find a way to fix it and remove these classes since they are imported somewhere and are used
'line',
'aa-ItemLink',
'aa-ItemContent',
'aa-ItemContentBody',
'aa-ItemContentTitle',
'aa-ItemContentSubtitle',
'aa-SourceHeader',
'aa-SourceHeaderTitle',
'hive-focus',
'hive-focus-within',
'@container', // Tailwind ESLint Plugin doesn't see the Container Queries classes but it does see prefixes like @sm:
Expand All @@ -65,11 +55,5 @@ module.exports = {
'import/extensions': ['error', { js: 'never', json: 'always' }],
},
},
{
files: ['*.config.js'],
rules: {
'import/no-default-export': 'off',
},
},
],
};
7 changes: 0 additions & 7 deletions .prettierrc.cjs

This file was deleted.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"@storybook/react": "8.2.9",
"@storybook/theming": "8.2.9",
"@svgr/webpack": "8.1.0",
"@theguild/eslint-config": "0.12.1",
"@theguild/prettier-config": "2.0.7",
"@theguild/tailwind-config": "0.6.0-alpha-20241106003557-2c94714753ba2342f442f836b4683119985ee2c5",
"@theguild/eslint-config": "0.13.0",
"@theguild/prettier-config": "3.0.0",
"@theguild/tailwind-config": "0.6.0",
"@types/jest-image-snapshot": "6.4.0",
"@types/react": "18.3.12",
"@types/react-paginate": "7.1.4",
Expand All @@ -44,7 +44,7 @@
"husky": "9.1.6",
"jest-image-snapshot": "6.4.0",
"lint-staged": "15.2.10",
"next-themes": "0.4.3",
"next-themes": "0.3.0",
"postcss": "8.4.47",
"postcss-loader": "8.1.1",
"prettier": "3.3.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"types:check": "tsc --noEmit"
},
"peerDependencies": {
"@theguild/tailwind-config": "0.6.0-alpha-20241106003557-2c94714753ba2342f442f836b4683119985ee2c5",
"@theguild/tailwind-config": "0.6.0",
"next": "^13 || ^14 || ^15.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand All @@ -81,7 +81,7 @@
"devDependencies": {
"@svgr/babel-plugin-remove-jsx-attribute": "^8.0.0",
"@theguild/editor": "workspace:*",
"@theguild/tailwind-config": "0.6.0-alpha-20241106003557-2c94714753ba2342f442f836b4683119985ee2c5",
"@theguild/tailwind-config": "0.6.0",
"@types/dedent": "0.7.2",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/anchor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import NextLink from 'next/link';
import clsx from 'clsx';
import { ILink } from '../types/components';

export interface AnchorProps extends ILink {}
export type AnchorProps = ILink;
export const Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(function Anchor(
{ href = '', children, newWindow, sameSite, className, ...props },
forwardedRef,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/cookies-consent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState } from 'react';
import { cn } from '../cn';
import { CallToAction } from './call-to-action';

export interface CookiesConsentProps extends React.HTMLAttributes<HTMLElement> {}
export type CookiesConsentProps = React.HTMLAttributes<HTMLElement>;
export function CookiesConsent(props: CookiesConsentProps) {
const [consented, setConsented] = useState(() => localStorage.getItem('cookies') === 'true');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ArrowIcon } from './icons';
import { TextLink } from './text-link';
import { MainProductCard } from './tools-and-libraries-cards';

export interface ExploreMainProductCardsProps extends HTMLAttributes<HTMLDivElement> {}
export type ExploreMainProductCardsProps = HTMLAttributes<HTMLDivElement>;

export function ExploreMainProductCards({ className, ...rest }: ExploreMainProductCardsProps) {
return (
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/components/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { FC, ReactElement, SVGProps } from 'react';
import { clsx } from 'clsx';
import { GuildLogo, TheGuild } from '../logos';
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/hive-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
YouTubeIcon,
} from './icons';

export interface HiveFooterProps extends IFooterExtendedProps {}
export type HiveFooterProps = IFooterExtendedProps;

export function HiveFooter({ className, logo, resources = [], sameSite }: HiveFooterProps) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export const ProductsMenu = React.forwardRef<HTMLDivElement, ProductsMenuProps>(
);
ProductsMenu.displayName = 'ProductsMenu';

interface MenuContentColumnsProps extends React.HTMLAttributes<HTMLDivElement> {}
type MenuContentColumnsProps = React.HTMLAttributes<HTMLDivElement>;
const MenuContentColumns = forwardRef(
(props: MenuContentColumnsProps, ref: React.ForwardedRef<HTMLDivElement>) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/stud.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cn } from '../cn';

export interface StudProps extends React.HTMLAttributes<HTMLElement> {}
export type StudProps = React.HTMLAttributes<HTMLElement>;
export function Stud(props: StudProps) {
return (
<div
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/text-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { cn } from '../cn';
import { Anchor, AnchorProps } from './anchor';
import { ArrowIcon } from './icons';

export interface TextLinkProps extends AnchorProps {}
export type TextLinkProps = AnchorProps;

export function TextLink({ className, children, ...rest }: TextLinkProps) {
const hasArrow =
Expand Down
9 changes: 0 additions & 9 deletions packages/components/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
declare module '@next/bundle-analyzer' {
import { NextConfig } from 'next';

export default function nextBundleAnalyzer(config: {
enabled: boolean;
}): (nextConfig: NextConfig) => NextConfig;
}

declare module 'next-videos' {
import { NextConfig } from 'next';

export default function nextVideos(nextConfig: NextConfig): NextConfig;
}

declare module '*.svg' {
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { FC, SVGProps } from 'react';
export const ReactComponent: FC<SVGProps<SVGElement>>;
const src: string;
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/icon.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { FC, SVGProps } from 'react';

declare const ReactComponent: FC<SVGProps<SVGElement>>;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/logos/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export { ReactComponent as YogaLogo } from './yoga.svg';
export { ReactComponent as HiveCombinationMark } from './hive-combination-mark.svg';
export { ReactComponent as GraphQLFoundationLogo } from './graphql-foundation.svg';

export interface LettermarkLogoProps extends HTMLAttributes<HTMLElement> {}
export type LettermarkLogoProps = HTMLAttributes<HTMLElement>;
const createLettermarkLogo = (text: string) => {
function LettermarkLogo(props: LettermarkLogoProps) {
return (
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/products.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { FC, HTMLProps, SVGProps } from 'react';
import { MenuItem } from 'nextra/normalize-pages';
import { cn } from './cn';
Expand Down
49 changes: 1 addition & 48 deletions packages/editor/src/editor/editor.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { useRef } from 'react';
import { Meta, StoryObj } from '@storybook/react';
import { SchemaDiffEditor } from './schema-diff-editor';
import { SchemaEditor, SchemaEditorProps } from './schema-editor';
import { SchemaEditorApi } from './use-schema-services';
import { debugHoverSource, showWidgetInPosition } from './utils';

const TEST_SCHEMA = `type Query {
Expand Down Expand Up @@ -31,52 +29,7 @@ export default {
component: SchemaEditor,
} satisfies Meta<typeof SchemaEditor>;

type Story = StoryObj<typeof SchemaTemplate>;

function SchemaTemplate(props: SchemaEditorProps) {
const ref = useRef<SchemaEditorApi>(null);

return (
<div>
<button
style={{
margin: 10,
padding: 5,
background: 'lightgray',
borderRadius: 10,
}}
onClick={() => {
if (ref.current) {
const identifier = prompt('What type are you looking for?', 'Query');
if (identifier) {
ref.current.jumpToType(identifier);
}
}
}}
>
Jump To Type
</button>
<button
style={{
margin: 10,
padding: 5,
background: 'lightgray',
borderRadius: 10,
}}
onClick={() => {
if (ref.current) {
const identifier = prompt('What type+field are you looking for?', 'Query.me');
const [typeName, fieldName] = identifier?.split('.') || [];
ref.current.jumpToField(typeName, fieldName);
}
}}
>
Jump To Field
</button>
<SchemaEditor ref={ref} {...props} />
</div>
);
}
type Story = StoryObj<SchemaEditorProps>;

export const BasicSchemaEditor: Story = {
args: {
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/editor/enriched-language-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class EnrichedLanguageService extends LanguageService {
sources.map(async source => {
try {
return await source.forNode(info);
} catch (e) {
} catch {
return null;
}
}),
Expand Down
Loading

0 comments on commit a3931b4

Please sign in to comment.