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

React 17 #13

Merged
merged 13 commits into from
Apr 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ module.exports = {
"react/jsx-sort-default-props": "off", // This is just busy work
"react/jsx-sort-props": "off", // This is just busy work
"react/jsx-tag-spacing": "error",
"react/jsx-uses-react": "error",
"react/jsx-uses-react": "off", // React 17 makes this unnecessary
"react/jsx-uses-vars": "error",
"react/jsx-wrap-multilines": "off", // This is just busy work
"react/no-access-state-in-setstate": "error",
Expand Down Expand Up @@ -573,7 +573,7 @@ module.exports = {
"react/prefer-read-only-props": "error",
"react/prefer-stateless-function": "error",
"react/prop-types": "off", // We use functions
"react/react-in-jsx-scope": "error",
"react/react-in-jsx-scope": "off", // React 17 makes this unnecessary
"react/require-default-props": "off", // We use functions
"react/require-optimization": "off", // We use functions
"react/require-render-return": "off", // We use functions
Expand Down
34 changes: 15 additions & 19 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
name: Elixir CI

on:
push:
branches: [ core ]
pull_request:
branches: [ core ]

jobs:
validate:
build:

name: Build and test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13.2
ports: ['5432:5432']
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: '22.2'
elixir-version: '1.9.4'
- name: Set up Elixir
uses: erlef/setup-elixir@885971a72ed1f9240973bd92ab57af8c1aa68f24
- uses: actions/cache@v2
with:
elixir-version: '1.10.3' # Define the elixir version [required]
otp-version: '22.3' # Define the OTP version [required]
- name: Restore dependencies cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- run: mix deps.get
- run: mix test
- name: Install dependencies
run: mix deps.get
- name: Run tests
run: mix test
29 changes: 18 additions & 11 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ core ]
pull_request:
branches: [ core ]

jobs:
validate:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 15.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: '15.x'
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: bin/eslint-check
- run: bin/typescript-check
- run: bin/webpack-build
- run: npm run build --if-present
- run: npm test
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Step one is to create the component in `lib/client/pages/` and then export it in
- Finish setting up the html meta
- Get a google tag manager id
- Hot reloading not noticing change in css
- Check out DLLplugin
- Utilize recoil state persistance for hydration
- make storybook load recoil
- Tried to create an account, then I saw this in logs:
Expand Down
4 changes: 2 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
presets: [
["@babel/preset-env", {useBuiltIns: "entry", corejs: 3, targets: "> 0.25%, not dead"}],
["@babel/preset-typescript", {isTSX: true, allExtensions: true}],
["@babel/preset-react", {development: process.env.NODE_ENV !== "production"}],
["@babel/preset-react", {runtime: "automatic", development: process.env.NODE_ENV !== "production"}],
process.env.NODE_ENV === "production" ? "minify" : null,
"@emotion/babel-preset-css-prop",
].filter((preset) => preset),
Expand All @@ -13,7 +13,7 @@ module.exports = {
"^@clumsy_chinchilla/(.+)$": "./lib/client/\\1",
"^@assets/(.+)$": "./assets/\\1",
}}],
process.env.NODE_ENV === "production" ? null : "react-hot-loader/babel",
process.env.NODE_ENV === "production" ? null : "annotate-console-log",
"react-refresh/babel"
].filter((preset) => preset),
};
2 changes: 1 addition & 1 deletion bin/webpack-build
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

npx webpack-cli --config webpack/development.js
npx webpack build --config webpack/development.js
2 changes: 1 addition & 1 deletion bin/webpack-start
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

npx webpack serve --config webpack/development.js
HOT="enabled" npx webpack serve --config webpack/development.js
7 changes: 0 additions & 7 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ config :clumsy_chinchilla, Database.Repository,
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox

# Configure the database for GitHub Actions
if System.get_env("GITHUB_ACTIONS") do
config :clumsy_chinchilla, Database.Repository,
username: "postgres",
password: "postgres"
end

# We don't run a server during test. If one is required,
# you can enable the server option below.
config :clumsy_chinchilla, Web.Endpoint,
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/Application/ErrorBoundary/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import type {ErrorInfo} from "react";
import {Component} from "react";
import Exception from "../../Exception";
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/Application/Router/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {Route, Switch} from "react-router";
import {AccountConfirmation} from "@clumsy_chinchilla/pages";
import {CodeOfConduct} from "@clumsy_chinchilla/pages";
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/Application/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import ErrorBoundary from "./ErrorBoundary";
import MaybeAuthenticated from "./MaybeAuthenticated";
import WithCookies from "./WithCookies";
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/CheckboxField/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from "react";
import type {ReactNode} from "react";
import type {LabelHTMLAttributes} from "react";
import type {InputHTMLAttributes} from "react";
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/Exception/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import Link from "../Link";

interface PropertiesType {
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/Field/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from "react";
import type {ReactNode} from "react";
import type {LabelHTMLAttributes} from "react";
import type {InputHTMLAttributes} from "react";
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/FieldFeedback/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import type {ReactNode} from "react";

interface PropertiesType {
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/FieldHelp/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import type {ReactNode} from "react";

interface PropertiesType {
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/Icon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {compact} from "@unction/complete";

interface PropertiesType {
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/Link/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from "react";
import type {ReactNode} from "react";
// import ComponentLink from "react-router-component-link";
import {Link as ReactRouterLink} from "react-router-dom";
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/Link/story.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable func-style */
import React from "react";
import {BrowserRouter} from "react-router-dom";
import {text} from "@storybook/addon-knobs";
import Link from ".";
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/Loading/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import Icon from "../Icon";

interface PropertiesType {
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/Navbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import Link from "../Link";

const styling = {};
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/Page/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {Helmet} from "react-helmet-async";
import type {ReactNode} from "react";

Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/RadioField/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from "react";
import type {ReactNode} from "react";
import type {LabelHTMLAttributes} from "react";
import type {InputHTMLAttributes} from "react";
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/SelectField/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from "react";
import type {ReactNode} from "react";
import type {LabelHTMLAttributes} from "react";
import type {SelectHTMLAttributes} from "react";
Expand Down
1 change: 0 additions & 1 deletion lib/client/elements/TextField/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from "react";
import type {ReactNode} from "react";
import type {LabelHTMLAttributes} from "react";
import type {TextareaHTMLAttributes} from "react";
Expand Down
23 changes: 9 additions & 14 deletions lib/client/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/* eslint-disable import/no-internal-modules */
import "core-js/stable";
import "regenerator-runtime/runtime";
import React from "react";
import {render} from "react-dom";
import {hot} from "react-hot-loader/root";
import {BrowserRouter} from "react-router-dom";
import {HelmetProvider} from "react-helmet-async";
import {ApolloProvider} from "@apollo/client";
Expand All @@ -12,17 +9,15 @@ import {RecoilRoot} from "recoil";
import {Application} from "@clumsy_chinchilla/elements";
import sdk from "./sdk";

const HotReloadedRoot = hot(() => <BrowserRouter>
<HelmetProvider>
<RecoilRoot>
<ApolloProvider client={sdk}>
<Application />
</ApolloProvider>
</RecoilRoot>
</HelmetProvider>
</BrowserRouter>);

render(
<HotReloadedRoot />,
<BrowserRouter>
<HelmetProvider>
<RecoilRoot>
<ApolloProvider client={sdk}>
<Application />
</ApolloProvider>
</RecoilRoot>
</HelmetProvider>
</BrowserRouter>,
document.querySelector("#application")
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {useState} from "react";
import {useEffect} from "react";
import {useSetRecoilState} from "recoil";
Expand Down
1 change: 0 additions & 1 deletion lib/client/pages/AccountConfirmation/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {useLocation} from "react-router-dom";

import {Page} from "@clumsy_chinchilla/elements";
Expand Down
2 changes: 0 additions & 2 deletions lib/client/pages/CodeOfConduct/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

import {Page} from "@clumsy_chinchilla/elements";

export default function CodeOfConduct (): JSX.Element {
Expand Down
2 changes: 0 additions & 2 deletions lib/client/pages/DataPolicy/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

import {Page} from "@clumsy_chinchilla/elements";

export default function DataPolicy (): JSX.Element {
Expand Down
1 change: 0 additions & 1 deletion lib/client/pages/LandingPage/CallToAction/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {useRecoilValue} from "recoil";
import {currentSessionId as currentSessionIdAtom} from "@clumsy_chinchilla/atoms";
import {loadingCurrentSessionId as loadingCurrentSessionIdAtom} from "@clumsy_chinchilla/atoms";
Expand Down
1 change: 0 additions & 1 deletion lib/client/pages/LandingPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {Page} from "@clumsy_chinchilla/elements";
import CallToAction from "./CallToAction";

Expand Down
1 change: 0 additions & 1 deletion lib/client/pages/Login/LoginForm/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {useState} from "react";
import {useEffect} from "react";
import {useSetRecoilState} from "recoil";
Expand Down
1 change: 0 additions & 1 deletion lib/client/pages/Login/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {useRecoilState} from "recoil";
import {useRecoilValue} from "recoil";
import {useHistory} from "react-router-dom";
Expand Down
1 change: 0 additions & 1 deletion lib/client/pages/Logout/LogoutForm/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {useEffect} from "react";
import {useSetRecoilState} from "recoil";
import {useMutation} from "@apollo/client";
Expand Down
2 changes: 0 additions & 2 deletions lib/client/pages/Logout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

import {Page} from "@clumsy_chinchilla/elements";
import LogoutForm from "./LogoutForm";

Expand Down
1 change: 0 additions & 1 deletion lib/client/pages/OurTechnology/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {Page} from "@clumsy_chinchilla/elements";

export default function OurTechnology (): JSX.Element {
Expand Down
2 changes: 0 additions & 2 deletions lib/client/pages/PageNotFound/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

import {Page} from "@clumsy_chinchilla/elements";

export default function PageNotFound (): JSX.Element {
Expand Down
2 changes: 0 additions & 2 deletions lib/client/pages/PrivacyPolicy/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

import {Page} from "@clumsy_chinchilla/elements";

export default function PrivacyPolicy (): JSX.Element {
Expand Down
1 change: 0 additions & 1 deletion lib/client/pages/SignUp/SignUpForm/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {useState} from "react";
import {useEffect} from "react";
import {useSetRecoilState} from "recoil";
Expand Down
1 change: 0 additions & 1 deletion lib/client/pages/SignUp/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {useRecoilState} from "recoil";
import {useRecoilValue} from "recoil";
import {useHistory} from "react-router-dom";
Expand Down
2 changes: 0 additions & 2 deletions lib/client/pages/TermsOfService/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

import {Page} from "@clumsy_chinchilla/elements";

export default function TermsOfService (): JSX.Element {
Expand Down
2 changes: 0 additions & 2 deletions lib/client/pages/ThisIsUs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

import {Page} from "@clumsy_chinchilla/elements";

export default function ThisIsUs (): JSX.Element {
Expand Down
1 change: 0 additions & 1 deletion lib/client/pages/YourSettings/SettingsForm/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import {useState} from "react";
import {useEffect} from "react";
import {useRecoilState} from "recoil";
Expand Down
2 changes: 0 additions & 2 deletions lib/client/pages/YourSettings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

import {Page} from "@clumsy_chinchilla/elements";
import SettingsForm from "./SettingsForm";

Expand Down
Loading