Skip to content

Commit e4c5c99

Browse files
chore(deps-dev): Bump the linting group across 1 directory with 5 updates (#2125)
* chore(deps-dev): Bump the linting group across 1 directory with 5 updates Bumps the linting group with 5 updates in the / directory: | Package | From | To | | --- | --- | --- | | [eslint](https://github.com/eslint/eslint) | `10.3.0` | `10.4.0` | | [eslint-plugin-oxlint](https://github.com/oxc-project/eslint-plugin-oxlint) | `1.64.0` | `1.66.0` | | [oxlint](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxlint) | `1.64.0` | `1.66.0` | | [oxlint-tsgolint](https://github.com/oxc-project/tsgolint) | `0.22.1` | `0.23.0` | | [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.59.3` | `8.59.4` | Updates `eslint` from 10.3.0 to 10.4.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Commits](eslint/eslint@v10.3.0...v10.4.0) Updates `eslint-plugin-oxlint` from 1.64.0 to 1.66.0 - [Release notes](https://github.com/oxc-project/eslint-plugin-oxlint/releases) - [Commits](oxc-project/eslint-plugin-oxlint@v1.64.0...v1.66.0) Updates `oxlint` from 1.64.0 to 1.66.0 - [Release notes](https://github.com/oxc-project/oxc/releases) - [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxlint/CHANGELOG.md) - [Commits](https://github.com/oxc-project/oxc/commits/oxlint_v1.66.0/npm/oxlint) Updates `oxlint-tsgolint` from 0.22.1 to 0.23.0 - [Release notes](https://github.com/oxc-project/tsgolint/releases) - [Commits](oxc-project/tsgolint@v0.22.1...v0.23.0) Updates `typescript-eslint` from 8.59.3 to 8.59.4 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.59.4/packages/typescript-eslint) --- updated-dependencies: - dependency-name: eslint dependency-version: 10.4.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: linting - dependency-name: eslint-plugin-oxlint dependency-version: 1.66.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: linting - dependency-name: oxlint dependency-version: 1.66.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: linting - dependency-name: oxlint-tsgolint dependency-version: 0.23.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: linting - dependency-name: typescript-eslint dependency-version: 8.59.4 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: linting ... Signed-off-by: dependabot[bot] <support@github.com> * test(@inquirer/core): hoist prompt fixtures for lint --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Simon Boudrias <simon.boudrias@datadoghq.com>
1 parent b7aed8f commit e4c5c99

3 files changed

Lines changed: 264 additions & 290 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"nano-staged": "^1.0.2",
8181
"oxfmt": "^0.51.0",
8282
"oxlint": "^1.58.0",
83-
"oxlint-tsgolint": "^0.22.1",
83+
"oxlint-tsgolint": "^0.23.0",
8484
"setup-packages": "workspace:*",
8585
"turbo": "^2.9.4",
8686
"type-fest": "^5.5.0",

packages/core/core.test.ts

Lines changed: 71 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,74 @@ import {
2525
} from './src/index.ts';
2626
import { cursorLeft, cursorShow, eraseLines } from '@inquirer/ansi';
2727

28-
describe('createPrompt()', () => {
29-
it('onKeypress: allow to implement custom behavior on keypress', async () => {
30-
const Prompt = (config: { message: string }, done: (value: string) => void) => {
31-
const [value, setValue] = useState('');
28+
type PromptConfig = { message: string };
29+
type DoneCallback = (value: string) => void;
30+
31+
const keypressNavigationPrompt = (config: PromptConfig, done: DoneCallback) => {
32+
const [value, setValue] = useState('');
33+
34+
useKeypress((key: KeypressEvent) => {
35+
if (isEnterKey(key)) {
36+
done(value);
37+
} else if (isDownKey(key)) {
38+
setValue('down');
39+
} else if (isUpKey(key)) {
40+
setValue('up');
41+
} else if (isShiftKey(key)) {
42+
setValue('shift');
43+
}
44+
});
3245

33-
useKeypress((key: KeypressEvent) => {
34-
if (isEnterKey(key)) {
35-
done(value);
36-
} else if (isDownKey(key)) {
37-
setValue('down');
38-
} else if (isUpKey(key)) {
39-
setValue('up');
40-
} else if (isShiftKey(key)) {
41-
setValue('shift');
42-
}
43-
});
46+
return `${config.message} ${value}`;
47+
};
4448

45-
return `${config.message} ${value}`;
46-
};
49+
const arrayStatePrompt = (_config: PromptConfig, done: DoneCallback) => {
50+
const [value, setValue] = useState([1, 2]);
4751

48-
const prompt = createPrompt(Prompt);
52+
useEffect(() => {
53+
setValue([1, 3]);
54+
}, []);
55+
56+
useKeypress((key: KeypressEvent) => {
57+
if (isEnterKey(key)) {
58+
done(String(value));
59+
}
60+
});
61+
62+
return String(value);
63+
};
64+
65+
const effectNotSyncPrompt = (config: PromptConfig, done: DoneCallback) => {
66+
let value = 'outside';
67+
68+
useEffect(() => {
69+
value = 'inside';
70+
}, []);
71+
72+
useKeypress((key: KeypressEvent) => {
73+
if (isEnterKey(key)) {
74+
done('done');
75+
}
76+
});
77+
78+
expect(value).toEqual('outside');
79+
80+
return `${config.message} ${value}`;
81+
};
82+
83+
const submitOnEnterPrompt = (config: PromptConfig, done: DoneCallback) => {
84+
useKeypress((key: KeypressEvent) => {
85+
if (isEnterKey(key)) {
86+
done('done');
87+
}
88+
});
89+
90+
return config.message;
91+
};
92+
93+
describe('createPrompt()', () => {
94+
it('onKeypress: allow to implement custom behavior on keypress', async () => {
95+
const prompt = createPrompt(keypressNavigationPrompt);
4996
const { answer, events, getScreen } = await render(prompt, { message: 'Question' });
5097

5198
events.keypress({ name: 'space', shift: true });
@@ -60,23 +107,7 @@ describe('createPrompt()', () => {
60107
});
61108

62109
it('useEffect: works with setting state at once with objects', async () => {
63-
const Prompt = (_config: { message: string }, done: (value: string) => void) => {
64-
const [value, setValue] = useState([1, 2]);
65-
66-
useEffect(() => {
67-
setValue([1, 3]);
68-
}, []);
69-
70-
useKeypress((key: KeypressEvent) => {
71-
if (isEnterKey(key)) {
72-
done(String(value));
73-
}
74-
});
75-
76-
return String(value);
77-
};
78-
79-
const prompt = createPrompt(Prompt);
110+
const prompt = createPrompt(arrayStatePrompt);
80111
const { answer, events } = await render(prompt, { message: 'Question' });
81112
events.keypress('enter');
82113

@@ -172,25 +203,7 @@ describe('createPrompt()', () => {
172203
});
173204

174205
it('useEffect: is not called synchronously during render', async () => {
175-
const Prompt = (config: { message: string }, done: (value: string) => void) => {
176-
let value = 'outside';
177-
178-
useEffect(() => {
179-
value = 'inside';
180-
}, []);
181-
182-
useKeypress((key: KeypressEvent) => {
183-
if (isEnterKey(key)) {
184-
done('done');
185-
}
186-
});
187-
188-
expect(value).toEqual('outside');
189-
190-
return `${config.message} ${value}`;
191-
};
192-
193-
const prompt = createPrompt(Prompt);
206+
const prompt = createPrompt(effectNotSyncPrompt);
194207
const { answer, events } = await render(prompt, { message: 'Question' });
195208

196209
events.keypress('enter');
@@ -468,17 +481,7 @@ describe('createPrompt()', () => {
468481
});
469482

470483
it('allow cleaning the prompt after completion', async () => {
471-
const Prompt = (config: { message: string }, done: (value: string) => void) => {
472-
useKeypress((key: KeypressEvent) => {
473-
if (isEnterKey(key)) {
474-
done('done');
475-
}
476-
});
477-
478-
return config.message;
479-
};
480-
481-
const prompt = createPrompt(Prompt);
484+
const prompt = createPrompt(submitOnEnterPrompt);
482485
const { answer, events, getScreen } = await render(
483486
prompt,
484487
{ message: 'Question' },
@@ -528,16 +531,7 @@ describe('createPrompt()', () => {
528531
});
529532

530533
it('release listeners when done', async () => {
531-
const Prompt = (config: { message: string }, done: (value: string) => void) => {
532-
useKeypress((key: KeypressEvent) => {
533-
if (isEnterKey(key)) {
534-
done('done');
535-
}
536-
});
537-
538-
return config.message;
539-
};
540-
const prompt = createPrompt(Prompt);
534+
const prompt = createPrompt(submitOnEnterPrompt);
541535

542536
const warningSpy = vi.fn();
543537
process.on('warning', warningSpy);
@@ -553,17 +547,7 @@ describe('createPrompt()', () => {
553547
});
554548

555549
it('allow aborting the prompt using signals', async () => {
556-
const Prompt = (config: { message: string }, done: (value: string) => void) => {
557-
useKeypress((key: KeypressEvent) => {
558-
if (isEnterKey(key)) {
559-
done('done');
560-
}
561-
});
562-
563-
return config.message;
564-
};
565-
566-
const prompt = createPrompt(Prompt);
550+
const prompt = createPrompt(submitOnEnterPrompt);
567551
const abortController = new AbortController();
568552
const { answer } = await render(
569553
prompt,
@@ -612,17 +596,7 @@ it('should ignore keypresses buffered before prompt creation', async () => {
612596
});
613597

614598
it('fail on aborted signals', async () => {
615-
const Prompt = (config: { message: string }, done: (value: string) => void) => {
616-
useKeypress((key: KeypressEvent) => {
617-
if (isEnterKey(key)) {
618-
done('done');
619-
}
620-
});
621-
622-
return config.message;
623-
};
624-
625-
const prompt = createPrompt(Prompt);
599+
const prompt = createPrompt(submitOnEnterPrompt);
626600
const { answer } = await render(
627601
prompt,
628602
{ message: 'Question' },

0 commit comments

Comments
 (0)