]> git.proxmox.com Git - pve-eslint.git/blame - eslint/lib/rules/no-process-env.js
update to 7.1.0 sources
[pve-eslint.git] / eslint / lib / rules / no-process-env.js
CommitLineData
eb39fafa
DC
1/**
2 * @fileoverview Disallow the use of process.env()
3 * @author Vignesh Anand
4 */
5"use strict";
6
7//------------------------------------------------------------------------------
8// Rule Definition
9//------------------------------------------------------------------------------
10
11module.exports = {
12 meta: {
56c4a2cb
DC
13 deprecated: true,
14
ebb53d86 15 replacedBy: [],
56c4a2cb 16
eb39fafa
DC
17 type: "suggestion",
18
19 docs: {
20 description: "disallow the use of `process.env`",
21 category: "Node.js and CommonJS",
22 recommended: false,
23 url: "https://eslint.org/docs/rules/no-process-env"
24 },
25
26 schema: [],
27
28 messages: {
29 unexpectedProcessEnv: "Unexpected use of process.env."
30 }
31 },
32
33 create(context) {
34
35 return {
36
37 MemberExpression(node) {
38 const objectName = node.object.name,
39 propertyName = node.property.name;
40
41 if (objectName === "process" && !node.computed && propertyName && propertyName === "env") {
42 context.report({ node, messageId: "unexpectedProcessEnv" });
43 }
44
45 }
46
47 };
48
49 }
50};