From 971ffd2d1ff30c8149bdc2c69489dcbb007e5244 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Sat, 11 Sep 2021 11:26:55 +0200 Subject: [PATCH 1/2] test: Format codebase with prettier --- .github/workflows/validate.yml | 4 ++++ package.json | 1 + 2 files changed, 5 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 191bbcc1..dfe6d21e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -37,6 +37,10 @@ jobs: with: useLockFile: false + # TODO: Can be removed if https://github.com/kentcdodds/kcd-scripts/pull/146 is released + - name: Verify format (`npm run format` committed?) + run: npm run format -- --check --no-write + # as requested by the React team :) # https://reactjs.org/blog/2019/10/22/react-release-channels.html#using-the-next-channel-for-integration-testing - name: ⚛️ Setup react diff --git a/package.json b/package.json index 42555be0..1cd283fb 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "build:bundle:main": "dotenv -e .bundle.main.env kcd-scripts build -- --bundle --no-clean", "build:bundle:pure": "dotenv -e .bundle.main.env -e .bundle.pure.env kcd-scripts build -- --bundle --no-clean", "build:main": "kcd-scripts build --no-clean", + "format": "kcd-scripts format", "lint": "kcd-scripts lint", "setup": "npm install && npm run validate -s", "test": "kcd-scripts test", From 3d15cb145a90f3e0836abbd9b38d0f57d95034e7 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Sat, 11 Sep 2021 11:31:19 +0200 Subject: [PATCH 2/2] npm run format --- src/index.js | 2 +- types/index.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index c89dc1a2..96fbe155 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,7 @@ import {cleanup} from './pure' // this ensures that tests run in isolation from each other // if you don't like this then either import the `pure` module // or set the RTL_SKIP_AUTO_CLEANUP env variable to 'true'. -if (typeof process === "undefined" || !process.env?.RTL_SKIP_AUTO_CLEANUP) { +if (typeof process === 'undefined' || !process.env?.RTL_SKIP_AUTO_CLEANUP) { // ignore teardown() in code coverage because Jest does not support it /* istanbul ignore else */ if (typeof afterEach === 'function') { diff --git a/types/index.d.ts b/types/index.d.ts index 6d0c67ee..46dd1575 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -13,7 +13,7 @@ export * from '@testing-library/dom' export type RenderResult< Q extends Queries = typeof queries, - Container extends Element | DocumentFragment = HTMLElement + Container extends Element | DocumentFragment = HTMLElement, > = { container: Container baseElement: Element @@ -32,7 +32,7 @@ export type RenderResult< export interface RenderOptions< Q extends Queries = typeof queries, - Container extends Element | DocumentFragment = HTMLElement + Container extends Element | DocumentFragment = HTMLElement, > { container?: Container baseElement?: Element @@ -48,7 +48,7 @@ type Omit = Pick> */ export function render< Q extends Queries = typeof queries, - Container extends Element | DocumentFragment = HTMLElement + Container extends Element | DocumentFragment = HTMLElement, >( ui: React.ReactElement, options: RenderOptions,