diff --git a/.eslintrc.js b/.eslintrc.js index 476addfc4..28f342bbd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,38 +1,38 @@ module.exports = { - parser: '@typescript-eslint/parser', + parser: "@typescript-eslint/parser", parserOptions: { ecmaVersion: 6, - sourceType: 'module', + sourceType: "module", ecmaFeatures: { jsx: true, }, project: `./tsconfig.json`, }, - plugins: ['@typescript-eslint', 'import', 'unicorn'], - extends: ['react-app'], + plugins: ["@typescript-eslint", "import", "unicorn"], + extends: ["react-app"], rules: { - 'react/react-in-jsx-scope': 'off', // React is always in scope with Blitz - 'jsx-a11y/anchor-is-valid': 'off', //Doesn't play well with Blitz/Next usage - 'import/first': 'off', - 'import/no-default-export': 'error', - 'require-await': 'error', - 'no-async-promise-executor': 'error', - 'unicorn/filename-case': [ - 'error', + "react/react-in-jsx-scope": "off", // React is always in scope with Blitz + "jsx-a11y/anchor-is-valid": "off", //Doesn't play well with Blitz/Next usage + "import/first": "off", + "import/no-default-export": "error", + "require-await": "error", + "no-async-promise-executor": "error", + "unicorn/filename-case": [ + "error", { - case: 'kebabCase', + case: "kebabCase", }, ], - '@typescript-eslint/no-floating-promises': 'error', + "@typescript-eslint/no-floating-promises": "error", }, - ignorePatterns: ['packages/cli/', 'packages/generator/templates'], + ignorePatterns: ["packages/cli/", "packages/generator/templates"], overrides: [ { - files: ['examples/**', 'packages/gui/**'], + files: ["examples/**", "packages/gui/**"], rules: { - 'import/no-default-export': 'off', - 'unicorn/filename-case': 'off', - '@typescript-eslint/no-floating-promises': 'off', + "import/no-default-export": "off", + "unicorn/filename-case": "off", + "@typescript-eslint/no-floating-promises": "off", }, }, ], diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index fe561a1d9..7ae6d91fc 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,4 +1,4 @@ github: blitz-js -custom: ['https://paypal.me/thebayers'] +custom: ["https://paypal.me/thebayers"] open_collective: blitzjs patreon: flybayer diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index e8e9bfbed..ec5524172 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,9 +1,9 @@ --- name: Feature/change request about: Something new or better! -title: '' -labels: '' -assignees: '' +title: "" +labels: "" +assignees: "" --- ### What do you want and why? diff --git a/.github/checkInstallTime.js b/.github/checkInstallTime.js index 5db709092..9a811ed53 100755 --- a/.github/checkInstallTime.js +++ b/.github/checkInstallTime.js @@ -1,7 +1,7 @@ #!/usr/bin/env node -const fs = require('fs') -const yarnOut = fs.readFileSync(0, {encoding: 'utf8'}) +const fs = require("fs") +const yarnOut = fs.readFileSync(0, {encoding: "utf8"}) const [installTimeString] = /(?<=^Done in )\d+\.\d+(?=s\.$)/m.exec(yarnOut) const installTime = Number(installTimeString) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 10010acc5..fa84dfc17 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: '12.16.1' + node-version: "12.16.1" - name: Test Install time run: | cd ../ && mkdir test && cd test @@ -37,7 +37,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: '12.16.1' + node-version: "12.16.1" - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" diff --git a/__mocks__/fs.js b/__mocks__/fs.js index ec43c8669..fd7ed6831 100644 --- a/__mocks__/fs.js +++ b/__mocks__/fs.js @@ -1,3 +1,3 @@ -const {fs} = require('memfs') +const {fs} = require("memfs") module.exports = fs diff --git a/examples/plain-js/app/pages/_app.js b/examples/plain-js/app/pages/_app.js index 88dd5c271..63ae4ea8f 100644 --- a/examples/plain-js/app/pages/_app.js +++ b/examples/plain-js/app/pages/_app.js @@ -1,3 +1,3 @@ -export default function MyApp({ Component, pageProps }) { +export default function MyApp({Component, pageProps}) { return } diff --git a/examples/plain-js/app/pages/index.js b/examples/plain-js/app/pages/index.js index 37392c62f..71303c472 100644 --- a/examples/plain-js/app/pages/index.js +++ b/examples/plain-js/app/pages/index.js @@ -1,4 +1,4 @@ -import { Head, Link } from "blitz" +import {Head, Link} from "blitz" const modelSnippet = `model Project { id Int @default(autoincrement()) @id name String @@ -189,8 +189,8 @@ const Home = () => ( body { padding: 0; margin: 0; - font-family: "Libre Franklin", -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, - Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; + font-family: "Libre Franklin", -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, + Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; } * { diff --git a/examples/plain-js/app/projects/pages/projects/[id].js b/examples/plain-js/app/projects/pages/projects/[id].js index 2c49f7efc..3c00e72d3 100644 --- a/examples/plain-js/app/projects/pages/projects/[id].js +++ b/examples/plain-js/app/projects/pages/projects/[id].js @@ -1,5 +1,5 @@ -import { Suspense } from "react" -import { Head, Link, useRouter, useQuery } from "blitz" +import {Suspense} from "react" +import {Head, Link, useRouter, useQuery} from "blitz" import getProject from "app/projects/queries/getProject" import deleteProject from "app/projects/mutations/deleteProject" export const Project = () => { diff --git a/examples/plain-js/app/projects/pages/projects/[id]/edit.js b/examples/plain-js/app/projects/pages/projects/[id]/edit.js index f827f51ce..01bc0b916 100644 --- a/examples/plain-js/app/projects/pages/projects/[id]/edit.js +++ b/examples/plain-js/app/projects/pages/projects/[id]/edit.js @@ -1,5 +1,5 @@ -import { Suspense } from "react" -import { Head, Link, useRouter, useQuery } from "blitz" +import {Suspense} from "react" +import {Head, Link, useRouter, useQuery} from "blitz" import getProject from "app/projects/queries/getProject" import updateProject from "app/projects/mutations/updateProject" export const EditProject = () => { diff --git a/examples/plain-js/app/projects/pages/projects/index.js b/examples/plain-js/app/projects/pages/projects/index.js index ae39357b4..fe6016bda 100644 --- a/examples/plain-js/app/projects/pages/projects/index.js +++ b/examples/plain-js/app/projects/pages/projects/index.js @@ -1,5 +1,5 @@ -import { Suspense } from "react" -import { Head, Link, useQuery } from "blitz" +import {Suspense} from "react" +import {Head, Link, useQuery} from "blitz" import getProjects from "app/projects/queries/getProjects" export const ProjectsList = () => { diff --git a/examples/plain-js/app/projects/pages/projects/new.js b/examples/plain-js/app/projects/pages/projects/new.js index 2535d859d..80a5d6337 100644 --- a/examples/plain-js/app/projects/pages/projects/new.js +++ b/examples/plain-js/app/projects/pages/projects/new.js @@ -1,4 +1,4 @@ -import { Head, Link, useRouter } from "blitz" +import {Head, Link, useRouter} from "blitz" import createProject from "app/projects/mutations/createProject" const NewProjectPage = () => { diff --git a/examples/plain-js/blitz.config.js b/examples/plain-js/blitz.config.js index 3b17b02ef..80bd1073c 100644 --- a/examples/plain-js/blitz.config.js +++ b/examples/plain-js/blitz.config.js @@ -1,5 +1,5 @@ module.exports = { - webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => { + webpack: (config, {buildId, dev, isServer, defaultLoaders, webpack}) => { // Note: we provide webpack above so you should not `require` it // Perform customizations to webpack config // Important: return the modified config diff --git a/examples/plain-js/db/index.js b/examples/plain-js/db/index.js index 56c97b0db..20d5d0aa2 100644 --- a/examples/plain-js/db/index.js +++ b/examples/plain-js/db/index.js @@ -1,4 +1,4 @@ -import { PrismaClient } from "@prisma/client" +import {PrismaClient} from "@prisma/client" export * from "@prisma/client" let prisma diff --git a/examples/plain-js/package.json b/examples/plain-js/package.json index 92a5be39a..bae6e0ae8 100644 --- a/examples/plain-js/package.json +++ b/examples/plain-js/package.json @@ -12,7 +12,9 @@ ], "prettier": { "semi": false, - "printWidth": 110 + "printWidth": 100, + "bracketSpacing": false, + "trailingComma": "all" }, "husky": { "hooks": { diff --git a/examples/store/.babelrc.js b/examples/store/.babelrc.js index 906fa8567..a14498291 100644 --- a/examples/store/.babelrc.js +++ b/examples/store/.babelrc.js @@ -1,4 +1,4 @@ module.exports = { - presets: ['next/babel'], + presets: ["next/babel"], plugins: [], } diff --git a/examples/store/app/admin/pages/admin/index.tsx b/examples/store/app/admin/pages/admin/index.tsx index 00394069e..05acc1ea8 100644 --- a/examples/store/app/admin/pages/admin/index.tsx +++ b/examples/store/app/admin/pages/admin/index.tsx @@ -1,4 +1,4 @@ -import { Link } from "blitz" +import {Link} from "blitz" function StoreAdminPage() { return ( diff --git a/examples/store/app/admin/pages/admin/products/[id].tsx b/examples/store/app/admin/pages/admin/products/[id].tsx index c59c3f8be..b1a0ea282 100644 --- a/examples/store/app/admin/pages/admin/products/[id].tsx +++ b/examples/store/app/admin/pages/admin/products/[id].tsx @@ -1,12 +1,12 @@ -import { Suspense } from "react" -import { Link, useRouter, useQuery, useParam } from "blitz" +import {Suspense} from "react" +import {Link, useRouter, useQuery, useParam} from "blitz" import getProduct from "app/products/queries/getProduct" import ProductForm from "app/products/components/ProductForm" function Product() { const router = useRouter() const id = useParam("id", "number") - const [product, { mutate }] = useQuery(getProduct, { where: { id } }) + const [product, {mutate}] = useQuery(getProduct, {where: {id}}) return ( (
  • - getProduct({ where: { id: product.id } })}>{product.name} + getProduct({where: {id: product.id}})}>{product.name}
  • ))} @@ -35,7 +35,7 @@ function AdminProducts() { Create Product - Admin + Admin

    diff --git a/examples/store/app/admin/pages/admin/products/new.tsx b/examples/store/app/admin/pages/admin/products/new.tsx index 0531712cf..bf655b755 100644 --- a/examples/store/app/admin/pages/admin/products/new.tsx +++ b/examples/store/app/admin/pages/admin/products/new.tsx @@ -1,4 +1,4 @@ -import { Link, useRouter } from "blitz" +import {Link, useRouter} from "blitz" import ProductForm from "app/products/components/ProductForm" function AdminNewProductPage() { diff --git a/examples/store/app/components/ErrorBoundary.tsx b/examples/store/app/components/ErrorBoundary.tsx index 22aee07c6..11895f6e6 100644 --- a/examples/store/app/components/ErrorBoundary.tsx +++ b/examples/store/app/components/ErrorBoundary.tsx @@ -3,7 +3,7 @@ import React from "react" export default class ErrorBoundary extends React.Component<{ fallback: (error: any) => React.ReactNode }> { - state = { hasError: false, error: null } + state = {hasError: false, error: null} static getDerivedStateFromError(error: any) { return { diff --git a/examples/store/app/pages/_app.tsx b/examples/store/app/pages/_app.tsx index 88dd5c271..63ae4ea8f 100644 --- a/examples/store/app/pages/_app.tsx +++ b/examples/store/app/pages/_app.tsx @@ -1,3 +1,3 @@ -export default function MyApp({ Component, pageProps }) { +export default function MyApp({Component, pageProps}) { return } diff --git a/examples/store/app/pages/_document.tsx b/examples/store/app/pages/_document.tsx index ed68f9911..614d20235 100644 --- a/examples/store/app/pages/_document.tsx +++ b/examples/store/app/pages/_document.tsx @@ -1,9 +1,9 @@ -import { Document, Html, DocumentHead, Main, BlitzScript, DocumentContext } from "@blitzjs/core" +import {Document, Html, DocumentHead, Main, BlitzScript, DocumentContext} from "@blitzjs/core" class MyDocument extends Document { static async getInitialProps(ctx: DocumentContext) { const initialProps = await Document.getInitialProps(ctx) - return { ...initialProps } + return {...initialProps} } render() { diff --git a/examples/store/app/pages/index.tsx b/examples/store/app/pages/index.tsx index f1ca49ca7..7224398b0 100644 --- a/examples/store/app/pages/index.tsx +++ b/examples/store/app/pages/index.tsx @@ -1,4 +1,4 @@ -import { Head, Link } from "blitz" +import {Head, Link} from "blitz" const Home = () => (
    @@ -8,7 +8,7 @@ const Home = () => (
    -

    +

    Blitz Store Example