diff --git a/.eslintrc.js b/.eslintrc.js index 8f3e77e7..9a5b99f9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,6 +2,7 @@ module.exports = { extends: ['@blockstack/eslint-config'], parser: '@typescript-eslint/parser', parserOptions: { + createDefaultProgram: true, project: './tsconfig.json', }, env: { @@ -15,4 +16,14 @@ module.exports = { context: true, jestPuppeteer: true, }, + rules: { + '@typescript-eslint/no-unsafe-assignment': 0, + '@typescript-eslint/no-unsafe-member-access': 0, + '@typescript-eslint/no-unsafe-call': 0, + '@typescript-eslint/no-unsafe-return': 0, + '@typescript-eslint/explicit-module-boundary-types': 0, + '@typescript-eslint/ban-ts-comment': 0, + '@typescript-eslint/ban-ts-ignore': 0, + '@typescript-eslint/restrict-template-expressions': 0, + }, }; diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 2c8cd56e..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Deploy preview -on: pull_request - -jobs: - vercel-deployment: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Vercel action - uses: amondnet/vercel-action@master - id: vercel-deployment-preview - with: - vercel-token: ${{ secrets.VERCEL_TOKEN }} - vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} - vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} - scope: ${{ secrets.VERCEL_SCOPE }} - - name: Comment on PR - uses: actions/github-script@v2 - id: comment - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const firstLine = `The Blockstack docs have been deployed with Vercel using the code from this PR!`; - const { data } = await github.issues.listComments({ - ...context.repo, - issue_number: context.issue.number, - }); - const vercelPreviewURLComment = data.find((comment) => - comment.body.includes(firstLine) - ); - const commentId = vercelPreviewURLComment && vercelPreviewURLComment.id || undefined; - const commentBody = ` - #### Deploy previews - ${firstLine} - - - [Blockstack docs](${{ steps.vercel-deployment-preview.outputs.preview-url }}) - - Built with commit ${context.sha}. - `; - if(context.issue.number){ - if (commentId) { - await github.issues.updateComment({ - ...context.repo, - comment_id: commentId, - body: commentBody, - }); - } else { - await github.issues.createComment({ - ...context.repo, - issue_number: context.issue.number, - body: commentBody, - }); - } - } diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..5b356f4a --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,37 @@ +name: Code quality +on: [push] + +jobs: + code_quality: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set Node Version + uses: actions/setup-node@v1.4.2 + with: + node-version: 14 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Check Cache + uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install deps + run: yarn --frozen-lockfile + if: steps.yarn-cache.outputs.cache-hit != 'true' + + - name: Lint + run: yarn lint + + - name: Typecheck + run: yarn typecheck diff --git a/package.json b/package.json index 8b132503..dda31655 100755 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "algoliasearch": "^4.3.0", "babel-plugin-macros": "^2.8.0", "docsearch.js": "^2.6.3", + "eslint": "^7.4.0", "fathom-client": "^3.0.0", "front-matter": "^4.0.2", "fs-extra": "^9.0.1", @@ -68,6 +69,7 @@ "use-events": "^1.4.2" }, "devDependencies": { + "@blockstack/eslint-config": "^1.0.5", "@blockstack/prettier-config": "^0.0.6", "@next/bundle-analyzer": "^9.4.4", "babel-plugin-styled-components": "^1.10.7", @@ -90,7 +92,9 @@ "lint:eslint": "eslint \"src/**/*.{ts,tsx}\" -f unix", "lint:fix": "eslint \"src/**/*.{ts,tsx}\" -f unix --fix", "lint:prettier": "prettier --check \"src/**/*.{ts,tsx,md,mdx}\" *.js", - "lint:prettier:fix": "prettier --write \"src/**/*.{ts,tsx,md,mdx}\" *.js" + "lint:prettier:fix": "prettier --write \"src/**/*.{ts,tsx,md,mdx}\" *.js", + "typecheck": "tsc --noEmit", + "typecheck:watch": "npm run typecheck -- --watch" }, "resolutions": { "preact": "^10.4.4" diff --git a/src/common/hooks/use-fathom.ts b/src/common/hooks/use-fathom.ts index 0714667f..e4c8c5d9 100644 --- a/src/common/hooks/use-fathom.ts +++ b/src/common/hooks/use-fathom.ts @@ -2,6 +2,7 @@ import { useEffect } from 'react'; import { useRouter } from 'next/router'; import * as Fathom from 'fathom-client'; +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export const useFathom = () => { const router = useRouter(); diff --git a/src/components/clarity-ref.tsx b/src/components/clarity-ref.tsx index b8a3d82a..b9a0ea45 100644 --- a/src/components/clarity-ref.tsx +++ b/src/components/clarity-ref.tsx @@ -45,7 +45,7 @@ export const ClarityFunctionReference = () => Example {/* @ts-ignore*/} - + ); diff --git a/src/components/feedback.tsx b/src/components/feedback.tsx new file mode 100644 index 00000000..1183ddf8 --- /dev/null +++ b/src/components/feedback.tsx @@ -0,0 +1,28 @@ +import React from 'react'; +import { Box, BoxProps, color, Flex, space, Stack, themeColor } from '@blockstack/ui'; +import { MDXComponents } from '@components/mdx'; +import { SadIcon, NeutralIcon, HappyIcon } from '@components/icons/feedback'; +import { useHover } from 'use-events'; +import { border } from '@common/utils'; + +const Icon: React.FC }> = ({ icon: IconComponent, ...props }) => { + const [isHovered, bind] = useHover(); + return ( + + + + ); +}; + +export const FeedbackSection: React.FC = props => { + return ( + + Was this page helpful? + + + + + + + ); +}; diff --git a/src/components/footer.tsx b/src/components/footer.tsx index 36785a39..652ec89d 100644 --- a/src/components/footer.tsx +++ b/src/components/footer.tsx @@ -1,31 +1,16 @@ -import { Box, Flex } from '@blockstack/ui'; -import { Text } from '@components/typography'; import React from 'react'; -import { Pagination } from './pagination'; -import { Link } from '@components//mdx'; +import { Pagination } from '@components/pagination'; +import { Section, SectionWrapper } from '@components/home/common'; +import { FeedbackSection } from '@components/feedback'; const Footer = ({ hidePagination, ...rest }: any) => { return ( - <> - {!hidePagination && } - {/**/} - {/* */} - {/* Blockstack Design System*/} - {/* */} - {/* */} - {/* */} - {/* Blockstack PBC*/} - {/* */} - {/* */} - {/**/} - +
+ + + + +
); }; diff --git a/src/components/icons/feedback.tsx b/src/components/icons/feedback.tsx new file mode 100644 index 00000000..7f7737ca --- /dev/null +++ b/src/components/icons/feedback.tsx @@ -0,0 +1,120 @@ +import React from 'react'; +import { Box, BoxProps, transition } from '@blockstack/ui'; +import { SVGProps } from 'react'; + +export type SvgProps = React.FC>; + +export const SadIcon: SvgProps = ({ bg = '#E1E3E8', ...props }) => ( + + + + + + +); + +export const NeutralIcon: SvgProps = ({ bg = '#E1E3E8', ...props }) => ( + + + + + + +); + +export const HappyIcon: SvgProps = ({ bg = '#E1E3E8', ...props }) => ( + + + + + + +); diff --git a/src/components/layouts/docs-layout.tsx b/src/components/layouts/docs-layout.tsx index 76682159..b867c5d6 100644 --- a/src/components/layouts/docs-layout.tsx +++ b/src/components/layouts/docs-layout.tsx @@ -271,7 +271,7 @@ const DocsLayout: React.FC<{ isHome?: boolean }> = ({ children, isHome }) => { {children} -