Skip to content

Commit

Permalink
Adjusted eslint and prettier settings
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Jul 11, 2024
1 parent 58bd696 commit 2d96bec
Show file tree
Hide file tree
Showing 130 changed files with 1,275 additions and 1,978 deletions.
12 changes: 6 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
},
"extends": [
"next/core-web-vitals",
"plugin:storybook/recommended",
"prettier",
"plugin:deprecation/recommended"
],
"rules": {
"prettier/prettier": ["error"],
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
"error",
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
],
"no-console": ["error", { "allow": ["warn", "error"] }],
"quotes": ["error", "double"]
"no-console": ["error", { "allow": ["warn", "error"] }]
},
"plugins": ["unused-imports"],
"plugins": ["prettier", "unused-imports"],
"ignorePatterns": ["**/__generated__/**/*"]
}
}
4 changes: 2 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"arrowParens": "avoid",
"bracketSameLine": false,
"bracketSpacing": false,
"printWidth": 500,
"printWidth": 120,
"semi": false,
"singleAttributePerLine": true,
"singleAttributePerLine": false,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
Expand Down
434 changes: 217 additions & 217 deletions .yarn/releases/yarn-4.3.0.cjs → .yarn/releases/yarn-4.3.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.3.0.cjs
yarnPath: .yarn/releases/yarn-4.3.1.cjs
9 changes: 4 additions & 5 deletions app/@modal/(.)gallery/[...uuid]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ const Page = async ({params: {uuid}}: Props) => {
const prevImageIndex = paragraph.suGalleryImages?.[currentImageIndex - 1] ? currentImageIndex - 1 : -1
const nextImageIndex = paragraph.suGalleryImages?.[currentImageIndex + 1] ? currentImageIndex + 1 : -1

let galleryImages = mediaUuid ? paragraph.suGalleryImages?.filter(image => image.id === mediaUuid) : paragraph.suGalleryImages
let galleryImages = mediaUuid
? paragraph.suGalleryImages?.filter(image => image.id === mediaUuid)
: paragraph.suGalleryImages

galleryImages = galleryImages?.filter(image => !!image.suGalleryImage?.url)

Expand All @@ -45,10 +47,7 @@ const Page = async ({params: {uuid}}: Props) => {
/>
</picture>
{galleryImage.suGalleryCaption && (
<figcaption
id={captionId}
className="m-0 table-caption w-full caption-bottom bg-white p-5 text-right"
>
<figcaption id={captionId} className="m-0 table-caption w-full caption-bottom bg-white p-5 text-right">
{galleryImage.suGalleryCaption}
</figcaption>
)}
Expand Down
23 changes: 19 additions & 4 deletions app/[...slug]/metadata.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import {Maybe, NodeStanfordEvent, NodeStanfordNews, NodeStanfordPage, NodeStanfordPerson, NodeStanfordPolicy, NodeUnion, ParagraphStanfordWysiwyg, ParagraphUnion} from "@lib/gql/__generated__/drupal.d"
import {
Maybe,
NodeStanfordEvent,
NodeStanfordNews,
NodeStanfordPage,
NodeStanfordPerson,
NodeStanfordPolicy,
NodeUnion,
ParagraphStanfordWysiwyg,
ParagraphUnion,
} from "@lib/gql/__generated__/drupal.d"
import {Metadata} from "next"
import {decode} from "html-entities"

Expand Down Expand Up @@ -43,8 +53,11 @@ export const getNodeMetadata = (node: NodeUnion): Metadata => {
}

const getBasicPageMetaData = (node: NodeStanfordPage) => {
const pageTitleBannerImage = node.suPageBanner?.__typename === "ParagraphStanfordPageTitleBanner" && node.suPageBanner.suTitleBannerImage.mediaImage
const bannerImage = node.suPageBanner?.__typename === "ParagraphStanfordBanner" && node.suPageBanner.suBannerImage?.mediaImage
const pageTitleBannerImage =
node.suPageBanner?.__typename === "ParagraphStanfordPageTitleBanner" &&
node.suPageBanner.suTitleBannerImage.mediaImage
const bannerImage =
node.suPageBanner?.__typename === "ParagraphStanfordBanner" && node.suPageBanner.suBannerImage?.mediaImage
const image = node.suPageImage?.mediaImage || pageTitleBannerImage || bannerImage

const description = node.suPageDescription || getFirstText(node.suPageComponents)
Expand Down Expand Up @@ -133,7 +146,9 @@ const getPolicyMetaData = (node: NodeStanfordPolicy) => {
}

const getFirstText = (components?: Maybe<ParagraphUnion[]>) => {
const firstWysiwyg = components?.find(component => component.__typename === "ParagraphStanfordWysiwyg") as ParagraphStanfordWysiwyg
const firstWysiwyg = components?.find(
component => component.__typename === "ParagraphStanfordWysiwyg"
) as ParagraphStanfordWysiwyg
if (firstWysiwyg) {
return getCleanDescription(firstWysiwyg.suWysiwygText?.processed)
}
Expand Down
10 changes: 5 additions & 5 deletions app/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const ErrorPage = ({error, reset}: {error: Error; reset: () => void}) => {
return (
<div className="my-50 centered mt-32">
<h1>Something went wrong!</h1>
<p>Apologies, an error occurred when attempting to preset the page you are attempting to view. Please try a different path.</p>
<Button
buttonElem
onClick={() => reset()}
>
<p>
Apologies, an error occurred when attempting to preset the page you are attempting to view. Please try a
different path.
</p>
<Button buttonElem onClick={() => reset()}>
Try again
</Button>
</div>
Expand Down
20 changes: 7 additions & 13 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ const appleIcons: Icon[] = [60, 72, 76, 114, 120, 144, 152, 180].map(size => ({
}))

const icons: Icon[] = [16, 32, 96, 128, 192, 196].map(size => ({
url: size === 128 ? `https://www-media.stanford.edu/assets/favicon/favicon-${size}.png` : `https://www-media.stanford.edu/assets/favicon/favicon-${size}x${size}.png`,
url:
size === 128
? `https://www-media.stanford.edu/assets/favicon/favicon-${size}.png`
: `https://www-media.stanford.edu/assets/favicon/favicon-${size}x${size}.png`,
sizes: `${size}x${size}`,
}))

Expand Down Expand Up @@ -43,29 +46,20 @@ export const revalidate = false

const RootLayout = ({children, modal}: {children: React.ReactNode; modal: React.ReactNode}) => {
return (
<html
lang="en"
className={sourceSans3.className}
>
<html lang="en" className={sourceSans3.className}>
<UserAnalytics />
<DrupalWindowSync />
<body>
<nav aria-label="Skip Links">
<a
href="#main-content"
className="skiplink"
>
<a href="#main-content" className="skiplink">
Skip to main content
</a>
</nav>

<div className="flex min-h-screen flex-col">
<PageHeader />

<main
id="main-content"
className="mb-32 flex-grow"
>
<main id="main-content" className="mb-32 flex-grow">
{children}
</main>

Expand Down
5 changes: 1 addition & 4 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ const Home = async () => {
<article>
{entity.suPageBanner?.__typename === "ParagraphStanfordBanner" && (
<header>
<BannerParagraph
paragraph={entity.suPageBanner}
eagerLoadImage
/>
<BannerParagraph paragraph={entity.suPageBanner} eagerLoadImage />
</header>
)}
{entity.suPageComponents && <Rows components={entity.suPageComponents} />}
Expand Down
5 changes: 1 addition & 4 deletions app/preview/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ const PreviewPage = async ({params}: PageProps) => {

return (
<>
<EditorAlert
status={entity.status}
message="Unpublished Page"
/>
<EditorAlert status={entity.status} message="Unpublished Page" />
<NodePage node={entity} />
</>
)
Expand Down
5 changes: 1 addition & 4 deletions app/preview/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ const Layout = ({children}: {children: React.ReactNode}) => {
{inPreview && (
<>
<Editori11y />
<EditorAlert
status={false}
message="Preview Mode"
/>
<EditorAlert status={false} message="Preview Mode" />
</>
)}
{children}
Expand Down
29 changes: 14 additions & 15 deletions app/search/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,23 @@ const Page = async ({searchParams}: {searchParams?: {[_key: string]: string}}) =
return (
<div className="centered mt-32">
<div className="mx-auto 3xl:w-10/12">
<H1
className="mb-44"
id="page-title"
>
<H1 className="mb-44" id="page-title">
Search
</H1>

{siteSettingsConfig?.suSiteAlgoliaId && siteSettingsConfig?.suSiteAlgoliaIndex && siteSettingsConfig?.suSiteAlgoliaSearch && (
<>
<AlgoliaSearch
appId={siteSettingsConfig.suSiteAlgoliaId}
searchIndex={siteSettingsConfig.suSiteAlgoliaIndex}
searchApiKey={siteSettingsConfig.suSiteAlgoliaSearch}
initialUiState={initialState}
/>
<noscript>Please enable javascript to view search results</noscript>
</>
)}
{siteSettingsConfig?.suSiteAlgoliaId &&
siteSettingsConfig?.suSiteAlgoliaIndex &&
siteSettingsConfig?.suSiteAlgoliaSearch && (
<>
<AlgoliaSearch
appId={siteSettingsConfig.suSiteAlgoliaId}
searchIndex={siteSettingsConfig.suSiteAlgoliaIndex}
searchApiKey={siteSettingsConfig.suSiteAlgoliaSearch}
initialUiState={initialState}
/>
<noscript>Please enable javascript to view search results</noscript>
</>
)}
</div>
</div>
)
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"dependencies": {
"@formkit/auto-animate": "^0.8.2",
"@heroicons/react": "^2.1.5",
"@js-temporal/polyfill": "^0.4.4",
"@mui/base": "5.0.0-dev.20240529-082515-213b5e33ab",
"@next/third-parties": "^14.2.5",
"@tailwindcss/container-queries": "^0.1.1",
Expand All @@ -29,15 +28,12 @@
"clsx": "^2.1.1",
"decanter": "^7.3.0",
"drupal-jsonapi-params": "^2.3.1",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.5",
"graphql": "^16.9.0",
"graphql-request": "^7.1.0",
"graphql-tag": "^2.12.6",
"html-entities": "^2.5.2",
"html-react-parser": "^5.1.10",
"next": "^14.2.5",
"next-drupal": "^1.6.0",
"postcss": "^8.4.39",
"qs": "^6.12.3",
"react": "^18.3.1",
Expand Down Expand Up @@ -71,7 +67,11 @@
"@types/react-slick": "^0.23.13",
"concurrently": "^8.2.2",
"encoding": "^0.1.13",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.5",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-storybook": "^0.8.0",
"eslint-plugin-unused-imports": "^4.0.0",
"prettier": "^3.3.2",
Expand All @@ -81,5 +81,5 @@
"storybook-addon-module-mock": "^1.3.0",
"tsconfig-paths-webpack-plugin": "^4.1.0"
},
"packageManager": "[email protected].0"
"packageManager": "[email protected].1"
}
22 changes: 4 additions & 18 deletions src/components/algolia/algolia-search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ const HitList = () => {
return (
<ul className="list-unstyled">
{hits.map(hit => (
<li
key={hit.objectID}
className="border-b border-gray-300 last:border-0"
>
<li key={hit.objectID} className="border-b border-gray-300 last:border-0">
<DefaultHit hit={hit} />
</li>
))}
Expand Down Expand Up @@ -91,10 +88,7 @@ const SearchBox = (props?: UseSearchBoxProps) => {
}}
>
<div className="flex flex-col">
<label
className="font-bold"
htmlFor="search-input"
>
<label className="font-bold" htmlFor="search-input">
Keywords<span className="sr-only">&nbsp;Search</span>
</label>
<input
Expand All @@ -114,19 +108,11 @@ const SearchBox = (props?: UseSearchBoxProps) => {
</div>
<div className="flex gap-10">
<Button type="submit">Submit</Button>
<Button
secondary
type="reset"
className={query.length === 0 ? "hidden" : undefined}
>
<Button secondary type="reset" className={query.length === 0 ? "hidden" : undefined}>
Reset
</Button>
</div>
<div
className="sr-only"
aria-live="polite"
aria-atomic
>
<div className="sr-only" aria-live="polite" aria-atomic>
Showing results for {query}
</div>
</form>
Expand Down
13 changes: 10 additions & 3 deletions src/components/config-pages/global-message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,22 @@ const GlobalMessage = async () => {
{globalMessageConfig.suGlobalMsgLabel}:
</div>
<div>
{globalMessageConfig.suGlobalMsgHeader && <H2 id={globalMessageConfig.id}>{globalMessageConfig.suGlobalMsgHeader}</H2>}
{globalMessageConfig.suGlobalMsgHeader && (
<H2 id={globalMessageConfig.id}>{globalMessageConfig.suGlobalMsgHeader}</H2>
)}

<Wysiwyg
html={globalMessageConfig.suGlobalMsgMessage?.processed}
className={twMerge(
"[&_a.btn]:border-2 [&_a]:no-underline [&_a]:hocus:underline",
clsx({
"[&_a.btn]:border-white [&_a.btn]:bg-transparent [&_a]:text-white": !["warning", "plain"].includes(globalMessageConfig.suGlobalMsgType),
"[&_a.btn]:border-black [&_a.btn]:bg-transparent [&_a]:text-black [&_a]:hocus:text-black": ["warning", "plain"].includes(globalMessageConfig.suGlobalMsgType),
"[&_a.btn]:border-white [&_a.btn]:bg-transparent [&_a]:text-white": !["warning", "plain"].includes(
globalMessageConfig.suGlobalMsgType
),
"[&_a.btn]:border-black [&_a.btn]:bg-transparent [&_a]:text-black [&_a]:hocus:text-black": [
"warning",
"plain",
].includes(globalMessageConfig.suGlobalMsgType),
})
)}
/>
Expand Down
Loading

0 comments on commit 2d96bec

Please sign in to comment.