diff --git a/.gitignore b/.gitignore index 6ca93eb..bec6a4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ build lib -node_modules +/node_modules coverage diff --git a/fixtures/components/complex-types/column-layout/index.tsx b/fixtures/components/complex-types/column-layout/index.tsx new file mode 100644 index 0000000..bca9b55 --- /dev/null +++ b/fixtures/components/complex-types/column-layout/index.tsx @@ -0,0 +1,17 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +import * as React from 'react'; + +export interface ColumnLayoutProps { + columns: ColumnLayoutProps.Columns; + widths: ColumnLayoutProps.Widths; +} + +export namespace ColumnLayoutProps { + export type Columns = 1 | 2 | 3 | 4; + export type Widths = 25 | '50%' | 100 | '33%'; +} + +export default function ColumnLayout(props: ColumnLayoutProps) { + return
; +} diff --git a/fixtures/components/complex-types/table/index.tsx b/fixtures/components/complex-types/table/index.tsx index 4e8ee85..f5ecff6 100644 --- a/fixtures/components/complex-types/table/index.tsx +++ b/fixtures/components/complex-types/table/index.tsx @@ -3,6 +3,8 @@ import * as React from 'react'; import { TableProps } from './interfaces'; +export { TableProps }; + export default function Table(props: TableProps) { return ; } diff --git a/fixtures/components/error-incorrect-component-name/button/index.tsx b/fixtures/components/error-missing-props/button/index.tsx similarity index 55% rename from fixtures/components/error-incorrect-component-name/button/index.tsx rename to fixtures/components/error-missing-props/button/index.tsx index a5bf252..f76a619 100644 --- a/fixtures/components/error-incorrect-component-name/button/index.tsx +++ b/fixtures/components/error-missing-props/button/index.tsx @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import * as React from 'react'; -export default function Input() { - return Surprise, I am not Button!; +// should fail because ButtonProps export is missing +export default function Button() { + return Test; } diff --git a/fixtures/components/error-incorrect-component-name/tsconfig.json b/fixtures/components/error-missing-props/tsconfig.json similarity index 100% rename from fixtures/components/error-incorrect-component-name/tsconfig.json rename to fixtures/components/error-missing-props/tsconfig.json diff --git a/fixtures/components/error-not-a-component/button/index.tsx b/fixtures/components/error-not-a-component/button/index.tsx new file mode 100644 index 0000000..9ae54f0 --- /dev/null +++ b/fixtures/components/error-not-a-component/button/index.tsx @@ -0,0 +1,7 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +export default function Button() { + // if a function does not return JSX, we throw + return { type: 'button' }; +} diff --git a/fixtures/components/release-status/tsconfig.json b/fixtures/components/error-not-a-component/tsconfig.json similarity index 100% rename from fixtures/components/release-status/tsconfig.json rename to fixtures/components/error-not-a-component/tsconfig.json diff --git a/fixtures/components/error-ref-property-type/button/index.tsx b/fixtures/components/error-ref-property-type/button/index.tsx index 07b5558..8b3a8af 100644 --- a/fixtures/components/error-ref-property-type/button/index.tsx +++ b/fixtures/components/error-ref-property-type/button/index.tsx @@ -3,12 +3,12 @@ import * as React from 'react'; export namespace ButtonProps { - interface Ref { + export interface Ref { value: string; } } -const Button = React.forwardRef((props, ref) => { +const Button = React.forwardRef((props, ref) => { return