Skip to content

Commit

Permalink
feat: add TS type defs
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed Mar 4, 2024
1 parent 907c65e commit eb01839
Show file tree
Hide file tree
Showing 75 changed files with 17,560 additions and 16,462 deletions.
7 changes: 7 additions & 0 deletions .babelrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-env node, es2018 */
module.exports = function (api) {
const base = require('@jcoreio/toolchain-esnext/.babelrc.cjs')(api)
return {
...base,
}
}
30 changes: 0 additions & 30 deletions .babelrc.js

This file was deleted.

16 changes: 0 additions & 16 deletions .eslintrc

This file was deleted.

7 changes: 7 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-env node, es2018 */
module.exports = {
extends: [require.resolve('@jcoreio/toolchain/eslint.config.cjs')],
env: {
es6: true,
},
}
2 changes: 2 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<PROJECT_ROOT>/node_modules/fbjs/.*
<PROJECT_ROOT>/node_modules/.*/fbjs/.*
<PROJECT_ROOT>/node_modules/.*/config-chain/.*
<PROJECT_ROOT>/dist/.*
.*/malformed_package_json/.*

[include]
./src
Expand Down
10 changes: 2 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
/dist
.nyc_output
coverage
node_modules
lib
es
.eslintcache
/*.js
/*.js.flow
!/.babelrc.js
!/webpack.config.js
/coverage
6 changes: 6 additions & 0 deletions .mocharc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* eslint-env node, es2018 */
const base = require('@jcoreio/toolchain-mocha/.mocharc.cjs')
module.exports = {
...base,
require: [...base.require, 'test/clientSizePolyfill.js'],
}
15 changes: 0 additions & 15 deletions .npmignore

This file was deleted.

1 change: 0 additions & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

5 changes: 5 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* eslint-env node, es2018 */
const base = require('@jcoreio/toolchain/commitlint.config.cjs')
module.exports = {
...base,
}
3,282 changes: 3,281 additions & 1 deletion demo/bundle.js

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions demo/examples/SignupDemo.js → demo/examples/SignupDemo.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/**
* @flow
* @prettier
*/

import { Flow } from 'flow-to-typescript-codemod'
import * as React from 'react'
import Button from '@material-ui/core/Button'
import TextField from '@material-ui/core/TextField'
Expand All @@ -13,14 +9,11 @@ import ArrowBack from '@material-ui/icons/ArrowBack'
import ArrowForward from '@material-ui/icons/ArrowForward'
import withStyles from '@material-ui/core/styles/withStyles'
import { useAutofocusRef } from 'react-transition-context'

type Classes = $Call<
<T>((theme: any) => T) => $ObjMap<T, () => string>,
typeof styles
type Classes = ReturnType<
<T>(arg1: (theme?: any) => T) => Flow.ObjMap<T, () => string>
>

export type Props = {
classes: Classes,
classes: Classes
}

const styles = (theme: any) => ({
Expand Down Expand Up @@ -53,10 +46,11 @@ const styles = (theme: any) => ({
},
})

const SignupDemo = ({ classes }: Props): React.Node => {
const SignupDemo = ({ classes }: Props): React.ReactElement => {
const [step, setStep] = React.useState(0)
let content
const Step = steps[step]

if (Step) {
content = (
<Step
Expand All @@ -68,6 +62,7 @@ const SignupDemo = ({ classes }: Props): React.Node => {
/>
)
}

return (
<div className={classes.root}>
<Typography variant="h6">Signup Form Example</Typography>
Expand All @@ -88,13 +83,12 @@ const SignupDemo = ({ classes }: Props): React.Node => {
}

export default withStyles(styles)(SignupDemo)

type FormProps = {
classes: Classes,
onSubmit: (e: Event) => any,
classes: Classes
onSubmit: (e: Event) => any
}

const EmailForm = ({ classes, onSubmit }: FormProps): React.Node => {
const EmailForm = ({ classes, onSubmit }: FormProps): React.ReactElement => {
const autofocusRef = useAutofocusRef()
return (
<form className={classes.form} onSubmit={onSubmit}>
Expand All @@ -115,7 +109,10 @@ const EmailForm = ({ classes, onSubmit }: FormProps): React.Node => {
)
}

const VerificationCodeForm = ({ classes, onSubmit }: FormProps): React.Node => {
const VerificationCodeForm = ({
classes,
onSubmit,
}: FormProps): React.ReactElement => {
const autofocusRef = useAutofocusRef()
return (
<form className={classes.form} onSubmit={onSubmit}>
Expand All @@ -136,7 +133,10 @@ const VerificationCodeForm = ({ classes, onSubmit }: FormProps): React.Node => {
)
}

const OrganizationForm = ({ classes, onSubmit }: FormProps): React.Node => {
const OrganizationForm = ({
classes,
onSubmit,
}: FormProps): React.ReactElement => {
const autofocusRef = useAutofocusRef()
return (
<form className={classes.form} onSubmit={onSubmit}>
Expand All @@ -163,7 +163,7 @@ const OrganizationForm = ({ classes, onSubmit }: FormProps): React.Node => {
)
}

const PasswordForm = ({ classes, onSubmit }: FormProps): React.Node => {
const PasswordForm = ({ classes, onSubmit }: FormProps): React.ReactElement => {
const autofocusRef = useAutofocusRef()
return (
<form className={classes.form} onSubmit={onSubmit}>
Expand All @@ -190,7 +190,7 @@ const PasswordForm = ({ classes, onSubmit }: FormProps): React.Node => {
)
}

const DoneForm = ({ classes, onSubmit }: FormProps): React.Node => (
const DoneForm = ({ classes, onSubmit }: FormProps): React.ReactElement => (
<div className={classes.form}>
<Typography variant="h5" className={classes.h5}>
<em>End of Demo</em>
Expand Down
52 changes: 26 additions & 26 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<!doctype html>
<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="utf-8">
<meta httpEquiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="">
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
>
<title>react-fader</title>
<style type="text/css">
body {
background-color: #fafafa;
}
.loading {
position: absolute;
text-align: center;
width: 100%;
top: 10%;
}
</style>
</head>
<body>
<div id="root"><h1 class="loading">Loading...</h1></div>
<script src="bundle.js"></script>
</body>
<head>
<meta charset="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<title>react-fader</title>
<style type="text/css">
body {
background-color: #fafafa;
}
.loading {
position: absolute;
text-align: center;
width: 100%;
top: 10%;
}
</style>
</head>
<body>
<div id="root"><h1 class="loading">Loading...</h1></div>
<script src="bundle.js"></script>
</body>
</html>
32 changes: 8 additions & 24 deletions flow-typed/npm/@babel/core_vx.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,7 @@ declare module '@babel/core/lib/config/util.js' {
declare module.exports: $Exports<'@babel/core/lib/config/util'>
}
declare module '@babel/core/lib/config/validation/option-assertions.js' {
declare module.exports: $Exports<
'@babel/core/lib/config/validation/option-assertions'
>
declare module.exports: $Exports<'@babel/core/lib/config/validation/option-assertions'>
}
declare module '@babel/core/lib/config/validation/options.js' {
declare module.exports: $Exports<'@babel/core/lib/config/validation/options'>
Expand All @@ -266,9 +264,7 @@ declare module '@babel/core/lib/parse.js' {
declare module.exports: $Exports<'@babel/core/lib/parse'>
}
declare module '@babel/core/lib/tools/build-external-helpers.js' {
declare module.exports: $Exports<
'@babel/core/lib/tools/build-external-helpers'
>
declare module.exports: $Exports<'@babel/core/lib/tools/build-external-helpers'>
}
declare module '@babel/core/lib/transform-ast.js' {
declare module.exports: $Exports<'@babel/core/lib/transform-ast'>
Expand All @@ -283,22 +279,16 @@ declare module '@babel/core/lib/transform.js' {
declare module.exports: $Exports<'@babel/core/lib/transform'>
}
declare module '@babel/core/lib/transformation/block-hoist-plugin.js' {
declare module.exports: $Exports<
'@babel/core/lib/transformation/block-hoist-plugin'
>
declare module.exports: $Exports<'@babel/core/lib/transformation/block-hoist-plugin'>
}
declare module '@babel/core/lib/transformation/file/file.js' {
declare module.exports: $Exports<'@babel/core/lib/transformation/file/file'>
}
declare module '@babel/core/lib/transformation/file/generate.js' {
declare module.exports: $Exports<
'@babel/core/lib/transformation/file/generate'
>
declare module.exports: $Exports<'@babel/core/lib/transformation/file/generate'>
}
declare module '@babel/core/lib/transformation/file/merge-map.js' {
declare module.exports: $Exports<
'@babel/core/lib/transformation/file/merge-map'
>
declare module.exports: $Exports<'@babel/core/lib/transformation/file/merge-map'>
}
declare module '@babel/core/lib/transformation/index' {
declare module.exports: $Exports<'@babel/core/lib/transformation'>
Expand All @@ -307,20 +297,14 @@ declare module '@babel/core/lib/transformation/index.js' {
declare module.exports: $Exports<'@babel/core/lib/transformation'>
}
declare module '@babel/core/lib/transformation/normalize-file.js' {
declare module.exports: $Exports<
'@babel/core/lib/transformation/normalize-file'
>
declare module.exports: $Exports<'@babel/core/lib/transformation/normalize-file'>
}
declare module '@babel/core/lib/transformation/normalize-opts.js' {
declare module.exports: $Exports<
'@babel/core/lib/transformation/normalize-opts'
>
declare module.exports: $Exports<'@babel/core/lib/transformation/normalize-opts'>
}
declare module '@babel/core/lib/transformation/plugin-pass.js' {
declare module.exports: $Exports<'@babel/core/lib/transformation/plugin-pass'>
}
declare module '@babel/core/lib/transformation/util/missing-plugin-helper.js' {
declare module.exports: $Exports<
'@babel/core/lib/transformation/util/missing-plugin-helper'
>
declare module.exports: $Exports<'@babel/core/lib/transformation/util/missing-plugin-helper'>
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ declare module '@babel/plugin-proposal-class-properties/lib' {

// Filename aliases
declare module '@babel/plugin-proposal-class-properties/lib/index' {
declare module.exports: $Exports<
'@babel/plugin-proposal-class-properties/lib'
>
declare module.exports: $Exports<'@babel/plugin-proposal-class-properties/lib'>
}
declare module '@babel/plugin-proposal-class-properties/lib/index.js' {
declare module.exports: $Exports<
'@babel/plugin-proposal-class-properties/lib'
>
declare module.exports: $Exports<'@babel/plugin-proposal-class-properties/lib'>
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ declare module '@babel/plugin-proposal-export-default-from/lib' {

// Filename aliases
declare module '@babel/plugin-proposal-export-default-from/lib/index' {
declare module.exports: $Exports<
'@babel/plugin-proposal-export-default-from/lib'
>
declare module.exports: $Exports<'@babel/plugin-proposal-export-default-from/lib'>
}
declare module '@babel/plugin-proposal-export-default-from/lib/index.js' {
declare module.exports: $Exports<
'@babel/plugin-proposal-export-default-from/lib'
>
declare module.exports: $Exports<'@babel/plugin-proposal-export-default-from/lib'>
}

0 comments on commit eb01839

Please sign in to comment.