Skip to content

Commit

Permalink
feat: hide behind feature flag and fix email config
Browse files Browse the repository at this point in the history
  • Loading branch information
bamorim committed Mar 14, 2021
1 parent 604f30c commit 994d20f
Show file tree
Hide file tree
Showing 12 changed files with 2,330 additions and 1,858 deletions.
50 changes: 25 additions & 25 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
module.exports = {
'env': {
'browser': true,
'es2020': true,
'node': true,
env: {
browser: true,
es2020: true,
node: true,
"jest/globals": true,
},
'extends': [
'eslint:recommended',
'plugin:react/recommended',
'google',
'prettier',
'plugin:jest/recommended',
'plugin:jest/style'
extends: [
"eslint:recommended",
"plugin:react/recommended",
"google",
"prettier",
"plugin:jest/recommended",
"plugin:jest/style",
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaFeatures': {
'jsx': true,
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
'ecmaVersion': 11,
'sourceType': 'module',
ecmaVersion: 11,
sourceType: "module",
},
'plugins': [
'jest',
'react',
'@typescript-eslint',
'prettier',
],
'rules': {
plugins: ["jest", "react", "@typescript-eslint", "prettier"],
rules: {
"react/react-in-jsx-scope": "off",
"require-jsdoc": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"prettier/prettier": "error",
"jest/no-export": "off"
"jest/no-export": "off",
},
settings: {
react: {
version: "detect",
},
},
};
24 changes: 24 additions & 0 deletions hooks/useSession.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Wraps NextAuth useSession but overriding the typing to include our custom fields.

import {
Session as NextAuthSession,
useSession as nextAuthUseSession,
} from "next-auth/client";

export type User = {
email: string;
firstName: string;
lastName: string;
};

export interface Session extends NextAuthSession {
user: User;
}

// Tricking typescript to believe that we know what we are doing.
const useSession = (): [Session | null, boolean] => {
const [session, loading] = nextAuthUseSession();
return [(session as unknown) as Session | null, loading];
};

export default useSession;
8 changes: 4 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
setupFiles: ["./configureTestEnvironmentVariables.js"]
};
preset: "ts-jest",
testEnvironment: "node",
setupFiles: ["./configureTestEnvironmentVariables.js"],
};
1 change: 1 addition & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/* eslint-disable spaced-comment */
/// <reference types="next" />
/// <reference types="next/types/global" />
8 changes: 4 additions & 4 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
env: {
PAGARME_ENC_KEY: process.env.PAGARME_ENC_KEY,
ROLLOUT_API_KEY: process.env.ROLLOUT_API_KEY
ROLLOUT_API_KEY: process.env.ROLLOUT_API_KEY,
},
serverRuntimeConfig: {
PROJECT_ROOT: __dirname
}
}
PROJECT_ROOT: __dirname,
},
};
Loading

0 comments on commit 994d20f

Please sign in to comment.