Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .eslintrc

This file was deleted.

54 changes: 54 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { includeIgnoreFile } from '@eslint/compat';
import eslint from '@eslint/js';
import headerPlugin from 'eslint-plugin-header';
import eslintPrettier from 'eslint-plugin-prettier/recommended';
import reactPlugin from 'eslint-plugin-react';
import unicornPlugin from 'eslint-plugin-unicorn';
import globals from 'globals';
import path from 'node:path';
import tsEslint from 'typescript-eslint';

// https://github.com/Stuk/eslint-plugin-header/issues/57
headerPlugin.rules.header.meta.schema = false;

export default tsEslint.config(
includeIgnoreFile(path.resolve('.gitignore')),
{
settings: {
react: { version: 'detect' },
},
},
eslint.configs.recommended,
tsEslint.configs.recommended,
reactPlugin.configs.flat.recommended,
eslintPrettier,
{
files: ['**/*.{js,mjs,ts,tsx}'],
languageOptions: {
globals: {
...globals.browser,
},
},
plugins: {
unicorn: unicornPlugin,
header: headerPlugin,
},
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-namespace': 'off',
'header/header': [
'error',
'line',
[' Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.', ' SPDX-License-Identifier: Apache-2.0'],
],
'no-warning-comments': 'warn',
'react/display-name': 'off',
},
},
);
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ComponentProps {}
1 change: 1 addition & 0 deletions fixtures/components/errors-types/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

const a: number = '123';
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import * as React from 'react';

interface FocusableForwardRefType {
Expand Down Expand Up @@ -31,7 +32,7 @@ const Focusable = React.forwardRef(
focus(rowIndex: number) {},
}));
return <button>Test</button>;
}
},
) as FocusableForwardRefType;

export default Focusable;
3 changes: 2 additions & 1 deletion fixtures/components/forward-ref/focusable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import * as React from 'react';

export interface FocusableProps {
Expand Down Expand Up @@ -43,7 +44,7 @@ export namespace FocusableProps {
const Focusable = React.forwardRef(
({ children, type = 'text', count = 123, enabled = true }: FocusableProps, ref: React.Ref<FocusableProps.Ref>) => {
return <button ref={ref}>Test</button>;
}
},
);

export default Focusable;
1 change: 1 addition & 0 deletions fixtures/components/internal/events.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

export type NonCancelableEventHandler<Detail = Record<string, never>> = (event: any) => void;
export type CancelableEventHandler<Detail = Record<string, never>> = (event: any) => void;
1 change: 0 additions & 1 deletion fixtures/components/system-tag/tree/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
import * as React from 'react';

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface TreeProps {}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export interface ButtonProps {
}

export default function Button({ onClick }: ButtonProps) {
return <button />;
return <button onClick={() => onClick} />;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import * as React from 'react';
import Internal from './internal';

Expand All @@ -10,7 +11,6 @@ function InternalSameFile() {
return <Internal name="test" />;
}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface WithInternalsProps {
// nothing here
}
Expand Down
2 changes: 1 addition & 1 deletion fixtures/hooks/use-container-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { ContainerQueryEntry } from './interfaces';
*/
export default function useContainerQuery<ObservedState>(
mapFn: (entry: ContainerQueryEntry, prev: null | ObservedState) => ObservedState,
deps: React.DependencyList = []
deps: React.DependencyList = [],
): [null | ObservedState, React.MutableRefObject<any>] {
return [null, null as any];
}
2 changes: 1 addition & 1 deletion fixtures/hooks/use-resize-observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ import { ContainerQueryEntry, ElementReference } from './interfaces';
*/
export default function useResizeObserver(
elementRef: ElementReference,
onObserve: (entry: ContainerQueryEntry) => void
onObserve: (entry: ContainerQueryEntry) => void,
) {}
1 change: 1 addition & 0 deletions fixtures/test-utils/advanced-types/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

export class TestUtilWrapper {
/**
* Generic return value
Expand Down
1 change: 1 addition & 0 deletions fixtures/test-utils/default-values/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

export class DefaultValueWrapper {
selectOption(index = 1): void {}

Expand Down
1 change: 1 addition & 0 deletions fixtures/test-utils/errors-types/errors-types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

const wrong: number = 'a';
4 changes: 3 additions & 1 deletion fixtures/test-utils/exports/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
export class ElementWrapper {}

// this generic type simulates MultiElementWrapper from test-utils-core
export class MultiElementWrapper<T extends ElementWrapper> {}
export class MultiElementWrapper<T extends ElementWrapper> {
items: readonly T[] = [];
}
4 changes: 3 additions & 1 deletion fixtures/test-utils/simple/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export class TestUtilWrapper {
*
* @param newString
*/
setString(newString: string) {}
setString(newString: string) {
console.log(newString);
}

/**
* Short Text.
Expand Down
Loading
Loading