Skip to content

Commit aad0849

Browse files
Dependabot/npm and yarn/callstack/eslint config 14.0.0 (#1526)
* chore(deps-dev): bump @callstack/eslint-config from 13.0.2 to 14.0.0 Bumps [@callstack/eslint-config](https://github.com/callstack/eslint-config-callstack) from 13.0.2 to 14.0.0. - [Release notes](https://github.com/callstack/eslint-config-callstack/releases) - [Commits](callstack/eslint-config-callstack@v13.0.2...v14.0.0) --- updated-dependencies: - dependency-name: "@callstack/eslint-config" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * refactor: fix lint issues * refactor: fix lint issues * refactor: fix lint issues * refactor: fix lint issues * chore: update callstack-eslint config --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 4549e7b commit aad0849

22 files changed

+498
-158
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@babel/preset-flow": "^7.22.15",
4242
"@babel/preset-react": "^7.22.15",
4343
"@babel/preset-typescript": "^7.22.15",
44-
"@callstack/eslint-config": "^13.0.1",
44+
"@callstack/eslint-config": "^14.1.0",
4545
"@relmify/jest-serializer-strip-ansi": "^1.0.2",
4646
"@types/jest": "^29.5.5",
4747
"@types/react": "^18.2.21",

src/__tests__/act.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ test('fireEvent should trigger useState', () => {
4141
expect(counter.props.children).toEqual('Total count: 1');
4242
});
4343

44-
test('should be able to not await act', async () => {
44+
test('should be able to not await act', () => {
4545
const result = act(() => {});
4646
expect(result).toHaveProperty('then');
4747
});
@@ -52,5 +52,5 @@ test('should be able to await act', async () => {
5252
});
5353

5454
test('should be able to await act when promise rejects', async () => {
55-
await expect(act(async () => Promise.reject('error'))).rejects.toBe('error');
55+
await expect(act(() => Promise.reject('error'))).rejects.toBe('error');
5656
});

src/__tests__/render-hook.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test('allows rerendering', () => {
4545
expect(result.current).toEqual(['right', expect.any(Function)]);
4646
});
4747

48-
test('allows wrapper components', async () => {
48+
test('allows wrapper components', () => {
4949
const Context = React.createContext('default');
5050
function Wrapper({ children }: { children: ReactNode }) {
5151
return <Context.Provider value="provided">{children}</Context.Provider>;

src/__tests__/timer-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { setTimeout } from '../helpers/timers';
22

3-
async function sleep(ms: number): Promise<void> {
3+
function sleep(ms: number): Promise<void> {
44
return new Promise((resolve) => setTimeout(resolve, ms));
55
}
66

src/__tests__/wait-for-element-to-be-removed.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { render, fireEvent, waitForElementToBeRemoved } from '..';
55
const TestSetup = ({ shouldUseDelay = true }) => {
66
const [isAdded, setIsAdded] = useState(true);
77

8-
const removeElement = async () => {
8+
const removeElement = () => {
99
if (shouldUseDelay) {
1010
setTimeout(() => setIsAdded(false), 300);
1111
} else {

src/__tests__/wait-for.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ test.each([
281281

282282
// On mount, set the color to "red" in a promise microtask
283283
React.useEffect(() => {
284-
// eslint-disable-next-line promise/prefer-await-to-then, promise/catch-or-return
284+
// eslint-disable-next-line @typescript-eslint/no-floating-promises, promise/catch-or-return, promise/prefer-await-to-then
285285
Promise.resolve('red').then((c) => setColor(c));
286286
}, []);
287287

src/fire-event.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ function findEventHandler(
8888
if (handler && isEventEnabled(element, eventName, touchResponder))
8989
return handler;
9090

91+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
9192
if (element.parent === null || element.parent.parent === null) {
9293
return null;
9394
}
@@ -141,7 +142,7 @@ function fireEvent(
141142
}
142143

143144
let returnValue;
144-
act(() => {
145+
void act(() => {
145146
returnValue = handler(...data);
146147
});
147148

src/helpers/__tests__/timers.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { jestFakeTimersAreEnabled } from '../timers';
22
describe('timers', () => {
3-
it('should not mock timers if RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS is set', async () => {
3+
it('should not mock timers if RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS is set', () => {
44
process.env.RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS = 'true';
55
jest.useFakeTimers();
66
expect(jestFakeTimersAreEnabled()).toEqual(false);

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { cleanup } from './pure';
22
import { flushMicroTasksLegacy } from './flush-micro-tasks';
33
import { getIsReactActEnvironment, setReactActEnvironment } from './act';
44

5-
if (typeof process === 'undefined' || !process.env?.RNTL_SKIP_AUTO_CLEANUP) {
5+
if (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {
66
// If we're running in a test runner that supports afterEach
77
// then we'll automatically run cleanup afterEach test
88
// this ensures that tests run in isolation from each other

src/matchers/__tests__/to-have-accessible-name.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ test('toHaveAccessibleName() handles view with "aria-label" prop', () => {
1717
expect(element).not.toHaveAccessibleName('Other label');
1818
});
1919

20-
test('toHaveAccessibleName() handles view with "accessibilityLabelledBy" prop', async () => {
20+
test('toHaveAccessibleName() handles view with "accessibilityLabelledBy" prop', () => {
2121
render(
2222
<View>
2323
<Text nativeID="label">External label</Text>
@@ -30,7 +30,7 @@ test('toHaveAccessibleName() handles view with "accessibilityLabelledBy" prop',
3030
expect(element).not.toHaveAccessibleName('Other label');
3131
});
3232

33-
test('toHaveAccessibleName() handles nested "accessibilityLabelledBy"', async () => {
33+
test('toHaveAccessibleName() handles nested "accessibilityLabelledBy"', () => {
3434
render(
3535
<>
3636
<View nativeID="label">
@@ -45,7 +45,7 @@ test('toHaveAccessibleName() handles nested "accessibilityLabelledBy"', async ()
4545
expect(element).not.toHaveAccessibleName('Other label');
4646
});
4747

48-
test('toHaveAccessibleName() handles view with nested "accessibilityLabelledBy" with no text', async () => {
48+
test('toHaveAccessibleName() handles view with nested "accessibilityLabelledBy" with no text', () => {
4949
render(
5050
<>
5151
<View nativeID="label">
@@ -59,7 +59,7 @@ test('toHaveAccessibleName() handles view with nested "accessibilityLabelledBy"
5959
expect(element).not.toHaveAccessibleName();
6060
});
6161

62-
test('toHaveAccessibleName() handles view with "aria-labelledby" prop', async () => {
62+
test('toHaveAccessibleName() handles view with "aria-labelledby" prop', () => {
6363
render(
6464
<View>
6565
<Text nativeID="label">External label</Text>

0 commit comments

Comments
 (0)