diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 27d2dae2b..000000000 --- a/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -*/node_modules -*.log diff --git a/.github/ISSUE_TEMPLATE/advanced-cheatsheet.md b/.github/ISSUE_TEMPLATE/advanced-cheatsheet.md deleted file mode 100644 index 659f19fa1..000000000 --- a/.github/ISSUE_TEMPLATE/advanced-cheatsheet.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -name: Advanced Cheatsheet -about: Report Issue/Suggest an idea for Advanced Cheatsheet -title: "[Advanced] ISSUE_TITLE_HERE" -labels: ADVANCED -assignees: "" ---- - -**What cheatsheet is this about? (if applicable)** - -Advanced cheatsheet - -**What's your issue or idea?** - -_Write here_ diff --git a/.github/ISSUE_TEMPLATE/basic-cheatsheet.md b/.github/ISSUE_TEMPLATE/basic-cheatsheet.md deleted file mode 100644 index c3e343071..000000000 --- a/.github/ISSUE_TEMPLATE/basic-cheatsheet.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Basic Cheatsheet -about: Report Issue/Suggest an idea for Basic Cheatsheet -title: "[Basic] ISSUE_TITLE_HERE" -labels: BASIC -assignees: sw-yx ---- - -**What cheatsheet is this about? (if applicable)** - -Basic cheatsheet - -**What's your issue or idea?** - -_Write here_ - -**(If applicable) Reproduction of issue in TypeScript Playground** - -_[start with the basic TS + React template](https://www.typescriptlang.org/play/?jsx=2&esModuleInterop=true&q=222#example/typescript-with-react)_ diff --git a/.github/ISSUE_TEMPLATE/general-react-ts-question.md b/.github/ISSUE_TEMPLATE/general-react-ts-question.md deleted file mode 100644 index a0f7946f6..000000000 --- a/.github/ISSUE_TEMPLATE/general-react-ts-question.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: General React+TS Question -about: Questions are welcome! We want to know and solve your pain points. -title: "[Question] QUESTION_TITLE_HERE" -labels: good first issue -assignees: sw-yx ---- - -**(If applicable) Reproduction of issue in TypeScript Playground** - -_[start with the basic TS + React template](https://www.typescriptlang.org/play/?jsx=2&esModuleInterop=true&q=222#example/typescript-with-react)_ diff --git a/.github/ISSUE_TEMPLATE/hoc-cheatsheet.md b/.github/ISSUE_TEMPLATE/hoc-cheatsheet.md deleted file mode 100644 index 76c46a9a7..000000000 --- a/.github/ISSUE_TEMPLATE/hoc-cheatsheet.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -name: HOC Cheatsheet -about: Report Issue/Suggest an idea for HOC Cheatsheet -title: "[HOC] ISSUE_TITLE_HERE" -labels: HOC -assignees: "" ---- - -**What cheatsheet is this about? (if applicable)** - -HOC cheatsheet - -**What's your issue or idea?** - -_Write here_ diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index b50bd785d..000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,6 +0,0 @@ -Thanks for contributing! - -- **If you are making a significant PR**, please make sure there is an open issue first -- **If you're just fixing typos or adding small notes**, a brief explanation of why you'd like to add it would be nice :) - -**If you are contributing to README.md, DON'T**. README.md is auto-generated. Please just make edits to the source inside of `/docs/basic`. _Sorry, we get that it is a slight pain._ diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 982f7d4db..000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 60 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 7 -# Issues with these labels will never be considered stale -exemptLabels: - - pinned - - security -# Label to use when marking an issue as stale -staleLabel: wontfix -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions! -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false diff --git a/.github/workflows/mlc_config.json b/.github/workflows/mlc_config.json deleted file mode 100644 index 05e1a42db..000000000 --- a/.github/workflows/mlc_config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "aliveStatusCodes": [200, 429] -} diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 757fd64ca..000000000 --- a/.prettierrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "trailingComma": "es5" -} diff --git a/README.md b/README.md index c16a20cd3..a5e172383 100644 --- a/README.md +++ b/README.md @@ -264,7 +264,7 @@ Note that for React < 18, the function signature of `useCallback` typed argument ```ts function useCallback any>( callback: T, - deps: DependencyList + deps: DependencyList, ): T; ``` @@ -298,7 +298,7 @@ type ACTIONTYPE = function reducer( state: typeof initialState, - action: ACTIONTYPE + action: ACTIONTYPE, ): typeof initialState { switch (action.type) { case "increment": @@ -353,7 +353,7 @@ In most cases, type inference for useReducer should work reliably. When inferenc ```tsx const [state, dispatch] = useReducer( reducer, - initialState + initialState, ); ``` @@ -372,7 +372,7 @@ function DelayedEffect(props: { timerMs: number }) { setTimeout(() => { /* do stuff */ }, timerMs), - [timerMs] + [timerMs], ); // bad example! setTimeout implicitly returns a number // because the arrow function body isn't wrapped in curly braces @@ -730,7 +730,7 @@ Here are a few ways in which you can annotate `getDerivedStateFromProps` class Comp extends React.Component { static getDerivedStateFromProps( props: Props, - state: State + state: State, ): Partial | null { // } @@ -1037,7 +1037,7 @@ Here are a few ways in which you can annotate `getDerivedStateFromProps` class Comp extends React.Component { static getDerivedStateFromProps( props: Props, - state: State + state: State, ): Partial | null { // } @@ -1321,7 +1321,7 @@ const useCurrentUser = () => { if (!currentUserContext) { throw new Error( - "useCurrentUser has to be used within " + "useCurrentUser has to be used within ", ); } @@ -1357,7 +1357,7 @@ Another option is to use an empty object as default value and cast it to the exp ```tsx const CurrentUserContext = createContext( - {} as CurrentUserContextType + {} as CurrentUserContextType, ); ``` @@ -1464,12 +1464,12 @@ interface Props { export const FancyButton = forwardRef( ( props: Props, - ref: Ref // <-- explicit immutable ref type + ref: Ref, // <-- explicit immutable ref type ) => ( - ) + ), ); ``` @@ -1532,7 +1532,7 @@ For true `forwardRef` behavior with generics, extend the module declaration: // Redeclare forwardRef to support generics declare module "react" { function forwardRef( - render: (props: P, ref: React.Ref) => React.ReactElement | null + render: (props: P, ref: React.Ref) => React.ReactElement | null, ): (props: P & React.RefAttributes) => React.ReactElement | null; } @@ -1546,7 +1546,7 @@ interface ClickableListProps { function ClickableListInner( props: ClickableListProps, - ref: ForwardedRef + ref: ForwardedRef, ) { return (
    @@ -1571,7 +1571,7 @@ If you need both generic support and proper forwardRef behavior with full type i // Add to your type definitions (e.g. in `index.d.ts` file) interface ForwardRefWithGenerics extends React.FC> { ( - props: WithForwardRefProps + props: WithForwardRefProps, ): ReturnType>>; } diff --git a/docs/basic/getting-started/class-components.md b/docs/basic/getting-started/class-components.md index 8c1113818..dcb04039d 100644 --- a/docs/basic/getting-started/class-components.md +++ b/docs/basic/getting-started/class-components.md @@ -118,7 +118,7 @@ Here are a few ways in which you can annotate `getDerivedStateFromProps` class Comp extends React.Component { static getDerivedStateFromProps( props: Props, - state: State + state: State, ): Partial | null { // } diff --git a/docs/basic/getting-started/context.md b/docs/basic/getting-started/context.md index 2628ffa40..664365b13 100644 --- a/docs/basic/getting-started/context.md +++ b/docs/basic/getting-started/context.md @@ -103,7 +103,7 @@ const useCurrentUser = () => { if (!currentUserContext) { throw new Error( - "useCurrentUser has to be used within " + "useCurrentUser has to be used within ", ); } @@ -139,7 +139,7 @@ Another option is to use an empty object as default value and cast it to the exp ```tsx const CurrentUserContext = createContext( - {} as CurrentUserContextType + {} as CurrentUserContextType, ); ``` diff --git a/docs/basic/getting-started/forward-create-ref.md b/docs/basic/getting-started/forward-create-ref.md index bfba4de73..c57e36c4b 100644 --- a/docs/basic/getting-started/forward-create-ref.md +++ b/docs/basic/getting-started/forward-create-ref.md @@ -92,12 +92,12 @@ interface Props { export const FancyButton = forwardRef( ( props: Props, - ref: Ref // <-- explicit immutable ref type + ref: Ref, // <-- explicit immutable ref type ) => ( - ) + ), ); ``` @@ -160,7 +160,7 @@ For true `forwardRef` behavior with generics, extend the module declaration: // Redeclare forwardRef to support generics declare module "react" { function forwardRef( - render: (props: P, ref: React.Ref) => React.ReactElement | null + render: (props: P, ref: React.Ref) => React.ReactElement | null, ): (props: P & React.RefAttributes) => React.ReactElement | null; } @@ -174,7 +174,7 @@ interface ClickableListProps { function ClickableListInner( props: ClickableListProps, - ref: ForwardedRef + ref: ForwardedRef, ) { return (
      @@ -199,7 +199,7 @@ If you need both generic support and proper forwardRef behavior with full type i // Add to your type definitions (e.g. in `index.d.ts` file) interface ForwardRefWithGenerics extends React.FC> { ( - props: WithForwardRefProps + props: WithForwardRefProps, ): ReturnType>>; } diff --git a/docs/basic/getting-started/hooks.md b/docs/basic/getting-started/hooks.md index 46a23b578..57a881291 100644 --- a/docs/basic/getting-started/hooks.md +++ b/docs/basic/getting-started/hooks.md @@ -61,7 +61,7 @@ Note that for React < 18, the function signature of `useCallback` typed argument ```ts function useCallback any>( callback: T, - deps: DependencyList + deps: DependencyList, ): T; ``` @@ -95,7 +95,7 @@ type ACTIONTYPE = function reducer( state: typeof initialState, - action: ACTIONTYPE + action: ACTIONTYPE, ): typeof initialState { switch (action.type) { case "increment": @@ -150,7 +150,7 @@ In most cases, type inference for useReducer should work reliably. When inferenc ```tsx const [state, dispatch] = useReducer( reducer, - initialState + initialState, ); ``` @@ -169,7 +169,7 @@ function DelayedEffect(props: { timerMs: number }) { setTimeout(() => { /* do stuff */ }, timerMs), - [timerMs] + [timerMs], ); // bad example! setTimeout implicitly returns a number // because the arrow function body isn't wrapped in curly braces diff --git a/docs/basic/getting-started/patterns_by_usecase.md b/docs/basic/getting-started/patterns_by_usecase.md index 3124e6e3e..392cbfc97 100644 --- a/docs/basic/getting-started/patterns_by_usecase.md +++ b/docs/basic/getting-started/patterns_by_usecase.md @@ -113,7 +113,7 @@ import { CSSProperties } from "react"; const Box = (props: CSSProperties) =>
      ; const Card = ( - { title, children, ...props }: { title: string } & $ElementProps // new utility, see below + { title, children, ...props }: { title: string } & $ElementProps, // new utility, see below ) => ( {title}: {children} @@ -144,7 +144,7 @@ export const defaultProps = < D extends Partial<$ElementProps>, >( defaults: D, - Component: C + Component: C, ): React.ComponentType<$ElementProps & Partial> => Recompose.defaultProps(defaults)(Component); ``` @@ -239,7 +239,7 @@ ReactDOM.render( )} />, - document.body + document.body, ); ``` @@ -251,7 +251,7 @@ ReactDOM.render( items={["a", "b"]} // Error: Type 'string' is not assignable to type 'number'. renderItem={(item) =>
    • {item.toPrecision(3)}
    • } />, - document.body + document.body, ); ``` @@ -444,7 +444,7 @@ type AnchorProps = React.JSX.IntrinsicElements["a"]; // optionally use a custom type guard function isPropsForAnchorElement( - props: ButtonProps | AnchorProps + props: ButtonProps | AnchorProps, ): props is AnchorProps { return "href" in props; } @@ -485,7 +485,7 @@ type AnchorProps = React.AnchorHTMLAttributes; type RouterLinkProps = Omit; const Link = ( - props: LinkProps & T extends RouterLinkProps ? RouterLinkProps : AnchorProps + props: LinkProps & T extends RouterLinkProps ? RouterLinkProps : AnchorProps, ) => { if ((props as RouterLinkProps).to) { return ; @@ -622,7 +622,7 @@ function Sequence(p: Props) { {!p.isArray && p.value}
      ), - [p.isArray, p.value] // TypeScript automatically matches the corresponding value type based on dependency change + [p.isArray, p.value], // TypeScript automatically matches the corresponding value type based on dependency change ); } @@ -839,7 +839,7 @@ type Omit = Pick>; // usage export const Checkbox = ( - props: Props & Omit, "label"> + props: Props & Omit, "label">, ) => { const { label } = props; return ( @@ -862,7 +862,7 @@ export interface Props { } export const Textbox = ( - props: Props & Omit, keyof Props> + props: Props & Omit, keyof Props>, ) => { // implement Textbox component ... }; @@ -963,7 +963,7 @@ Simply throwing an exception is fine, however it would be nice to make TypeScrip ```ts function parse( - date: string + date: string, ): Date | InvalidDateFormatError | DateIsInFutureError { if (!isValid(date)) return new InvalidDateFormatError("not a valid date format");