Skip to content

Commit

Permalink
Update dependencies + improve ESLint/TS configs + delete orphan pages (
Browse files Browse the repository at this point in the history
…graphprotocol#486)

* Update dependencies (except Next and Nextra due to weird issues)

* Improve ESLint and TS configs

* Tweak `package.json` scripts

* Don’t consider a link on thegraph.com domain to be external

* Delete orphan pages (translated pages that no longer have a matching English page)
  • Loading branch information
benface authored Aug 25, 2023
1 parent 0e7758b commit 4bcdda6
Show file tree
Hide file tree
Showing 51 changed files with 1,284 additions and 7,077 deletions.
13 changes: 7 additions & 6 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const isVSCode = Boolean(process.env.VSCODE_PID)

/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
Expand All @@ -12,15 +14,14 @@ module.exports = {
{
files: ['*.{ts,tsx}'],
parserOptions: {
project: 'tsconfig.json',
},
rules: {
'@typescript-eslint/no-unsafe-argument': 'off', // lots of false positives for some reason
project: true,
},
},
{
// We lint only english pages because other languages will be translated from english
files: ['website/pages/en/**/*.{md,mdx}'],
// Only lint the English pages because the Markdown for the other languages is auto-generated from English (via Crowdin).
// But include all languages when running the ESLint extension in VS Code (in case the user has "eslint.validate": ["mdx"]),
// otherwise there will be random errors since the non-English files don't match any ruleset.
files: [`website/pages/${!isVSCode ? 'en/' : ''}**/*.{md,mdx}`],
parser: 'eslint-mdx',
processor: 'mdx/remark',
plugins: ['mdx'],
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
"scripts": {
"build": "NODE_OPTIONS='--max_old_space_size=4096' turbo run build",
"check": "pnpm typecheck && pnpm lint && pnpm prettier:check",
"check:fix": "pnpm typecheck && pnpm lint:fix",
"check:fix": "pnpm typecheck; pnpm lint:fix",
"dev": "turbo run dev --parallel",
"docker:build": "DOCKER_BUILDKIT=1 docker build . -t docs --no-cache",
"docker:clean": "docker builder prune",
"docker:up": "docker run --rm -it -p 3000:80 -v \"$(pwd)/nginx.conf:/etc/nginx/nginx.conf\" docs",
"export": "pnpm --filter @graphprotocol/docs export",
"lint": "eslint . --cache --ignore-path .gitignore --max-warnings 0",
"lint:fix": "eslint . --cache --ignore-path .gitignore --fix && pnpm prettier",
"lint:fix": "eslint . --cache --ignore-path .gitignore --fix; pnpm prettier",
"pre-commit": "lint-staged --concurrent false",
"pre-push": "pnpm build",
"prepare": "husky install && chmod +x .husky/*",
"prettier": "prettier . --log-level warn --write",
"prettier:check": "prettier . --log-level warn --check",
"prettier": "prettier . --write --list-different",
"prettier:check": "prettier . --check",
"start": "pnpm --filter @graphprotocol/docs start",
"typecheck": "turbo run typecheck"
},
Expand All @@ -26,15 +26,15 @@
"eslint": "^8.47.0",
"eslint-plugin-mdx": "^2.2.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.3",
"prettier": "^3.0.1",
"lint-staged": "^14.0.1",
"prettier": "^3.0.2",
"prettier-plugin-pkg": "^0.18.0",
"remark-frontmatter": "^4.0.1",
"remark-lint-first-heading-level": "^3.1.2",
"remark-lint-heading-increment": "^3.1.2",
"remark-lint-no-heading-punctuation": "^3.1.2",
"remark-lint-restrict-elements": "workspace:*",
"turbo": "^1.10.12",
"turbo": "^1.10.13",
"typescript": "^5.1.6"
},
"lint-staged": {
Expand Down
26 changes: 13 additions & 13 deletions packages/nextra-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,36 @@
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
"@edgeandnode/gds": "^2.8.0",
"@edgeandnode/organisms": "^2.9.0",
"@emotion/react": "^11.10.6",
"next": "^13.4.5",
"next-seo": "^5.15.0",
"nextra": "^2.7.1",
"react-dom": "^18.2.0",
"theme-ui": "^0.15.5"
"@edgeandnode/gds": "^2.9.3",
"@edgeandnode/go": "^3.0.3",
"@emotion/react": "^11.11",
"next": "^13",
"next-seo": "^6",
"nextra": "^2.7",
"react-dom": "^18.2",
"theme-ui": "^0.16"
},
"dependencies": {
"@docsearch/react": "^3.5.1",
"@docsearch/react": "^3.5.2",
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-visually-hidden": "^1.0.3",
"lodash": "^4.17.21",
"react-intersection-observer": "^9.5.2",
"react-use": "^17.4.0"
},
"devDependencies": {
"@edgeandnode/gds": "^2.9.0",
"@edgeandnode/organisms": "^2.10.0",
"@edgeandnode/gds": "^2.9.3",
"@edgeandnode/go": "^3.0.3",
"@emotion/react": "^11.11.1",
"@types/lodash": "^4.14.197",
"@types/react": "^18.2.20",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"next": "13.4.12",
"next-seo": "^6.1.0",
"nextra": "2.7.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"theme-ui": "^0.16.0",
"theme-ui": "^0.16.1",
"tsup": "^7.2.0"
},
"sideEffects": false
Expand Down
2 changes: 1 addition & 1 deletion packages/nextra-theme/src/components/EditPageLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const EditPageLink = ({ mobile = false, ...props }: EditPageLinkProps) =>
const path = filePath.startsWith('https')
? filePath
: `https://github.com/graphprotocol/docs/blob/main/website/pages/${
['en', '[locale]'].includes(fileLocale) ? fileLocale : 'en'
fileLocale && ['en', '[locale]'].includes(fileLocale) ? fileLocale : 'en'
}/${filePathSegments.join('/')}`
return (
<ButtonOrLink
Expand Down
2 changes: 1 addition & 1 deletion packages/nextra-theme/src/components/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const BaseHeading = ({ level, id, children, ...props }: HeadingProps) => {
transition: buildTransition('OPACITY'),
}}
>
{/* Non-breaking invisible space, to prevent a line break between the `#` and the previous word */}
{/* Zero-width non-breaking space, to prevent a line break between the `#` and the previous word */}
&#8288;
<LinkInline href={`#${id}`}>
<span aria-hidden="true">#</span>
Expand Down
6 changes: 3 additions & 3 deletions packages/nextra-theme/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { MDXProvider } from 'nextra/mdx'
import { Item, normalizePages } from 'nextra/normalize-pages'
import { ReactElement, useCallback, useMemo } from 'react'
import { useSet } from 'react-use'
import { ThemeUIStyleObject } from 'theme-ui'
import { ThemeUICSSObject } from 'theme-ui'

import { Divider, DividerProps, Flex, Icon, Spacing, useI18n } from '@edgeandnode/gds'
import { NPSForm } from '@edgeandnode/organisms'
import { NPSForm } from '@edgeandnode/go'

import {
Callout,
Expand Down Expand Up @@ -54,7 +54,7 @@ const mdxComponents = {
VideoEmbed,
}

const mdxStyles: ThemeUIStyleObject = {
const mdxStyles: ThemeUICSSObject = {
overflowWrap: 'break-word',
'img + em': {
mt: Spacing['16px'],
Expand Down
14 changes: 4 additions & 10 deletions packages/nextra-theme/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "es2016",
"module": "ESNext",
"target": "es2017",
"declaration": false,
"noEmit": true,
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"allowJs": true,
"incremental": false,
"jsx": "react-jsx",
"jsxImportSource": "theme-ui",
"moduleResolution": "node",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"resolveJsonModule": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
Expand Down
Loading

0 comments on commit 4bcdda6

Please sign in to comment.