feat: adding linter for commits
This commit is contained in:
15
node_modules/hard-rejection/index.d.ts
generated
vendored
Normal file
15
node_modules/hard-rejection/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
declare const hardRejection: {
|
||||
/**
|
||||
Make unhandled promise rejections fail hard right away instead of the default [silent fail](https://gist.github.com/benjamingr/0237932cee84712951a2).
|
||||
|
||||
@param log - Custom logging function to print the rejected promise. Receives the error stack. Default: `console.error`.
|
||||
*/
|
||||
(log?: (stack?: string) => void): void;
|
||||
|
||||
// TODO: Remove this for the next major release, refactor the whole definition to:
|
||||
// declare function hardRejection(log?: (stack?: string) => void): void;
|
||||
// export = hardRejection;
|
||||
default: typeof hardRejection;
|
||||
};
|
||||
|
||||
export = hardRejection;
|
25
node_modules/hard-rejection/index.js
generated
vendored
Normal file
25
node_modules/hard-rejection/index.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
const util = require('util');
|
||||
|
||||
let installed = false;
|
||||
|
||||
const hardRejection = (log = console.error) => {
|
||||
if (installed) {
|
||||
return;
|
||||
}
|
||||
|
||||
installed = true;
|
||||
|
||||
process.on('unhandledRejection', error => {
|
||||
if (!(error instanceof Error)) {
|
||||
error = new Error(`Promise rejected with value: ${util.inspect(error)}`);
|
||||
}
|
||||
|
||||
log(error.stack);
|
||||
process.exit(1);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = hardRejection;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = hardRejection;
|
9
node_modules/hard-rejection/license
generated
vendored
Normal file
9
node_modules/hard-rejection/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
47
node_modules/hard-rejection/package.json
generated
vendored
Normal file
47
node_modules/hard-rejection/package.json
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "hard-rejection",
|
||||
"version": "2.1.0",
|
||||
"description": "Make unhandled promise rejections fail hard right away instead of the default silent fail",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/hard-rejection",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"register.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"promises",
|
||||
"unhandled",
|
||||
"uncaught",
|
||||
"rejection",
|
||||
"hard",
|
||||
"fail",
|
||||
"catch",
|
||||
"throw",
|
||||
"handler",
|
||||
"exit",
|
||||
"debug",
|
||||
"debugging",
|
||||
"verbose",
|
||||
"immediate",
|
||||
"immediately"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"execa": "^1.0.0",
|
||||
"tsd": "^0.7.1",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
77
node_modules/hard-rejection/readme.md
generated
vendored
Normal file
77
node_modules/hard-rejection/readme.md
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
# hard-rejection [](https://travis-ci.org/sindresorhus/hard-rejection)
|
||||
|
||||
> Make unhandled promise rejections fail hard right away instead of the default [silent fail](https://gist.github.com/benjamingr/0237932cee84712951a2)
|
||||
|
||||
Promises fail silently if you don't attach a `.catch()` handler.
|
||||
|
||||
This module exits the process with an error message right away when an unhandled rejection is encountered.<br>
|
||||
**Note: That might not be desirable as unhandled rejections can be [handled at a future point in time](https://nodejs.org/api/process.html#process_event_unhandledrejection), although not common. You've been warned.**
|
||||
|
||||
Intended for top-level long-running processes like servers, **but not in reusable modules.**<br>
|
||||
For command-line apps and tests, see [`loud-rejection`](https://github.com/sindresorhus/loud-rejection).
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install hard-rejection
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const hardRejection = require('hard-rejection');
|
||||
const promiseFunction = require('some-promise-fn');
|
||||
|
||||
// Install the handler
|
||||
hardRejection();
|
||||
|
||||
promiseFunction();
|
||||
```
|
||||
|
||||
Without this module it's more verbose and you might even miss some that will fail silently:
|
||||
|
||||
```js
|
||||
const promiseFunction = require('some-promise-fn');
|
||||
|
||||
function error(error) {
|
||||
console.error(error.stack);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
promiseFunction().catch(error);
|
||||
```
|
||||
|
||||
### Register script
|
||||
|
||||
Alternatively to the above, you may simply require `hard-rejection/register` and the handler will be automagically installed for you.
|
||||
|
||||
This is handy for ES2015 imports:
|
||||
|
||||
```js
|
||||
import 'hard-rejection/register';
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### hardRejection([log])
|
||||
|
||||
#### log
|
||||
|
||||
Type: `Function`<br>
|
||||
Default: `console.error`
|
||||
|
||||
Custom logging function to print the rejected promise. Receives the error stack.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [loud-rejection](https://github.com/sindresorhus/loud-rejection) - Make unhandled promise rejections fail loudly instead of the default silent fail
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
2
node_modules/hard-rejection/register.js
generated
vendored
Normal file
2
node_modules/hard-rejection/register.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
require('.')();
|
Reference in New Issue
Block a user