main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[d565449] | 1 | /**
|
---|
| 2 | * @fileoverview Disallow the use of process.exit()
|
---|
| 3 | * @author Nicholas C. Zakas
|
---|
| 4 | * @deprecated in ESLint v7.0.0
|
---|
| 5 | */
|
---|
| 6 | "use strict";
|
---|
| 7 |
|
---|
| 8 | //------------------------------------------------------------------------------
|
---|
| 9 | // Rule Definition
|
---|
| 10 | //------------------------------------------------------------------------------
|
---|
| 11 |
|
---|
| 12 | /** @type {import('../shared/types').Rule} */
|
---|
| 13 | module.exports = {
|
---|
| 14 | meta: {
|
---|
| 15 | deprecated: true,
|
---|
| 16 |
|
---|
| 17 | replacedBy: [],
|
---|
| 18 |
|
---|
| 19 | type: "suggestion",
|
---|
| 20 |
|
---|
| 21 | docs: {
|
---|
| 22 | description: "Disallow the use of `process.exit()`",
|
---|
| 23 | recommended: false,
|
---|
| 24 | url: "https://eslint.org/docs/latest/rules/no-process-exit"
|
---|
| 25 | },
|
---|
| 26 |
|
---|
| 27 | schema: [],
|
---|
| 28 |
|
---|
| 29 | messages: {
|
---|
| 30 | noProcessExit: "Don't use process.exit(); throw an error instead."
|
---|
| 31 | }
|
---|
| 32 | },
|
---|
| 33 |
|
---|
| 34 | create(context) {
|
---|
| 35 |
|
---|
| 36 | //--------------------------------------------------------------------------
|
---|
| 37 | // Public
|
---|
| 38 | //--------------------------------------------------------------------------
|
---|
| 39 |
|
---|
| 40 | return {
|
---|
| 41 | "CallExpression > MemberExpression.callee[object.name = 'process'][property.name = 'exit']"(node) {
|
---|
| 42 | context.report({ node: node.parent, messageId: "noProcessExit" });
|
---|
| 43 | }
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 | }
|
---|
| 47 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.