Skip to content

Commit 8a19ff6

Browse files
committed
fix eslint errors with website
1 parent 7d24d2a commit 8a19ff6

File tree

8 files changed

+55
-18
lines changed

8 files changed

+55
-18
lines changed

eslint.config.mjs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ export default tsConfig(
2121
'npmDist',
2222
'npmEsmDist',
2323
'denoDist',
24-
'websiteDist',
25-
'website',
24+
'website/.next',
2625
'integrationTests/ts/*.ts',
2726
],
2827
},
@@ -881,8 +880,26 @@ export default tsConfig(
881880
rules: {
882881
...reactHooksPlugin.configs.recommended.rules,
883882
'no-restricted-exports': 'off',
883+
'import/extensions': [
884+
'error',
885+
'ignorePackages',
886+
{
887+
ts: 'never',
888+
tsx: 'never',
889+
},
890+
],
884891
'import/no-default-export': 'off',
892+
'import/no-extraneous-dependencies': 'off',
885893
'import/no-nodejs-modules': 'off',
894+
'n/no-missing-import': 'off', // allows linting from root of project when website packages are not installed
895+
'n/file-extension-in-import': [
896+
'error',
897+
'always',
898+
{
899+
'': 'never',
900+
},
901+
],
902+
'import/unambiguous': 'off',
886903
},
887904
},
888905
);
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import nextra from 'nextra';
2-
import path from 'node:path';
31
import fs from 'node:fs';
2+
import path from 'node:path';
3+
4+
import nextra from 'nextra';
45

56
const fileContents = fs.readFileSync('./vercel.json', 'utf-8');
67
const vercel = JSON.parse(fileContents);
@@ -31,7 +32,7 @@ export default withNextra({
3132
});
3233
return config;
3334
},
34-
redirects: async () => vercel.redirects,
35+
redirects: () => vercel.redirects,
3536
output: 'export',
3637
images: {
3738
loader: 'custom',
@@ -40,6 +41,7 @@ export default withNextra({
4041
},
4142
transpilePackages: ['next-image-export-optimizer'],
4243
env: {
44+
/* eslint-disable camelcase */
4345
nextImageExportOptimizer_imageFolderPath: 'public/images',
4446
nextImageExportOptimizer_exportFolderPath: 'out',
4547
nextImageExportOptimizer_quality: '75',
@@ -52,6 +54,7 @@ export default withNextra({
5254
// If you want to cache the remote images, you can set the time to live of the cache in seconds.
5355
// The default value is 0 seconds.
5456
nextImageExportOptimizer_remoteImageCacheTTL: '0',
57+
/* eslint-enable camelcase */
5558
},
5659
trailingSlash: true,
5760
});

website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "website",
33
"version": "0.0.0",
44
"description": "The GraphQL.JS documentation website",
5+
"type": "module",
56
"private": true,
67
"directories": {
78
"doc": "docs"

website/pages/_app.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
/* eslint-disable camelcase, new-cap, react/react-in-jsx-scope, react/no-unknown-property */
2+
13
import type { AppProps } from 'next/app';
24
import { Roboto_Flex, Roboto_Mono } from 'next/font/google';
35

6+
// eslint-disable-next-line import/no-unassigned-import
47
import '../css/globals.css';
58

69
const robotoFlex = Roboto_Flex({

website/pages/_document.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { Html, Head, Main, NextScript } from 'next/document';
1+
/* eslint-disable react/react-in-jsx-scope */
2+
3+
import { Head, Html, Main, NextScript } from 'next/document';
24

35
export default function Document() {
46
return (

website/postcss.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
module.exports = {
1+
const config = {
22
plugins: {
33
'tailwindcss/nesting': {},
44
tailwindcss: {},
55
autoprefixer: {},
66
},
77
};
8+
9+
export default config;

website/tailwind.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import typography from '@tailwindcss/typography';
22

3-
module.exports = {
3+
const config = {
44
content: [
55
'./pages/**/*.{ts,tsx,mdx}',
66
'./icons/**/*.{ts,tsx,mdx}',
@@ -38,3 +38,5 @@ module.exports = {
3838
plugins: [typography],
3939
darkMode: ['class', 'html[class~="dark"]'],
4040
};
41+
42+
export default config;

website/theme.config.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
import React from 'react';
2-
import { DocsThemeConfig, ThemeSwitch, useConfig } from 'nextra-theme-docs';
1+
/* eslint-disable internal-rules/only-ascii */
32
import NextLink from 'next/link';
3+
import { useRouter } from 'next/router';
4+
import type { DocsThemeConfig } from 'nextra-theme-docs';
5+
import { ThemeSwitch, useConfig } from 'nextra-theme-docs';
6+
import React from 'react';
7+
48
import {
9+
DiscordIcon,
10+
GitHubIcon,
511
GraphQLWordmarkLogo,
612
StackOverflowIcon,
7-
GitHubIcon,
8-
DiscordIcon,
913
TwitterIcon,
1014
} from './icons/index';
11-
import { useRouter } from 'next/router';
1215

1316
const graphQLLogo = (
1417
<GraphQLWordmarkLogo className="h-8 nextra-logo" title="GraphQL" />
@@ -23,7 +26,7 @@ function List({
2326
items,
2427
}: {
2528
title: string;
26-
items: { title: string; url: string }[];
29+
items: Array<{ title: string; url: string }>;
2730
}) {
2831
return (
2932
<ul className="text-sm flex flex-col gap-4 max-lg:w-[46%]">
@@ -196,14 +199,18 @@ const cfg: DocsThemeConfig = {
196199
<>
197200
<title>{title}</title>
198201
<meta property="og:title" content={title} />
199-
{description && (
202+
{description != null && description !== '' && (
200203
<>
201204
<meta name="description" content={description} />
202205
<meta property="og:description" content={description} />
203206
</>
204207
)}
205-
{canonical && <link rel="canonical" href={canonical} />}
206-
{image && <meta name="og:image" content={image} />}
208+
{canonical != null && canonical !== '' && (
209+
<link rel="canonical" href={canonical} />
210+
)}
211+
{image != null && image !== '' && (
212+
<meta name="og:image" content={image} />
213+
)}
207214
<meta property="og:image" content="/img/og-image.png" />
208215
<meta property="twitter:site" content="@graphql" />
209216
</>
@@ -212,7 +219,7 @@ const cfg: DocsThemeConfig = {
212219
banner: {
213220
content: (
214221
<>
215-
🎬 That's a Wrap for GraphQLConf 2024! • Watch the Videos •{' '}
222+
🎬 That&apos;s a Wrap for GraphQLConf 2024! • Watch the Videos •{' '}
216223
<NextLink
217224
href="https://graphql.org/conf/2024"
218225
className="underline after:content-['_→'] after:font-sans"

0 commit comments

Comments
 (0)