Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit d7a5b59

Browse files
committed
convert to typescript
1 parent 9ed2456 commit d7a5b59

35 files changed

+11199
-2281
lines changed

.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"presets": ["@babel/preset-env", "@babel/preset-react"],
2+
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
33
"plugins": [
44
"@babel/plugin-proposal-object-rest-spread",
55
"@babel/plugin-proposal-class-properties"

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
lib/*
2+
build/*

.eslintrc

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
{
2-
"parser": "babel-eslint",
2+
"parser": "@typescript-eslint/parser",
33
"parserOptions": {
4-
"ecmaVersion": 6,
4+
"ecmaVersion": 2020,
55
"sourceType": "module",
66
"ecmaFeatures": {
77
"jsx": true,
88
"classes": true,
99
"defaultParams": true
1010
}
1111
},
12-
"plugins": ["react"],
13-
"extends": ["eslint:recommended", "plugin:react/recommended"],
12+
"settings": {
13+
"react": {
14+
"version": "detect"
15+
}
16+
},
17+
"extends": [
18+
"plugin:react/recommended",
19+
"plugin:@typescript-eslint/recommended",
20+
"prettier/@typescript-eslint",
21+
"plugin:prettier/recommended"
22+
],
1423
"env": {
1524
"commonjs": true,
1625
"browser": true,
1726
"node": true,
1827
"es6": true
28+
},
29+
"rules": {
30+
"@typescript-eslint/no-explicit-any":0,
31+
"@typescript-eslint/explicit-module-boundary-types":0
1932
}
2033
}

.storybook/main.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
stories: ["../src/**/*.stories.tsx"],
3+
addons: ["@storybook/addon-actions", "@storybook/addon-links"],
4+
typescript: {
5+
check: false,
6+
checkOptions: {},
7+
reactDocgen: "react-docgen-typescript",
8+
reactDocgenTypescriptOptions: {
9+
shouldExtractLiteralValuesFromEnum: true,
10+
propFilter: (prop) =>
11+
prop.parent ? !/node_modules/.test(prop.parent.fileName) : true,
12+
},
13+
},
14+
};

build/AuthConsumer/AuthConsumer.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { ReactNode } from "react";
2+
interface AuthConsumerProps {
3+
children: (...args: any) => ReactNode;
4+
}
5+
export default function AuthConsumer(props: AuthConsumerProps): JSX.Element;
6+
export {};

build/AuthConsumer/index.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import AuthConsumer from "./AuthConsumer";
2+
export default AuthConsumer;

build/AuthProvider/AuthProvider.d.ts

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/// <reference types="auth0-lock" />
2+
/// <reference types="node" />
3+
import React, { ReactNode } from "react";
4+
interface Props {
5+
storageKey: string;
6+
clientId: string;
7+
domain: string;
8+
options: Record<string, any>;
9+
showLock?: boolean;
10+
children: ReactNode;
11+
}
12+
export interface State {
13+
lock: Auth0LockStatic;
14+
login: () => void;
15+
logout: (returnTo: any) => void;
16+
expiresAt?: string;
17+
isAuthenticated?: boolean;
18+
accessToken?: AuthResult["accessToken"];
19+
idToken?: AuthResult["idToken"];
20+
idTokenPayload?: AuthResult["idTokenPayload"];
21+
profile?: any;
22+
}
23+
export default class AuthProvider extends React.Component<Props, State> {
24+
lock: Auth0LockStatic;
25+
tokenRenewalTimeout: null | NodeJS.Timeout;
26+
static defaultProps: {
27+
storageKey: string;
28+
options: {};
29+
};
30+
constructor(props: any);
31+
componentDidMount(): void;
32+
setSession: (authResult: any, profile: any) => void;
33+
storeSession: (session: any) => void;
34+
getStoredSession: () => any;
35+
isSessionExpired: (expiresAt: any) => boolean;
36+
rehyrate: () => void;
37+
login: () => void;
38+
logout: (returnTo: any) => void;
39+
scheduleRenewal: () => void;
40+
renewToken: () => void;
41+
render(): JSX.Element;
42+
}
43+
export {};

build/AuthProvider/index.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import AuthProvider from "./AuthProvider";
2+
export default AuthProvider;

build/context.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import React from "react";
2+
import { State } from "./AuthProvider/AuthProvider";
3+
export declare const Provider: React.Provider<State>, Consumer: React.Consumer<State>;

build/index.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { default as AuthConsumer } from "./AuthConsumer";
2+
export { default as AuthProvider } from "./AuthProvider";
3+
export { default as withAuth } from "./withAuth";

build/index.es.js

+174
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/index.es.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)