Skip to content

Commit 99fe7a6

Browse files
committed
Remove hardRejection option
Fixes #250
1 parent a7bdf6e commit 99fe7a6

File tree

6 files changed

+4
-18
lines changed

6 files changed

+4
-18
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
"camelcase-keys",
5252
"decamelize",
5353
"decamelize-keys",
54-
"hard-rejection",
5554
"minimist-options",
5655
"normalize-package-data",
5756
"read-package-up",
@@ -73,7 +72,6 @@
7372
"delete_comments": "^0.0.2",
7473
"execa": "^8.0.1",
7574
"globby": "^14.0.0",
76-
"hard-rejection": "^2.1.0",
7775
"indent-string": "^5.0.0",
7876
"minimist-options": "4.1.0",
7977
"normalize-package-data": "^6.0.0",

readme.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,6 @@ const cli = meow(`
285285
*/
286286
```
287287

288-
##### hardRejection
289-
290-
Type: `boolean`\
291-
Default: `true`
292-
293-
Whether to use [`hard-rejection`](https://github.com/sindresorhus/hard-rejection) or not. Disabling this can be useful if you need to handle `process.on('unhandledRejection')` yourself.
294-
295288
##### allowUnknownFlags
296289

297290
Type `boolean`\

source/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,11 @@ export type Options<Flags extends AnyFlags> = {
294294
// eslint-disable-next-line @typescript-eslint/ban-types
295295
readonly booleanDefault?: boolean | null | undefined;
296296

297+
// TODO: Remove this in meow 14.
297298
/**
298299
Whether to use [hard-rejection](https://github.com/sindresorhus/hard-rejection) or not. Disabling this can be useful if you need to handle `process.on('unhandledRejection')` yourself.
299300
301+
@deprecated This is the default behavior since Node.js 16, so this option is moot.
300302
@default true
301303
*/
302304
readonly hardRejection?: boolean;

source/index.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import parseArguments from 'yargs-parser';
33
import camelCaseKeys from 'camelcase-keys';
44
import {trimNewlines} from 'trim-newlines';
55
import redent from 'redent';
6-
import hardRejection from 'hard-rejection';
76
import normalizePackageData from 'normalize-package-data';
87
import {buildOptions} from './options.js';
98
import {buildParserOptions} from './parser.js';
@@ -89,11 +88,6 @@ const buildResult = (options, parserOptions) => {
8988

9089
const meow = (helpText, options = {}) => {
9190
const parsedOptions = buildOptions(helpText, options);
92-
93-
if (parsedOptions.hardRejection) {
94-
hardRejection();
95-
}
96-
9791
const parserOptions = buildParserOptions(parsedOptions);
9892
const result = buildResult(parsedOptions, parserOptions);
9993

source/options.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export const buildOptions = (helpText, options) => {
7878
autoHelp: true,
7979
autoVersion: true,
8080
booleanDefault: false,
81-
hardRejection: true,
8281
allowUnknownFlags: true,
8382
allowParentFlags: true,
8483
...options,

test-d/build.test-d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type AnyFlag = NonNullable<NonNullable<Parameters<typeof meow>[0]>['flags']>[str
77
const importMeta = import.meta;
88

99
expectType<Result<never>>(meow('Help text'));
10-
expectType<Result<never>>(meow('Help text', {importMeta, hardRejection: false}));
10+
expectType<Result<never>>(meow('Help text', {importMeta}));
1111
expectAssignable<{flags: {foo: number}}>(
1212
meow({importMeta: import.meta, flags: {foo: {type: 'number', isRequired: true}}}),
1313
);
@@ -49,7 +49,7 @@ expectType<Result<never>>(meow({importMeta, inferType: true}));
4949
expectType<Result<never>>(meow({importMeta, booleanDefault: true}));
5050
expectType<Result<never>>(meow({importMeta, booleanDefault: null}));
5151
expectType<Result<never>>(meow({importMeta, booleanDefault: undefined}));
52-
expectType<Result<never>>(meow({importMeta, hardRejection: false}));
52+
expectType<Result<never>>(meow({importMeta}));
5353

5454
const result = meow('Help text', {
5555
importMeta,

0 commit comments

Comments
 (0)