1 |
|
2 |
|
3 |
|
4 |
|
5 | "use strict";
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | module.exports = {
|
12 | meta: {
|
13 | docs: {
|
14 | description: "disallow the use of `process.env`",
|
15 | category: "Node.js and CommonJS",
|
16 | recommended: false,
|
17 | url: "https://eslint.org/docs/rules/no-process-env"
|
18 | },
|
19 |
|
20 | schema: []
|
21 | },
|
22 |
|
23 | create(context) {
|
24 |
|
25 | return {
|
26 |
|
27 | MemberExpression(node) {
|
28 | const objectName = node.object.name,
|
29 | propertyName = node.property.name;
|
30 |
|
31 | if (objectName === "process" && !node.computed && propertyName && propertyName === "env") {
|
32 | context.report({ node, message: "Unexpected use of process.env." });
|
33 | }
|
34 |
|
35 | }
|
36 |
|
37 | };
|
38 |
|
39 | }
|
40 | };
|