Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/react imports #670

Merged
merged 10 commits into from
Jan 26, 2021
21 changes: 21 additions & 0 deletions .changeset/honest-apples-guess.md
@@ -0,0 +1,21 @@
---
"@frontity/analytics": minor
"@frontity/components": minor
"@frontity/comscore-analytics": minor
"@frontity/connect": minor
"@frontity/core": minor
"frontity": minor
"@frontity/google-ad-manager": minor
"@frontity/google-analytics": minor
"@frontity/google-tag-manager-analytics": minor
"@frontity/head-tags": minor
"@frontity/hooks": minor
"@frontity/html2react": minor
"@frontity/mars-theme": minor
"@frontity/smart-adserver": minor
"@frontity/twentytwenty-theme": minor
"@frontity/types": minor
"@frontity/yoast": minor
Comment on lines +2 to +18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicholasio was thinking if these updates require a minor update or rather a patch instead? These are not changing public facing API but rather the environment the code is running on. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, I think I didn't go with a patch because this is not exactly a bug fix, but I'm fine to change it to patch

---

Update react imports in all packages (including themes) to removed unnecessary React Imports
2 changes: 1 addition & 1 deletion e2e/packages/ads/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { Slot, connect } from "frontity";
import { Connect } from "frontity/types";
import TestAds, { Packages } from "../types";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/analytics/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { Head, connect } from "frontity";
import { Connect } from "frontity/types";
import Analytics, { Packages } from "../types";
Expand Down
8 changes: 4 additions & 4 deletions e2e/packages/emotion/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import { useState } from "react";
import { Global, css, connect, styled } from "frontity";
import Package from "../types";

Expand All @@ -8,7 +8,7 @@ import Package from "../types";
* @returns React element.
*/
const GlobalBackgroundBlue = () => {
const [global, setGlobal] = React.useState(false);
const [global, setGlobal] = useState(false);
return (
<>
{global && (
Expand All @@ -34,7 +34,7 @@ const GlobalBackgroundBlue = () => {
* @returns React element.
*/
const GlobalColorRed = () => {
const [global, setGlobal] = React.useState(false);
const [global, setGlobal] = useState(false);
return (
<>
{global && (
Expand Down Expand Up @@ -94,7 +94,7 @@ const CSS = ({ children, color }) => (
* @returns React element.
*/
const StyledPage = () => {
const [isBlue, setIsBlue] = React.useState(false);
const [isBlue, setIsBlue] = useState(false);
return (
<>
<Styled color={isBlue && "blue"} data-test-id="styled-div">
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/fonts/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { Global, css, connect, styled } from "frontity";
import Package from "../types";
import aclonicaEot from "./fonts/aclonica-v10-latin-regular.eot";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/head/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { Head } from "frontity";
import Package from "../types";

Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/html2react/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { connect } from "frontity";
import { Connect } from "frontity/types";
import Html2ReactTests, { Packages } from "../types";
Expand Down
10 changes: 5 additions & 5 deletions e2e/packages/html2react/src/processors.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { css } from "frontity";
import { Processor, Node } from "@frontity/html2react/types";
import Html2ReactTests from "../types";
Expand All @@ -15,7 +15,7 @@ export const testProcessor: Processor<
`;
}
return node;
}
},
};

export const oldProcessor: Processor = ({
Expand All @@ -28,12 +28,12 @@ export const oldProcessor: Processor = ({
node.children = [
{
type: "text",
content: root ? "Yes" : "No"
}
content: root ? "Yes" : "No",
},
];
}
return node;
}
},
} as unknown) as Processor;

export default [testProcessor, oldProcessor];
2 changes: 1 addition & 1 deletion e2e/packages/iframe/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import Iframe from "@frontity/components/iframe";
import Package from "../types";
import { styled } from "frontity";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/image/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { Global, css, styled } from "frontity";
import Image from "@frontity/components/image";
import Package from "../types";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/loadable/src/dynamic-2/dynamic-2.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import Static from "../static";

const Dynamic2: React.FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/loadable/src/dynamic.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import Static from "./static";

const Dynamic: React.FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/loadable/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import Package from "../types";
import { loadable } from "frontity";
import Dynamic2 from "./dynamic-2";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/loadable/src/static.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";

const Static: React.FC = () => {
return <div>I am the Static component</div>;
Expand Down
1 change: 0 additions & 1 deletion e2e/packages/preview/src/index.tsx
@@ -1,4 +1,3 @@
import React from "react";
import { connect, useConnect } from "frontity";
import { isPostType, isError } from "@frontity/source";
import Preview, { Packages } from "../types";
Expand Down
1 change: 0 additions & 1 deletion e2e/packages/render/src/index.tsx
@@ -1,4 +1,3 @@
import React from "react";
import Render, { Packages } from "../types";
import { connect, useConnect } from "frontity";
import { isPost, isPostArchive } from "@frontity/source";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/script/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import Script from "@frontity/components/script";
import Package from "../types";

Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/slot-and-fill/src/index.tsx
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { connect, useConnect, useFills } from "frontity";
import SlotAndFill from "../types";

Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/smart-adserver/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { connect, Slot } from "frontity";
import SmartAdserver, { Packages } from "../types";
import { Connect } from "frontity/types";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/switch/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import Switch from "@frontity/components/switch";
import Package from "../types";

Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/tiny-router/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import TinyRouterTests, { Packages } from "../types";
import { css, connect } from "frontity";
import { Connect } from "frontity/types";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/use-in-view/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import useInView from "@frontity/hooks/use-in-view";
import UseInView from "../types";

Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/wp-basic-tests/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { useConnect, connect } from "frontity";
import Link from "@frontity/components/link";
import { isPostType, isArchive } from "@frontity/source";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/wp-comments/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import TestComments, { Packages } from "../types";
import { connect } from "frontity";
import { Connect } from "frontity/types";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/wp-source-errors/src/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { connect } from "frontity";
import { Connect } from "frontity/types";
import { isError } from "@frontity/source";
Expand Down
2 changes: 1 addition & 1 deletion jest.babel.config.js
@@ -1,7 +1,7 @@
module.exports = {
presets: [
["@babel/preset-env", { targets: { node: "current" } }],
"@babel/preset-react",
["@babel/preset-react", { runtime: "automatic" }],
],
plugins: [
[
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/src/components/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { connect, Head } from "frontity";
import { Connect } from "frontity/types";
import { Packages } from "../../types";
Expand Down
2 changes: 1 addition & 1 deletion packages/components/__tests__/iframe.jsdom.tests.tsx
@@ -1,9 +1,9 @@
/* eslint-disable no-global-assign */

/**
* @jest-environment jsdom
*/

import React from "react";
import TestRenderer from "react-test-renderer";
import useInView from "@frontity/hooks/use-in-view";
import Iframe from "../iframe";
Expand Down
1 change: 0 additions & 1 deletion packages/components/__tests__/iframe.node.tests.tsx
Expand Up @@ -2,7 +2,6 @@
* @jest-environment node
*/

import React from "react";
import TestRenderer from "react-test-renderer";
import { HelmetProvider } from "frontity";
import { FilledContext } from "react-helmet-async";
Expand Down
2 changes: 1 addition & 1 deletion packages/components/__tests__/image.jsdom.tests.tsx
@@ -1,9 +1,9 @@
/* eslint-disable no-global-assign */

/**
* @jest-environment jsdom
*/

import React from "react";
import TestRenderer from "react-test-renderer";
import useInView from "@frontity/hooks/use-in-view";
import Image from "../image";
Expand Down
1 change: 0 additions & 1 deletion packages/components/__tests__/image.node.tests.tsx
Expand Up @@ -2,7 +2,6 @@
* @jest-environment node
*/

import React from "react";
import TestRenderer from "react-test-renderer";
import { HelmetProvider } from "frontity";
import { FilledContext } from "react-helmet-async";
Expand Down
2 changes: 1 addition & 1 deletion packages/components/__tests__/switch.tests.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { create } from "react-test-renderer";
import Switch from "../switch";

Expand Down
2 changes: 1 addition & 1 deletion packages/components/iframe.tsx
@@ -1,5 +1,5 @@
/* eslint-disable jsx-a11y/iframe-has-title */
import React from "react";
import * as React from "react";
import { connect, Head } from "frontity";
import { Connect, Package } from "frontity/types";
import useInView from "@frontity/hooks/use-in-view";
Expand Down
2 changes: 1 addition & 1 deletion packages/components/image.tsx
@@ -1,6 +1,6 @@
/* eslint-disable jsx-a11y/alt-text */

import React from "react";
import * as React from "react";
import { Head, connect } from "frontity";
import { Connect, Package } from "frontity/types";
import useInView from "@frontity/hooks/use-in-view";
Expand Down
1 change: 0 additions & 1 deletion packages/components/link/__tests__/link.tests.tsx
@@ -1,4 +1,3 @@
import React from "react";
import { render, unmountComponentAtNode } from "react-dom";
import { act } from "react-dom/test-utils";
import { create } from "react-test-renderer";
Expand Down
3 changes: 2 additions & 1 deletion packages/components/link/index.tsx
@@ -1,4 +1,5 @@
import React, { MouseEvent, useEffect, useRef, useCallback } from "react";
import { MouseEvent, useEffect, useRef, useCallback } from "react";
import * as React from "react";
import { warn, connect, useConnect } from "frontity";
import useInView from "@frontity/hooks/use-in-view";
import {
Expand Down
3 changes: 2 additions & 1 deletion packages/components/script.tsx
@@ -1,4 +1,5 @@
import React, { useEffect } from "react";
import { useEffect } from "react";
import * as React from "react";

/**
* Props passed to the {@link Script} component.
Expand Down
3 changes: 2 additions & 1 deletion packages/components/switch.tsx
@@ -1,11 +1,12 @@
import { connect, warn } from "frontity";
import { Package } from "frontity/types";
import React, {
import {
isValidElement,
ReactNodeArray,
ReactElement,
createElement,
} from "react";
import * as React from "react";

interface SwitchChild {
when?: boolean;
Expand Down
Expand Up @@ -2,7 +2,6 @@
* @jest-environment node
*/

import React from "react";
import TestRenderer from "react-test-renderer";
import { HelmetProvider } from "frontity";
import { State } from "frontity/types";
Expand Down
2 changes: 1 addition & 1 deletion packages/comscore-analytics/src/components/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { Head, connect } from "frontity";
import { Connect } from "frontity/types";
import ComscoreAnalytics from "../../types";
Expand Down
3 changes: 2 additions & 1 deletion packages/comscore-analytics/types.ts
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { Action, MergePackages, Package } from "frontity/types";
import Analytics, { Pageview } from "@frontity/analytics/types";

Expand Down Expand Up @@ -89,6 +89,7 @@ interface ComscoreAnalytics extends Package {
* Package name.
*/
name: "@frontity/comscore-analytics";

/**
* Root elements exposed by this package.
*/
Expand Down
1 change: 0 additions & 1 deletion packages/connect/src/__tests__/batching.tests.jsx
@@ -1,4 +1,3 @@
import React from "react";
import { create, act } from "react-test-renderer";
import connect, { Provider, createStore, batch } from "..";

Expand Down
2 changes: 1 addition & 1 deletion packages/connect/src/__tests__/connect.tests.jsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { create, act } from "react-test-renderer";
import * as error from "@frontity/error";
import connect, { Provider, createStore, useConnect } from "..";
Expand Down
2 changes: 1 addition & 1 deletion packages/connect/src/__tests__/types.tests.tsx
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars, jest/expect-expect */
import React from "react";
import * as React from "react";
import connect, { useConnect, createStore, Action, Derived, Connect } from "..";

const delay = () => new Promise((resolve) => setTimeout(resolve, 100));
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/app/index.tsx
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import {
InitializedStore,
Provider as ConnectProvider,
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/client/index.tsx
@@ -1,4 +1,3 @@
import React from "react";
import { hydrate } from "react-dom";
import { loadableReady } from "@loadable/component";
import { getSnapshot } from "@frontity/connect";
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/server/index.tsx
Expand Up @@ -3,7 +3,6 @@ import Koa from "koa";
import { get } from "koa-route";
import serve from "koa-static";
import mount from "koa-mount";
import React from "react";
import htmlescape from "htmlescape";
import { renderToString, renderToStaticMarkup } from "react-dom/server";
import { FilledContext } from "react-helmet-async";
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/utils/__tests__/merge-packages.tests.tsx
@@ -1,4 +1,3 @@
import React from "react";
import mergePackages from "../merge-packages";

class MyLib {
Expand Down
@@ -1,4 +1,3 @@
import React from "react";
import {
create,
ReactTestRenderer,
Expand Down