Skip to content

Commit

Permalink
Merge pull request #670 from nicholasio/update/react-imports
Browse files Browse the repository at this point in the history
Update/react imports
  • Loading branch information
cristianbote committed Jan 26, 2021
2 parents 5692895 + bcb5c04 commit be1cae9
Show file tree
Hide file tree
Showing 122 changed files with 109 additions and 133 deletions.
21 changes: 21 additions & 0 deletions .changeset/honest-apples-guess.md
Original file line number Diff line number Diff line change
@@ -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
---

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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import mergePackages from "../merge-packages";

class MyLib {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {
create,
ReactTestRenderer,
Expand Down

0 comments on commit be1cae9

Please sign in to comment.